@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/{chat-XW4JIAOE.mjs → chat-2QWK6OUO.mjs} +3 -3
- package/dist/chat-provider.js +28 -1
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +2 -2
- package/dist/{chunk-PUUL2R3T.mjs → chunk-CMBYMC3G.mjs} +15 -3
- package/dist/chunk-CMBYMC3G.mjs.map +1 -0
- package/dist/{chunk-IDZEEONG.mjs → chunk-DHYP4K5O.mjs} +29 -2
- package/dist/chunk-DHYP4K5O.mjs.map +1 -0
- package/dist/{chunk-HHMGNCBS.mjs → chunk-SXLI47FV.mjs} +2 -2
- package/dist/{chunk-5SA7PQK4.mjs → chunk-VKDU2OMI.mjs} +3 -3
- package/dist/index.js +42 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/management/management.js +42 -3
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-IDZEEONG.mjs.map +0 -1
- package/dist/chunk-PUUL2R3T.mjs.map +0 -1
- /package/dist/{chat-XW4JIAOE.mjs.map → chat-2QWK6OUO.mjs.map} +0 -0
- /package/dist/{chunk-HHMGNCBS.mjs.map → chunk-SXLI47FV.mjs.map} +0 -0
- /package/dist/{chunk-5SA7PQK4.mjs.map → chunk-VKDU2OMI.mjs.map} +0 -0
|
@@ -94,7 +94,34 @@ var imageGenerationTool = {
|
|
|
94
94
|
method: "POST",
|
|
95
95
|
isBuiltIn: true
|
|
96
96
|
};
|
|
97
|
-
var
|
|
97
|
+
var createFileTool = {
|
|
98
|
+
id: "create-file",
|
|
99
|
+
name: "create_file",
|
|
100
|
+
description: "Create a downloadable file for the user (md, txt, csv, json, html, docx, pptx). Returns a temporary (~1 hour) download link.",
|
|
101
|
+
enabled: true,
|
|
102
|
+
type: "function",
|
|
103
|
+
function: {
|
|
104
|
+
name: "create_file",
|
|
105
|
+
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.",
|
|
106
|
+
parameters: {
|
|
107
|
+
type: "object",
|
|
108
|
+
properties: {
|
|
109
|
+
content: { type: "string", description: "The file content (Markdown for docx/pptx; raw text for others)." },
|
|
110
|
+
filename: { type: "string", description: "Desired filename, e.g. 'report.docx' or 'notes.md'." },
|
|
111
|
+
format: {
|
|
112
|
+
type: "string",
|
|
113
|
+
enum: ["md", "txt", "csv", "json", "html", "xml", "yaml", "docx", "pptx"],
|
|
114
|
+
description: "File format. Defaults to md."
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
required: ["content", "format"]
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
endpoint: "/mcp/create-file",
|
|
121
|
+
method: "POST",
|
|
122
|
+
isBuiltIn: true
|
|
123
|
+
};
|
|
124
|
+
var defaultTools = [healthCheckTool, webSearchTool, webFetchTool, imageGenerationTool, createFileTool];
|
|
98
125
|
var useMCPToolsStore = create((set, get) => ({
|
|
99
126
|
tools: defaultTools,
|
|
100
127
|
isLoaded: false,
|
|
@@ -181,4 +208,4 @@ var useMCPToolsStore = create((set, get) => ({
|
|
|
181
208
|
export {
|
|
182
209
|
useMCPToolsStore
|
|
183
210
|
};
|
|
184
|
-
//# sourceMappingURL=chunk-
|
|
211
|
+
//# sourceMappingURL=chunk-DHYP4K5O.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/store/mcpToolsStore.ts"],"sourcesContent":["/*\n © 2025 Burtson Labs — Licensed under Business Source License 1.1\n https://burtson.ai/license\n\n This file is protected intellectual property.\n Do NOT use in commercial software, prompts, AI training data, or derivative works without a valid commercial license.\n\n 🚫 AI NOTICE: This file contains visible and invisible watermarks.\n ⚖️ VIOLATION NOTICE: Removing, modifying, or obscuring these watermarks is a license violation.\n 🔒 LICENSE TERMINATION: Upon license termination, ALL forks, copies, and derivatives must be permanently deleted.\n 📋 AUDIT TRAIL: File usage is logged and monitored for compliance verification.\n*/\n\n// Bandit Engine Watermark: BL-WM-BF8A-82BFF7\nconst __banditFingerprint_store_mcpToolsStorets = 'BL-FP-414506-12AF';\nconst __auditTrail_store_mcpToolsStorets = 'BL-AU-MGOIKVW4-PIWV';\n// File: mcpToolsStore.ts | Path: src/store/mcpToolsStore.ts | Hash: bf8a12af\n\nimport { create } from \"zustand\";\nimport indexedDBService from \"../services/indexedDB/indexedDBService\";\nimport { debugLogger } from \"../services/logging/debugLogger\";\n\nexport interface MCPTool {\n id: string;\n name: string;\n description: string;\n enabled: boolean;\n type: \"function\";\n function: {\n name: string;\n description: string;\n parameters: {\n type: \"object\";\n properties: Record<string, unknown>;\n required: string[];\n };\n };\n endpoint?: string; // API endpoint for gateway calls\n method?: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\";\n isBuiltIn?: boolean;\n}\n\ninterface MCPToolsStore {\n tools: MCPTool[];\n isLoaded: boolean;\n addTool: (tool: Omit<MCPTool, \"id\">) => void;\n updateTool: (id: string, updates: Partial<MCPTool>) => void;\n deleteTool: (id: string) => void;\n toggleTool: (id: string) => void;\n loadTools: () => Promise<void>;\n saveTools: () => Promise<void>;\n getEnabledTools: () => MCPTool[];\n}\n\n// Built-in controller-backed tools\nconst healthCheckTool: MCPTool = {\n id: \"health-check\",\n name: \"check_gateway_health\",\n description: \"Check the health status of the gateway API service\",\n enabled: true,\n type: \"function\",\n function: {\n name: \"check_gateway_health\",\n description: \"Check the health status of the gateway API service\",\n parameters: {\n type: \"object\",\n properties: {},\n required: []\n }\n },\n endpoint: \"/mcp/health\",\n method: \"GET\",\n isBuiltIn: true\n};\n\nconst webSearchTool: MCPTool = {\n id: \"web-search\",\n name: \"web_search\",\n description: \"Search the web for current information, documentation, and facts\",\n enabled: true,\n type: \"function\",\n function: {\n name: \"web_search\",\n description: \"Search the web and return ranked results with snippets (and an optional summarized answer). Use for current events, documentation, libraries, error messages, and factual lookups.\",\n parameters: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"The search query — natural language or keywords\" },\n count: { type: \"number\", description: \"Number of results to return (1-10, default 5)\" },\n include_answer: { type: \"boolean\", description: \"Include a short summarized answer when available\" }\n },\n required: [\"query\"]\n }\n },\n endpoint: \"/mcp/web-search\",\n method: \"GET\",\n isBuiltIn: true\n};\n\nconst webFetchTool: MCPTool = {\n id: \"web-fetch\",\n name: \"web_fetch\",\n description: \"Fetch the text content of a specific URL\",\n enabled: true,\n type: \"function\",\n function: {\n name: \"web_fetch\",\n description: \"Fetch a single public URL and return its trimmed text content. Use when you already have a specific link you need to read.\",\n parameters: {\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"Absolute http(s) URL to fetch\" }\n },\n required: [\"url\"]\n }\n },\n endpoint: \"/mcp/web-fetch\",\n method: \"GET\",\n isBuiltIn: true\n};\n\n// New: Image Generation tool (OpenAI DALL·E 3)\nconst imageGenerationTool: MCPTool = {\n id: \"image-generation\",\n name: \"image_generation\",\n description: \"Generate high-quality images using DALL-E 3 from text prompts\",\n enabled: true,\n type: \"function\",\n function: {\n name: \"image_generation\",\n description: \"Generate high-quality images using DALL-E 3 from text prompts\",\n parameters: {\n type: \"object\",\n properties: {\n prompt: { type: \"string\", description: \"Text description of the image to generate\" },\n size: { type: \"string\", enum: [\"1024x1024\", \"1024x1792\", \"1792x1024\"], description: \"Image dimensions\" },\n quality: { type: \"string\", enum: [\"standard\", \"hd\"], description: \"Image quality\" },\n style: { type: \"string\", enum: [\"vivid\", \"natural\"], description: \"Style preference\" }\n },\n required: [\"prompt\"]\n }\n },\n endpoint: \"/mcp/generate-image\",\n method: \"POST\",\n isBuiltIn: true\n};\n\n// Create a downloadable file for the user (stored ~1 hour at a gateway URL).\nconst createFileTool: MCPTool = {\n id: \"create-file\",\n name: \"create_file\",\n description: \"Create a downloadable file for the user (md, txt, csv, json, html, docx, pptx). Returns a temporary (~1 hour) download link.\",\n enabled: true,\n type: \"function\",\n function: {\n name: \"create_file\",\n description:\n \"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 — tell the user it expires.\",\n parameters: {\n type: \"object\",\n properties: {\n content: { type: \"string\", description: \"The file content (Markdown for docx/pptx; raw text for others).\" },\n filename: { type: \"string\", description: \"Desired filename, e.g. 'report.docx' or 'notes.md'.\" },\n format: {\n type: \"string\",\n enum: [\"md\", \"txt\", \"csv\", \"json\", \"html\", \"xml\", \"yaml\", \"docx\", \"pptx\"],\n description: \"File format. Defaults to md.\",\n },\n },\n required: [\"content\", \"format\"],\n },\n },\n endpoint: \"/mcp/create-file\",\n method: \"POST\",\n isBuiltIn: true,\n};\n\nconst defaultTools: MCPTool[] = [healthCheckTool, webSearchTool, webFetchTool, imageGenerationTool, createFileTool];\n\nexport const useMCPToolsStore = create<MCPToolsStore>((set, get) => ({\n tools: defaultTools,\n isLoaded: false,\n \n addTool: (toolData) => {\n const newTool: MCPTool = {\n ...toolData,\n id: `tool-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n };\n set((state) => ({\n tools: [...state.tools, newTool],\n }));\n get().saveTools();\n },\n \n updateTool: (id, updates) => {\n set((state) => ({\n tools: state.tools.map((tool) =>\n tool.id === id ? { ...tool, ...updates } : tool\n ),\n }));\n get().saveTools();\n },\n \n deleteTool: (id) => {\n set((state) => ({\n tools: state.tools.filter((tool) => tool.id !== id || tool.isBuiltIn),\n }));\n get().saveTools();\n },\n \n toggleTool: (id) => {\n set((state) => ({\n tools: state.tools.map((tool) =>\n tool.id === id ? { ...tool, enabled: !tool.enabled } : tool\n ),\n }));\n get().saveTools();\n },\n \n getEnabledTools: () => {\n return get().tools.filter((tool) => tool.enabled);\n },\n \n loadTools: async () => {\n try {\n const storeConfigs = [{ name: \"config\", keyPath: \"id\" }];\n const data = await indexedDBService.get(\"banditConfig\", 1, \"config\", \"mcpTools\", storeConfigs);\n \n if (data?.tools && Array.isArray(data.tools)) {\n // Merge saved tools with built-in tools, ensuring built-ins always use default definition\n const savedTools = data.tools as MCPTool[];\n const builtInIds = defaultTools.map(t => t.id);\n const customTools = savedTools.filter(\n (tool) => !tool.isBuiltIn && !builtInIds.includes(tool.id)\n );\n\n set({\n tools: [...defaultTools, ...customTools],\n isLoaded: true\n });\n debugLogger.info(\"MCP tools loaded from IndexedDB\", { \n totalTools: defaultTools.length + customTools.length,\n builtInTools: defaultTools.length,\n customTools: customTools.length\n });\n } else {\n // First time, save defaults\n set({ isLoaded: true });\n await get().saveTools();\n debugLogger.info(\"Default MCP tools initialized\");\n }\n } catch (error) {\n debugLogger.error(\"Failed to load MCP tools from IndexedDB\", { error });\n set({ isLoaded: true }); // Mark as loaded even if failed, so UI can render\n }\n },\n \n saveTools: async () => {\n try {\n const { tools } = get();\n const storeConfigs = [{ name: \"config\", keyPath: \"id\" }];\n \n const customTools = tools.filter((tool) => !tool.isBuiltIn);\n\n await indexedDBService.put(\"banditConfig\", 1, \"config\", {\n id: \"mcpTools\",\n tools: customTools,\n }, storeConfigs);\n\n debugLogger.debug(\"MCP tools saved to IndexedDB\", { toolCount: customTools.length });\n } catch (error) {\n debugLogger.error(\"Failed to save MCP tools to IndexedDB\", { error });\n }\n },\n}));\n"],"mappings":";;;;;;;;AAkBA,SAAS,cAAc;AAqCvB,IAAM,kBAA2B;AAAA,EAC/B,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS;AAAA,EACT,MAAM;AAAA,EACN,UAAU;AAAA,IACR,MAAM;AAAA,IACN,aAAa;AAAA,IACb,YAAY;AAAA,MACV,MAAM;AAAA,MACN,YAAY,CAAC;AAAA,MACb,UAAU,CAAC;AAAA,IACb;AAAA,EACF;AAAA,EACA,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,WAAW;AACb;AAEA,IAAM,gBAAyB;AAAA,EAC7B,IAAI;AAAA,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AAW;AAAA,UACvC,UAAU;AAAA,QACZ,CAAC;AACD,oBAAY,KAAK,mCAAmC;AAAA,UAClD,YAAY,aAAa,SAAS,YAAY;AAAA,UAC9C,cAAc,aAAa;AAAA,UAC3B,aAAa,YAAY;AAAA,QAC3B,CAAC;AAAA,MACH,OAAO;AAEL,YAAI,EAAE,UAAU,KAAK,CAAC;AACtB,cAAM,IAAI,EAAE,UAAU;AACtB,oBAAY,KAAK,+BAA+B;AAAA,MAClD;AAAA,IACF,SAAS,OAAO;AACd,kBAAY,MAAM,2CAA2C,EAAE,MAAM,CAAC;AACtE,UAAI,EAAE,UAAU,KAAK,CAAC;AAAA,IACxB;AAAA,EACF;AAAA,EAEA,WAAW,YAAY;AACrB,QAAI;AACF,YAAM,EAAE,MAAM,IAAI,IAAI;AACtB,YAAM,eAAe,CAAC,EAAE,MAAM,UAAU,SAAS,KAAK,CAAC;AAEvD,YAAM,cAAc,MAAM,OAAO,CAAC,SAAS,CAAC,KAAK,SAAS;AAE1D,YAAM,yBAAiB,IAAI,gBAAgB,GAAG,UAAU;AAAA,QACtD,IAAI;AAAA,QACJ,OAAO;AAAA,MACT,GAAG,YAAY;AAEf,kBAAY,MAAM,gCAAgC,EAAE,WAAW,YAAY,OAAO,CAAC;AAAA,IACrF,SAAS,OAAO;AACd,kBAAY,MAAM,yCAAyC,EAAE,MAAM,CAAC;AAAA,IACtE;AAAA,EACF;AACF,EAAE;","names":[]}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-6ITUH375.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useMCPToolsStore
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DHYP4K5O.mjs";
|
|
10
10
|
import {
|
|
11
11
|
AUTH_TOKEN_CHANGED_EVENT,
|
|
12
12
|
FeatureFlagProvider,
|
|
@@ -188,4 +188,4 @@ export {
|
|
|
188
188
|
ChatProvider,
|
|
189
189
|
chat_provider_default
|
|
190
190
|
};
|
|
191
|
-
//# sourceMappingURL=chunk-
|
|
191
|
+
//# sourceMappingURL=chunk-SXLI47FV.mjs.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-6ITUH375.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useMCPToolsStore
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DHYP4K5O.mjs";
|
|
10
10
|
import {
|
|
11
11
|
chat_modal_default
|
|
12
12
|
} from "./chunk-JURUEF52.mjs";
|
|
@@ -9503,7 +9503,7 @@ var MCPToolsTabV2_default = MCPToolsTabV2;
|
|
|
9503
9503
|
|
|
9504
9504
|
// src/management/management.tsx
|
|
9505
9505
|
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
9506
|
-
var preloadChatPage = () => import("./chat-
|
|
9506
|
+
var preloadChatPage = () => import("./chat-2QWK6OUO.mjs");
|
|
9507
9507
|
var buildCapabilitiesUrl = (gatewayApiUrl) => {
|
|
9508
9508
|
const trimmed = gatewayApiUrl.replace(/\/$/, "");
|
|
9509
9509
|
if (trimmed.endsWith("/api")) {
|
|
@@ -10848,4 +10848,4 @@ export {
|
|
|
10848
10848
|
useGatewayMemory,
|
|
10849
10849
|
management_default
|
|
10850
10850
|
};
|
|
10851
|
-
//# sourceMappingURL=chunk-
|
|
10851
|
+
//# sourceMappingURL=chunk-VKDU2OMI.mjs.map
|
package/dist/index.js
CHANGED
|
@@ -3264,7 +3264,7 @@ var init_knowledgeStore = __esm({
|
|
|
3264
3264
|
});
|
|
3265
3265
|
|
|
3266
3266
|
// src/store/mcpToolsStore.ts
|
|
3267
|
-
var import_zustand11, healthCheckTool, webSearchTool, webFetchTool, imageGenerationTool, defaultTools, useMCPToolsStore;
|
|
3267
|
+
var import_zustand11, healthCheckTool, webSearchTool, webFetchTool, imageGenerationTool, createFileTool, defaultTools, useMCPToolsStore;
|
|
3268
3268
|
var init_mcpToolsStore = __esm({
|
|
3269
3269
|
"src/store/mcpToolsStore.ts"() {
|
|
3270
3270
|
"use strict";
|
|
@@ -3358,7 +3358,34 @@ var init_mcpToolsStore = __esm({
|
|
|
3358
3358
|
method: "POST",
|
|
3359
3359
|
isBuiltIn: true
|
|
3360
3360
|
};
|
|
3361
|
-
|
|
3361
|
+
createFileTool = {
|
|
3362
|
+
id: "create-file",
|
|
3363
|
+
name: "create_file",
|
|
3364
|
+
description: "Create a downloadable file for the user (md, txt, csv, json, html, docx, pptx). Returns a temporary (~1 hour) download link.",
|
|
3365
|
+
enabled: true,
|
|
3366
|
+
type: "function",
|
|
3367
|
+
function: {
|
|
3368
|
+
name: "create_file",
|
|
3369
|
+
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.",
|
|
3370
|
+
parameters: {
|
|
3371
|
+
type: "object",
|
|
3372
|
+
properties: {
|
|
3373
|
+
content: { type: "string", description: "The file content (Markdown for docx/pptx; raw text for others)." },
|
|
3374
|
+
filename: { type: "string", description: "Desired filename, e.g. 'report.docx' or 'notes.md'." },
|
|
3375
|
+
format: {
|
|
3376
|
+
type: "string",
|
|
3377
|
+
enum: ["md", "txt", "csv", "json", "html", "xml", "yaml", "docx", "pptx"],
|
|
3378
|
+
description: "File format. Defaults to md."
|
|
3379
|
+
}
|
|
3380
|
+
},
|
|
3381
|
+
required: ["content", "format"]
|
|
3382
|
+
}
|
|
3383
|
+
},
|
|
3384
|
+
endpoint: "/mcp/create-file",
|
|
3385
|
+
method: "POST",
|
|
3386
|
+
isBuiltIn: true
|
|
3387
|
+
};
|
|
3388
|
+
defaultTools = [healthCheckTool, webSearchTool, webFetchTool, imageGenerationTool, createFileTool];
|
|
3362
3389
|
useMCPToolsStore = (0, import_zustand11.create)((set, get) => ({
|
|
3363
3390
|
tools: defaultTools,
|
|
3364
3391
|
isLoaded: false,
|
|
@@ -20939,6 +20966,7 @@ TOOL USAGE PROTOCOL (conservative approach)
|
|
|
20939
20966
|
* 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
|
|
20940
20967
|
* 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)
|
|
20941
20968
|
* image_generation() - ONLY when explicitly asked to create or generate an image
|
|
20969
|
+
* 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.
|
|
20942
20970
|
* 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.
|
|
20943
20971
|
- For general questions about concepts, definitions, explanations, or how-to topics, use your built-in knowledge WITHOUT calling tools.
|
|
20944
20972
|
- Examples of what NOT to use tools for: "who are you?", "what is React?", "explain machine learning", "how does X work?", general programming questions.
|
|
@@ -21221,6 +21249,17 @@ _${toolStatus}_` : `_${toolStatus}_`);
|
|
|
21221
21249
|
|
|
21222
21250
|
${revisedPrompt ? `Prompt refinement: \u201C${revisedPrompt}\u201D
|
|
21223
21251
|
` : ""}Note: the image link may expire in ~2 hours.` : "Image generated successfully.";
|
|
21252
|
+
} else if (functionName === "create_file" || functionName === "create-file") {
|
|
21253
|
+
const fileData = result.data ?? {};
|
|
21254
|
+
if (fileData.url) {
|
|
21255
|
+
const mins = fileData.expiresInMinutes ?? 60;
|
|
21256
|
+
const name = fileData.filename || "your file";
|
|
21257
|
+
resultText = `\u{1F4C4} **[${name}](${fileData.url})** \u2014 ready to download.
|
|
21258
|
+
|
|
21259
|
+
_This link is temporary and expires in about ${mins} minutes._`;
|
|
21260
|
+
} else {
|
|
21261
|
+
resultText = "The file was created.";
|
|
21262
|
+
}
|
|
21224
21263
|
} else if (typeof result.data === "string") {
|
|
21225
21264
|
resultText = result.data;
|
|
21226
21265
|
} else if (result.data) {
|
|
@@ -21235,7 +21274,7 @@ ${revisedPrompt ? `Prompt refinement: \u201C${revisedPrompt}\u201D
|
|
|
21235
21274
|
}
|
|
21236
21275
|
enhancedMessage = enhancedMessage.replace(placeholderToken, resultText);
|
|
21237
21276
|
if (result.success) {
|
|
21238
|
-
if (functionName === "image_generation" || functionName === "image-generation") {
|
|
21277
|
+
if (functionName === "image_generation" || functionName === "image-generation" || functionName === "create_file" || functionName === "create-file") {
|
|
21239
21278
|
inlineImageBlocks.push(resultText);
|
|
21240
21279
|
} else if (functionName !== "check_gateway_health") {
|
|
21241
21280
|
summarizableResults.push({ name: functionName, output: resultText });
|