@burtson-labs/bandit-engine 2.0.124 → 2.0.126

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-WSNV6EX5.mjs";
3
+ } from "./chunk-574ILQTT.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-4RRQQPFZ.mjs";
17
+ } from "./chunk-TQP3GUW5.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-JJTUEC2E.mjs";
86
+ } from "./chunk-OLKDPUWL.mjs";
87
87
  import {
88
88
  TOPICS,
89
89
  brandingService_default,
@@ -9754,7 +9754,7 @@ var MCPToolsTabV2_default = MCPToolsTabV2;
9754
9754
 
9755
9755
  // src/management/management.tsx
9756
9756
  import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
9757
- var preloadChatPage = () => import("./chat-QBDECLF3.mjs");
9757
+ var preloadChatPage = () => import("./chat-Z3GRZ7GA.mjs");
9758
9758
  var buildCapabilitiesUrl = (gatewayApiUrl) => {
9759
9759
  const trimmed = gatewayApiUrl.replace(/\/$/, "");
9760
9760
  if (trimmed.endsWith("/api")) {
@@ -11110,4 +11110,4 @@ export {
11110
11110
  useGatewayMemory,
11111
11111
  management_default
11112
11112
  };
11113
- //# sourceMappingURL=chunk-K5HAVOPD.mjs.map
11113
+ //# sourceMappingURL=chunk-RKA3X3EY.mjs.map
@@ -24,7 +24,7 @@ import {
24
24
  useNotificationService,
25
25
  useTTS,
26
26
  useVoiceStore
27
- } from "./chunk-JJTUEC2E.mjs";
27
+ } from "./chunk-OLKDPUWL.mjs";
28
28
  import {
29
29
  brandingService_default,
30
30
  toTitleCase,
@@ -2803,4 +2803,4 @@ export {
2803
2803
  MAX_WINDOWED_HEIGHT,
2804
2804
  chat_modal_default
2805
2805
  };
2806
- //# sourceMappingURL=chunk-4RRQQPFZ.mjs.map
2806
+ //# sourceMappingURL=chunk-TQP3GUW5.mjs.map
package/dist/index.js CHANGED
@@ -15742,7 +15742,7 @@ var init_source_chips = __esm({
15742
15742
  });
15743
15743
 
15744
15744
  // src/chat/chat-messages.tsx
15745
- var import_material12, import_jsx_runtime15, ChatMessages, chat_messages_default;
15745
+ var import_material12, import_jsx_runtime15, WORKING_TOKEN_RE, ToolWorkingChip, ChatMessages, chat_messages_default;
15746
15746
  var init_chat_messages = __esm({
15747
15747
  "src/chat/chat-messages.tsx"() {
15748
15748
  "use strict";
@@ -15752,6 +15752,38 @@ var init_chat_messages = __esm({
15752
15752
  init_source_chips();
15753
15753
  init_conversationStore();
15754
15754
  import_jsx_runtime15 = require("react/jsx-runtime");
15755
+ WORKING_TOKEN_RE = /\s*<<working:([^>]*)>>\s*$/;
15756
+ ToolWorkingChip = ({ label }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
15757
+ import_material12.Box,
15758
+ {
15759
+ sx: (theme) => ({
15760
+ display: "inline-flex",
15761
+ alignItems: "center",
15762
+ gap: 1.25,
15763
+ mt: 1.5,
15764
+ px: 1.75,
15765
+ py: 0.9,
15766
+ borderRadius: 999,
15767
+ bgcolor: theme.palette.action.hover,
15768
+ border: `1px solid ${theme.palette.divider}`
15769
+ }),
15770
+ children: [
15771
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "typing-only", children: [
15772
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dot" }),
15773
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dot" }),
15774
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "dot" })
15775
+ ] }),
15776
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
15777
+ import_material12.Box,
15778
+ {
15779
+ component: "span",
15780
+ sx: { fontSize: "0.85rem", fontWeight: 500, color: "text.secondary", userSelect: "none" },
15781
+ children: label || "Working on it"
15782
+ }
15783
+ )
15784
+ ]
15785
+ }
15786
+ );
15755
15787
  ChatMessages = ({
15756
15788
  pendingMessage,
15757
15789
  streamBuffer,
@@ -15777,7 +15809,9 @@ var init_chat_messages = __esm({
15777
15809
  const isPlaceholder = entry.answer === "...";
15778
15810
  const showLoader = isLast && isStreaming && streamBuffer.trim() === "";
15779
15811
  const showThinking = showLoader && isThinking;
15780
- const content = isLast ? isStreaming ? streamBuffer || "" : isPlaceholder ? "" : entry.answer : entry.answer;
15812
+ const rawContent = isLast ? isStreaming ? streamBuffer || "" : isPlaceholder ? "" : entry.answer : entry.answer;
15813
+ const workingMatch = isLast && isStreaming ? rawContent.match(WORKING_TOKEN_RE) : null;
15814
+ const content = workingMatch ? rawContent.replace(WORKING_TOKEN_RE, "") : rawContent;
15781
15815
  const rawSources = entry.sourceFiles;
15782
15816
  const sourceSummaries = rawSources ? rawSources.filter((doc) => doc && typeof doc.name === "string" && doc.name.trim()).map((doc) => ({ id: doc.id || doc.name, name: doc.name.trim() })) : void 0;
15783
15817
  const responseNode = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
@@ -15850,6 +15884,7 @@ var init_chat_messages = __esm({
15850
15884
  sources: sourceSummaries
15851
15885
  }
15852
15886
  ),
15887
+ workingMatch && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ToolWorkingChip, { label: workingMatch[1] }),
15853
15888
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(source_chips_default, { content })
15854
15889
  ]
15855
15890
  }
@@ -15862,7 +15897,7 @@ var init_chat_messages = __esm({
15862
15897
  {
15863
15898
  question: entry.question,
15864
15899
  response: responseNode,
15865
- responseText: isLast ? isStreaming ? streamBuffer || "" : isPlaceholder ? "" : entry.answer : entry.answer,
15900
+ responseText: content,
15866
15901
  backgroundColor: "#444",
15867
15902
  images: entry.images,
15868
15903
  memoryUpdated: entry.memoryUpdated && !isPlaceholder,
@@ -18188,8 +18223,10 @@ var init_FeedbackModal = __esm({
18188
18223
  overflow: "hidden",
18189
18224
  display: "flex",
18190
18225
  flexDirection: "column",
18191
- height: "100dvh",
18192
- maxHeight: "100dvh",
18226
+ // Size to the (now condensed) content instead of pinning to the
18227
+ // full viewport — a mostly-empty full-height sheet looked broken.
18228
+ height: isMobile ? "100dvh" : "auto",
18229
+ maxHeight: isMobile ? "100dvh" : "90vh",
18193
18230
  margin: isMobile ? 0 : "auto",
18194
18231
  position: "relative"
18195
18232
  }
@@ -18313,7 +18350,11 @@ var init_FeedbackModal = __esm({
18313
18350
  gridTemplateRows: "auto auto auto auto",
18314
18351
  rowGap: "16px",
18315
18352
  columnGap: "0px",
18316
- width: "100%"
18353
+ width: "100%",
18354
+ // Headroom for the first field's floating label — MUI zeroes
18355
+ // DialogContent's top padding after a DialogTitle, which clipped
18356
+ // the "Title" label under the header.
18357
+ pt: 1.5
18317
18358
  },
18318
18359
  children: [
18319
18360
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
@@ -21994,8 +22035,20 @@ ${protocol}`;
21994
22035
  return result.trimStart();
21995
22036
  };
21996
22037
  const stripToolBlocks = (text) => text.replace(/```(?:tool_code|TOOL_CODE)\s*\n[\s\S]*?\n```/gi, "").trim();
22038
+ const truncateAtToolApparatus = (text) => {
22039
+ let t = text;
22040
+ const fenceIdx = t.search(/```(?:tool_code|TOOL_CODE)/);
22041
+ if (fenceIdx !== -1) t = t.slice(0, fenceIdx);
22042
+ const callIdx = t.search(
22043
+ /\b(?:web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
22044
+ );
22045
+ if (callIdx !== -1) t = t.slice(0, callIdx);
22046
+ t = t.replace(/```[\w-]*\s*$/, "");
22047
+ const fenceCount = (t.match(/```/g) || []).length;
22048
+ if (fenceCount % 2 === 1) t = t.slice(0, t.lastIndexOf("```"));
22049
+ return t.trim();
22050
+ };
21997
22051
  let workingLabel = "Working on it";
21998
- let workingPreamble = "";
21999
22052
  const stopWorking = () => {
22000
22053
  if (workingTimer) {
22001
22054
  clearInterval(workingTimer);
@@ -22004,17 +22057,10 @@ ${protocol}`;
22004
22057
  };
22005
22058
  const startWorking = (label = "Working on it") => {
22006
22059
  workingLabel = label.replace(/[.…]+\s*$/, "").trim() || "Working on it";
22007
- workingPreamble = stripToolBlocks(stripThinking(fullMessage)).trim();
22008
- if (workingTimer) return;
22009
- let dots = 0;
22010
- const render = () => {
22011
- dots = (dots + 1) % 4;
22012
- setStreamBuffer(
22013
- `${workingPreamble}${workingPreamble ? "\n\n" : ""}_${workingLabel}${".".repeat(dots)}_`
22014
- );
22015
- };
22016
- render();
22017
- workingTimer = setInterval(render, 450);
22060
+ const preamble = truncateAtToolApparatus(stripToolBlocks(stripThinking(fullMessage)));
22061
+ setStreamBuffer(
22062
+ `${preamble}${preamble ? "\n\n" : ""}<<working:${workingLabel}>>`
22063
+ );
22018
22064
  };
22019
22065
  const flushNow = () => {
22020
22066
  clearFlushTimer();
@@ -22060,10 +22106,16 @@ ${protocol}`;
22060
22106
  const inThinkBlock = /<think>/.test(fullMessage) && !/<think>[\s\S]*<\/think>/.test(fullMessage);
22061
22107
  setIsThinking?.(inThinkBlock);
22062
22108
  const visibleMessage = stripThinking(fullMessage);
22063
- if (/```(?:tool_code|TOOL_CODE)/.test(visibleMessage) || /\b(?:web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/.test(visibleMessage)) {
22109
+ const bareToolMatch = visibleMessage.match(
22110
+ /\b(web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
22111
+ );
22112
+ if (/```(?:tool_code|TOOL_CODE)/.test(visibleMessage) || bareToolMatch) {
22064
22113
  sawToolBlock = true;
22065
22114
  clearFlushTimer();
22066
- startWorking();
22115
+ const fn = bareToolMatch?.[1];
22116
+ startWorking(
22117
+ fn === "create_file" ? "Creating your file" : fn === "web_search" ? "Searching the web" : fn === "web_fetch" ? "Reading the page" : fn === "image_generation" ? "Generating the image" : "Working on it"
22118
+ );
22067
22119
  }
22068
22120
  latestDisplayMessage = visibleMessage;
22069
22121
  if (!sawToolBlock) {