@burtson-labs/bandit-engine 2.0.82 → 2.0.83

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.js CHANGED
@@ -15140,7 +15140,7 @@ ${listMarkdown}`;
15140
15140
  });
15141
15141
 
15142
15142
  // src/chat/source-chips.tsx
15143
- var import_react17, import_material10, import_jsx_runtime13, parseWebSources, domainOf, SourceChip, SourceChips, source_chips_default;
15143
+ var import_react17, import_material10, import_jsx_runtime13, parseWebSources, stripSourcesForDisplay, domainOf, SourceChip, SourceChips, source_chips_default;
15144
15144
  var init_source_chips = __esm({
15145
15145
  "src/chat/source-chips.tsx"() {
15146
15146
  "use strict";
@@ -15164,6 +15164,17 @@ var init_source_chips = __esm({
15164
15164
  const seen = /* @__PURE__ */ new Set();
15165
15165
  return out.filter((s) => seen.has(s.url) ? false : (seen.add(s.url), true));
15166
15166
  };
15167
+ stripSourcesForDisplay = (content) => {
15168
+ if (!content) return content;
15169
+ let c = content;
15170
+ const idx = c.lastIndexOf("**Sources**");
15171
+ if (idx !== -1) c = c.slice(0, idx);
15172
+ c = c.replace(
15173
+ /\n*(?:---|\*\*\*|___)[ \t]*\n[\s\S]*$/u,
15174
+ (m) => /[¹²³⁴⁵⁶⁷⁸⁹⁰]/u.test(m) && /\]\(https?:/i.test(m) ? "" : m
15175
+ );
15176
+ return c.replace(/\s+$/u, "");
15177
+ };
15167
15178
  domainOf = (url) => {
15168
15179
  try {
15169
15180
  return new URL(url).hostname.replace(/^www\./, "");
@@ -15361,7 +15372,7 @@ var init_chat_messages = __esm({
15361
15372
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
15362
15373
  StreamingMarkdown_default,
15363
15374
  {
15364
- content,
15375
+ content: isStreaming && isLast ? content : stripSourcesForDisplay(content),
15365
15376
  isStreaming: isStreaming && isLast,
15366
15377
  sources: sourceSummaries
15367
15378
  }
@@ -21603,7 +21614,7 @@ ${r.output}`).join("\n\n");
21603
21614
  ${toolResultsText}
21604
21615
  ===END TOOL RESULTS===
21605
21616
 
21606
- Use them to fully complete my original request. If you still need to take an action I asked for (for example, actually create a file I want to download), call the appropriate tool now with a \`\`\`tool_code\`\`\` block. Otherwise give your final answer. Do NOT add a "Sources"/"References"/"Citations" list \u2014 one is appended automatically.`
21617
+ Use them to fully complete my original request. If you still need to take an action I asked for (for example, actually create a file I want to download), call the appropriate tool now with a \`\`\`tool_code\`\`\` block. Otherwise give your final answer. Do NOT add citations, footnotes, superscript reference numbers (e.g. \xB9 \xB2 \xB3), or a Sources/References/Citations list \u2014 the sources are attached automatically below your answer. Just write the answer naturally.`
21607
21618
  }
21608
21619
  ];
21609
21620
  const streamTurn = (req) => new Promise((resolve) => {
@@ -21749,7 +21760,7 @@ That step failed: ${e instanceof Error ? e.message : String(e)}`);
21749
21760
  ${roundOut.join("\n\n")}
21750
21761
  ===END TOOL RESULTS===
21751
21762
 
21752
- Now give your final answer to my original request, or call another tool if you still genuinely need to. Do NOT add a "Sources" list.`
21763
+ Now give your final answer to my original request, or call another tool if you still genuinely need to. Do NOT add citations, footnotes, superscript reference numbers, or a Sources list \u2014 sources are attached automatically.`
21753
21764
  });
21754
21765
  }
21755
21766
  setIsThinking?.(false);