@burtson-labs/bandit-engine 2.0.103 → 2.0.105
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-HCZEF3ZM.mjs → chat-TIX4XHMD.mjs} +2 -2
- package/dist/{chunk-GM5V2RJS.mjs → chunk-EGIUL7QB.mjs} +48 -17
- package/dist/chunk-EGIUL7QB.mjs.map +1 -0
- package/dist/{chunk-SWLZ7QJB.mjs → chunk-WZOY2OBC.mjs} +21 -52
- package/dist/chunk-WZOY2OBC.mjs.map +1 -0
- package/dist/index.js +66 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/management/management.js +66 -66
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-GM5V2RJS.mjs.map +0 -1
- package/dist/chunk-SWLZ7QJB.mjs.map +0 -1
- /package/dist/{chat-HCZEF3ZM.mjs.map → chat-TIX4XHMD.mjs.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
chat_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EGIUL7QB.mjs";
|
|
4
4
|
import "./chunk-ONQMRE2G.mjs";
|
|
5
5
|
import "./chunk-KYC7CC6C.mjs";
|
|
6
6
|
import "./chunk-BN3D45E2.mjs";
|
|
@@ -13,4 +13,4 @@ import "./chunk-BJTO5JO5.mjs";
|
|
|
13
13
|
export {
|
|
14
14
|
chat_default as default
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=chat-
|
|
16
|
+
//# sourceMappingURL=chat-TIX4XHMD.mjs.map
|
|
@@ -3652,7 +3652,7 @@ TOOL USAGE PROTOCOL (conservative approach)
|
|
|
3652
3652
|
* 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
|
|
3653
3653
|
* 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)
|
|
3654
3654
|
* image_generation() - ONLY when explicitly asked to create or generate an image
|
|
3655
|
-
* 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.
|
|
3655
|
+
* 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. PDF is NOT a supported format \u2014 if the user asks for a PDF, create a docx instead. 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.
|
|
3656
3656
|
* 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.
|
|
3657
3657
|
- For general questions about concepts, definitions, explanations, or how-to topics, use your built-in knowledge WITHOUT calling tools.
|
|
3658
3658
|
- Examples of what NOT to use tools for: "who are you?", "what is React?", "explain machine learning", "how does X work?", general programming questions.
|
|
@@ -3838,16 +3838,50 @@ ${fn}(${argStr})
|
|
|
3838
3838
|
\`\`\``;
|
|
3839
3839
|
}
|
|
3840
3840
|
}
|
|
3841
|
-
|
|
3842
|
-
const
|
|
3843
|
-
const
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3841
|
+
const extractToolCalls = (message) => {
|
|
3842
|
+
const KNOWN = ["web_search", "web_fetch", "image_generation", "create_file", "ask_user", "ask-user"];
|
|
3843
|
+
const out = [];
|
|
3844
|
+
const nameRe = new RegExp(`\\b(${KNOWN.join("|")})\\s*\\(`, "g");
|
|
3845
|
+
let m;
|
|
3846
|
+
while ((m = nameRe.exec(message)) !== null) {
|
|
3847
|
+
const functionName = m[1];
|
|
3848
|
+
const openIdx = m.index + m[0].length - 1;
|
|
3849
|
+
let depth = 0;
|
|
3850
|
+
let i = openIdx;
|
|
3851
|
+
let inStr = false;
|
|
3852
|
+
let esc = false;
|
|
3853
|
+
for (; i < message.length; i++) {
|
|
3854
|
+
const ch = message[i];
|
|
3855
|
+
if (inStr) {
|
|
3856
|
+
if (esc) esc = false;
|
|
3857
|
+
else if (ch === "\\") esc = true;
|
|
3858
|
+
else if (ch === '"') inStr = false;
|
|
3859
|
+
} else if (ch === '"') inStr = true;
|
|
3860
|
+
else if (ch === "(") depth++;
|
|
3861
|
+
else if (ch === ")") {
|
|
3862
|
+
depth--;
|
|
3863
|
+
if (depth === 0) {
|
|
3864
|
+
i++;
|
|
3865
|
+
break;
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
if (depth !== 0) continue;
|
|
3870
|
+
const params = message.slice(openIdx + 1, i - 1).trim();
|
|
3871
|
+
let start = m.index;
|
|
3872
|
+
let end = i;
|
|
3873
|
+
const fenceOpen = message.slice(0, m.index).match(/```[a-zA-Z0-9_-]*[ \t]*\n[ \t]*$/);
|
|
3874
|
+
if (fenceOpen) {
|
|
3875
|
+
start = m.index - fenceOpen[0].length;
|
|
3876
|
+
const fenceClose = message.slice(i).match(/^[ \t]*\n```/);
|
|
3877
|
+
if (fenceClose) end = i + fenceClose[0].length;
|
|
3878
|
+
}
|
|
3879
|
+
out.push({ raw: message.slice(start, end), functionName, params });
|
|
3880
|
+
nameRe.lastIndex = i;
|
|
3848
3881
|
}
|
|
3849
|
-
|
|
3850
|
-
|
|
3882
|
+
return out;
|
|
3883
|
+
};
|
|
3884
|
+
const toolCallMatches = extractToolCalls(fullMessage);
|
|
3851
3885
|
let enhancedMessage = fullMessage;
|
|
3852
3886
|
const summarizableResults = [];
|
|
3853
3887
|
const inlineImageBlocks = [];
|
|
@@ -3855,13 +3889,10 @@ ${fm[1].trim()}
|
|
|
3855
3889
|
if (toolCallMatches && toolCallMatches.length > 0 && mcpToolsAvailable) {
|
|
3856
3890
|
debugLogger.info("Detected tool calls in AI response", {
|
|
3857
3891
|
toolCallCount: toolCallMatches.length,
|
|
3858
|
-
toolCalls: toolCallMatches
|
|
3892
|
+
toolCalls: toolCallMatches.map((t) => t.functionName)
|
|
3859
3893
|
});
|
|
3860
|
-
for (const
|
|
3861
|
-
const
|
|
3862
|
-
const functionCallMatch = toolCallCode.match(/^(\w+)\(\s*(.*?)\s*\)$/);
|
|
3863
|
-
if (!functionCallMatch) continue;
|
|
3864
|
-
const [, functionName, params] = functionCallMatch;
|
|
3894
|
+
for (const call of toolCallMatches) {
|
|
3895
|
+
const { raw: match, functionName, params } = call;
|
|
3865
3896
|
try {
|
|
3866
3897
|
let parsedParams = {};
|
|
3867
3898
|
const raw = params.trim();
|
|
@@ -10694,4 +10725,4 @@ var chat_default = Chat;
|
|
|
10694
10725
|
export {
|
|
10695
10726
|
chat_default
|
|
10696
10727
|
};
|
|
10697
|
-
//# sourceMappingURL=chunk-
|
|
10728
|
+
//# sourceMappingURL=chunk-EGIUL7QB.mjs.map
|