@burtson-labs/bandit-engine 2.0.70 → 2.0.71

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,19 +1,19 @@
1
1
  import {
2
2
  chat_default
3
- } from "./chunk-PUUL2R3T.mjs";
3
+ } from "./chunk-CMBYMC3G.mjs";
4
4
  import {
5
5
  chat_provider_default
6
- } from "./chunk-HHMGNCBS.mjs";
6
+ } from "./chunk-SXLI47FV.mjs";
7
7
  import "./chunk-ONQMRE2G.mjs";
8
8
  import {
9
9
  management_default,
10
10
  useGatewayHealth,
11
11
  useGatewayMemory,
12
12
  useGatewayModels
13
- } from "./chunk-5SA7PQK4.mjs";
13
+ } from "./chunk-VKDU2OMI.mjs";
14
14
  import "./chunk-U633CJBV.mjs";
15
15
  import "./chunk-6ITUH375.mjs";
16
- import "./chunk-IDZEEONG.mjs";
16
+ import "./chunk-DHYP4K5O.mjs";
17
17
  import {
18
18
  defineCustomElement
19
19
  } from "./chunk-IXIM7BNO.mjs";
@@ -19599,7 +19599,7 @@ ${listMarkdown}`;
19599
19599
  });
19600
19600
 
19601
19601
  // src/store/mcpToolsStore.ts
19602
- var import_zustand13, healthCheckTool, webSearchTool, webFetchTool, imageGenerationTool, defaultTools, useMCPToolsStore;
19602
+ var import_zustand13, healthCheckTool, webSearchTool, webFetchTool, imageGenerationTool, createFileTool, defaultTools, useMCPToolsStore;
19603
19603
  var init_mcpToolsStore = __esm({
19604
19604
  "src/store/mcpToolsStore.ts"() {
19605
19605
  "use strict";
@@ -19693,7 +19693,34 @@ var init_mcpToolsStore = __esm({
19693
19693
  method: "POST",
19694
19694
  isBuiltIn: true
19695
19695
  };
19696
- defaultTools = [healthCheckTool, webSearchTool, webFetchTool, imageGenerationTool];
19696
+ createFileTool = {
19697
+ id: "create-file",
19698
+ name: "create_file",
19699
+ description: "Create a downloadable file for the user (md, txt, csv, json, html, docx, pptx). Returns a temporary (~1 hour) download link.",
19700
+ enabled: true,
19701
+ type: "function",
19702
+ function: {
19703
+ name: "create_file",
19704
+ description: "Generate a file the user can download. For docx/pptx write well-structured Markdown (headings, lists, tables; use '## ' headings to start each slide). Returns a short-lived (~1 hour) download URL \u2014 tell the user it expires.",
19705
+ parameters: {
19706
+ type: "object",
19707
+ properties: {
19708
+ content: { type: "string", description: "The file content (Markdown for docx/pptx; raw text for others)." },
19709
+ filename: { type: "string", description: "Desired filename, e.g. 'report.docx' or 'notes.md'." },
19710
+ format: {
19711
+ type: "string",
19712
+ enum: ["md", "txt", "csv", "json", "html", "xml", "yaml", "docx", "pptx"],
19713
+ description: "File format. Defaults to md."
19714
+ }
19715
+ },
19716
+ required: ["content", "format"]
19717
+ }
19718
+ },
19719
+ endpoint: "/mcp/create-file",
19720
+ method: "POST",
19721
+ isBuiltIn: true
19722
+ };
19723
+ defaultTools = [healthCheckTool, webSearchTool, webFetchTool, imageGenerationTool, createFileTool];
19697
19724
  useMCPToolsStore = (0, import_zustand13.create)((set, get) => ({
19698
19725
  tools: defaultTools,
19699
19726
  isLoaded: false,
@@ -23178,6 +23205,7 @@ TOOL USAGE PROTOCOL (conservative approach)
23178
23205
  * web_search() - when asked about recent/current events, breaking news, live information (weather, prices, sports scores), or when you need to look up documentation, libraries, APIs, error messages, or verify a specific fact
23179
23206
  * web_fetch() - to read the FULL contents of a specific URL you already have. Reach for this when the user wants to "tell me more", "go deeper", "read/open that article", or asks for details about a specific source, link, or article from an EARLIER answer: take that item's URL from the previous Sources list in this conversation and fetch it, then answer from the page's actual content (not just the prior summary)
23180
23207
  * image_generation() - ONLY when explicitly asked to create or generate an image
23208
+ * create_file({"content": "...", "filename": "report.docx", "format": "docx"}) - when the user asks for a downloadable FILE (a document, spreadsheet, slides, markdown, code, etc.) or to "export"/"download"/"save" something. Formats: md, txt, csv, json, html, xml, yaml, docx, pptx. For docx/pptx write well-structured Markdown (use "## " headings to start each slide for pptx). It returns a temporary download link \u2014 ALWAYS tell the user the file expires (~1 hour). If it is unclear whether they want it shown inline vs. as a downloadable file, use ask_user first.
23181
23209
  * ask_user({"questions": [{"question": "...", "header": "Format", "options": [{"label": "Inline (Recommended)"}, {"label": "Download a file"}]}]}) - when you are genuinely BLOCKED on a decision that is the USER's to make and cannot resolve from the request, context, or sensible defaults (e.g. show content inline vs. let them download it, which format/option they want). Renders clickable options the user answers in one step \u2014 better than asking in prose and ending your turn. Give 1-4 questions, each with 2-4 options; if one is clearly best, list it first and append " (Recommended)". The user may also type their own answer; act on it directly.
23182
23210
  - For general questions about concepts, definitions, explanations, or how-to topics, use your built-in knowledge WITHOUT calling tools.
23183
23211
  - Examples of what NOT to use tools for: "who are you?", "what is React?", "explain machine learning", "how does X work?", general programming questions.
@@ -23460,6 +23488,17 @@ _${toolStatus}_` : `_${toolStatus}_`);
23460
23488
 
23461
23489
  ${revisedPrompt ? `Prompt refinement: \u201C${revisedPrompt}\u201D
23462
23490
  ` : ""}Note: the image link may expire in ~2 hours.` : "Image generated successfully.";
23491
+ } else if (functionName === "create_file" || functionName === "create-file") {
23492
+ const fileData = result.data ?? {};
23493
+ if (fileData.url) {
23494
+ const mins = fileData.expiresInMinutes ?? 60;
23495
+ const name = fileData.filename || "your file";
23496
+ resultText = `\u{1F4C4} **[${name}](${fileData.url})** \u2014 ready to download.
23497
+
23498
+ _This link is temporary and expires in about ${mins} minutes._`;
23499
+ } else {
23500
+ resultText = "The file was created.";
23501
+ }
23463
23502
  } else if (typeof result.data === "string") {
23464
23503
  resultText = result.data;
23465
23504
  } else if (result.data) {
@@ -23474,7 +23513,7 @@ ${revisedPrompt ? `Prompt refinement: \u201C${revisedPrompt}\u201D
23474
23513
  }
23475
23514
  enhancedMessage = enhancedMessage.replace(placeholderToken, resultText);
23476
23515
  if (result.success) {
23477
- if (functionName === "image_generation" || functionName === "image-generation") {
23516
+ if (functionName === "image_generation" || functionName === "image-generation" || functionName === "create_file" || functionName === "create-file") {
23478
23517
  inlineImageBlocks.push(resultText);
23479
23518
  } else if (functionName !== "check_gateway_health") {
23480
23519
  summarizableResults.push({ name: functionName, output: resultText });