@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
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
chat_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EGIUL7QB.mjs";
|
|
4
4
|
import {
|
|
5
5
|
chat_provider_default
|
|
6
6
|
} from "./chunk-VTKRZNLI.mjs";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useGatewayHealth,
|
|
11
11
|
useGatewayMemory,
|
|
12
12
|
useGatewayModels
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WZOY2OBC.mjs";
|
|
14
14
|
import "./chunk-KYC7CC6C.mjs";
|
|
15
15
|
import "./chunk-HAUDGBUS.mjs";
|
|
16
16
|
import "./chunk-BN3D45E2.mjs";
|
|
@@ -23771,7 +23771,7 @@ TOOL USAGE PROTOCOL (conservative approach)
|
|
|
23771
23771
|
* 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
|
|
23772
23772
|
* 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)
|
|
23773
23773
|
* image_generation() - ONLY when explicitly asked to create or generate an image
|
|
23774
|
-
* 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.
|
|
23774
|
+
* 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.
|
|
23775
23775
|
* 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.
|
|
23776
23776
|
- For general questions about concepts, definitions, explanations, or how-to topics, use your built-in knowledge WITHOUT calling tools.
|
|
23777
23777
|
- Examples of what NOT to use tools for: "who are you?", "what is React?", "explain machine learning", "how does X work?", general programming questions.
|
|
@@ -23957,16 +23957,50 @@ ${fn}(${argStr})
|
|
|
23957
23957
|
\`\`\``;
|
|
23958
23958
|
}
|
|
23959
23959
|
}
|
|
23960
|
-
|
|
23961
|
-
const
|
|
23962
|
-
const
|
|
23963
|
-
|
|
23964
|
-
|
|
23965
|
-
|
|
23966
|
-
|
|
23960
|
+
const extractToolCalls = (message) => {
|
|
23961
|
+
const KNOWN = ["web_search", "web_fetch", "image_generation", "create_file", "ask_user", "ask-user"];
|
|
23962
|
+
const out = [];
|
|
23963
|
+
const nameRe = new RegExp(`\\b(${KNOWN.join("|")})\\s*\\(`, "g");
|
|
23964
|
+
let m;
|
|
23965
|
+
while ((m = nameRe.exec(message)) !== null) {
|
|
23966
|
+
const functionName = m[1];
|
|
23967
|
+
const openIdx = m.index + m[0].length - 1;
|
|
23968
|
+
let depth = 0;
|
|
23969
|
+
let i = openIdx;
|
|
23970
|
+
let inStr = false;
|
|
23971
|
+
let esc = false;
|
|
23972
|
+
for (; i < message.length; i++) {
|
|
23973
|
+
const ch = message[i];
|
|
23974
|
+
if (inStr) {
|
|
23975
|
+
if (esc) esc = false;
|
|
23976
|
+
else if (ch === "\\") esc = true;
|
|
23977
|
+
else if (ch === '"') inStr = false;
|
|
23978
|
+
} else if (ch === '"') inStr = true;
|
|
23979
|
+
else if (ch === "(") depth++;
|
|
23980
|
+
else if (ch === ")") {
|
|
23981
|
+
depth--;
|
|
23982
|
+
if (depth === 0) {
|
|
23983
|
+
i++;
|
|
23984
|
+
break;
|
|
23985
|
+
}
|
|
23986
|
+
}
|
|
23987
|
+
}
|
|
23988
|
+
if (depth !== 0) continue;
|
|
23989
|
+
const params = message.slice(openIdx + 1, i - 1).trim();
|
|
23990
|
+
let start = m.index;
|
|
23991
|
+
let end = i;
|
|
23992
|
+
const fenceOpen = message.slice(0, m.index).match(/```[a-zA-Z0-9_-]*[ \t]*\n[ \t]*$/);
|
|
23993
|
+
if (fenceOpen) {
|
|
23994
|
+
start = m.index - fenceOpen[0].length;
|
|
23995
|
+
const fenceClose = message.slice(i).match(/^[ \t]*\n```/);
|
|
23996
|
+
if (fenceClose) end = i + fenceClose[0].length;
|
|
23997
|
+
}
|
|
23998
|
+
out.push({ raw: message.slice(start, end), functionName, params });
|
|
23999
|
+
nameRe.lastIndex = i;
|
|
23967
24000
|
}
|
|
23968
|
-
|
|
23969
|
-
|
|
24001
|
+
return out;
|
|
24002
|
+
};
|
|
24003
|
+
const toolCallMatches = extractToolCalls(fullMessage);
|
|
23970
24004
|
let enhancedMessage = fullMessage;
|
|
23971
24005
|
const summarizableResults = [];
|
|
23972
24006
|
const inlineImageBlocks = [];
|
|
@@ -23974,13 +24008,10 @@ ${fm[1].trim()}
|
|
|
23974
24008
|
if (toolCallMatches && toolCallMatches.length > 0 && mcpToolsAvailable) {
|
|
23975
24009
|
debugLogger.info("Detected tool calls in AI response", {
|
|
23976
24010
|
toolCallCount: toolCallMatches.length,
|
|
23977
|
-
toolCalls: toolCallMatches
|
|
24011
|
+
toolCalls: toolCallMatches.map((t) => t.functionName)
|
|
23978
24012
|
});
|
|
23979
|
-
for (const
|
|
23980
|
-
const
|
|
23981
|
-
const functionCallMatch = toolCallCode.match(/^(\w+)\(\s*(.*?)\s*\)$/);
|
|
23982
|
-
if (!functionCallMatch) continue;
|
|
23983
|
-
const [, functionName, params] = functionCallMatch;
|
|
24013
|
+
for (const call of toolCallMatches) {
|
|
24014
|
+
const { raw: match, functionName, params } = call;
|
|
23984
24015
|
try {
|
|
23985
24016
|
let parsedParams = {};
|
|
23986
24017
|
const raw = params.trim();
|
|
@@ -34324,10 +34355,10 @@ var PersonalitiesTab = ({
|
|
|
34324
34355
|
display: "flex",
|
|
34325
34356
|
alignItems: "center",
|
|
34326
34357
|
justifyContent: "center",
|
|
34327
|
-
minWidth: { xs: "
|
|
34328
|
-
height: { xs: "
|
|
34358
|
+
minWidth: { xs: "36px", sm: "38px" },
|
|
34359
|
+
height: { xs: "36px", sm: "38px" },
|
|
34329
34360
|
boxShadow: "0 4px 12px rgba(25,118,210,0.25)"
|
|
34330
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RocketLaunchOutlinedIcon, { sx: { fontSize: { xs: "1.
|
|
34361
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RocketLaunchOutlinedIcon, { sx: { fontSize: { xs: "1.15rem", sm: "1.25rem" }, color: "common.white" } }) }),
|
|
34331
34362
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material19.Box, { sx: { textAlign: { xs: "left", md: "initial" }, flex: 1 }, children: [
|
|
34332
34363
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
34333
34364
|
import_material19.Typography,
|
|
@@ -34340,7 +34371,7 @@ var PersonalitiesTab = ({
|
|
|
34340
34371
|
WebkitBackgroundClip: "text",
|
|
34341
34372
|
WebkitTextFillColor: "transparent",
|
|
34342
34373
|
mb: { xs: 0.25, sm: 0.5 },
|
|
34343
|
-
fontSize: { xs: "1.
|
|
34374
|
+
fontSize: { xs: "1.2rem", sm: "1.35rem" }
|
|
34344
34375
|
},
|
|
34345
34376
|
children: "Quick Start Templates"
|
|
34346
34377
|
}
|
|
@@ -34371,7 +34402,7 @@ var PersonalitiesTab = ({
|
|
|
34371
34402
|
}
|
|
34372
34403
|
)
|
|
34373
34404
|
] }),
|
|
34374
|
-
isMobile
|
|
34405
|
+
isMobile && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
34375
34406
|
import_material19.Box,
|
|
34376
34407
|
{
|
|
34377
34408
|
sx: {
|
|
@@ -34398,32 +34429,12 @@ var PersonalitiesTab = ({
|
|
|
34398
34429
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material19.Collapse, { in: showTemplateHelp, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material19.Typography, { variant: "body2", sx: { color: "text.secondary", fontSize: "0.8rem", lineHeight: 1.4, mt: 0.75 }, children: "Choose a setup you like, then tweak name, tone, and prompt details in the Create/Edit tab." }) })
|
|
34399
34430
|
]
|
|
34400
34431
|
}
|
|
34401
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
34402
|
-
import_material19.Alert,
|
|
34403
|
-
{
|
|
34404
|
-
severity: "info",
|
|
34405
|
-
sx: {
|
|
34406
|
-
mb: { xs: 2.5, md: 4 },
|
|
34407
|
-
borderRadius: 2,
|
|
34408
|
-
border: "1px solid rgba(25, 118, 210, 0.2)",
|
|
34409
|
-
background: "linear-gradient(135deg, rgba(25, 118, 210, 0.05) 0%, rgba(66, 165, 245, 0.05) 100%)",
|
|
34410
|
-
px: { xs: 1.5, sm: 2 },
|
|
34411
|
-
py: { xs: 1.25, sm: 1.5 },
|
|
34412
|
-
"& .MuiAlert-icon": {
|
|
34413
|
-
color: "primary.main"
|
|
34414
|
-
}
|
|
34415
|
-
},
|
|
34416
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material19.Box, { sx: { display: "flex", flexDirection: "column", gap: 0.5 }, children: [
|
|
34417
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material19.Typography, { variant: "body2", sx: { fontWeight: 600, color: "primary.main", fontSize: { xs: "0.85rem", sm: "0.9rem" } }, children: "Choose a template to get started instantly" }),
|
|
34418
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material19.Typography, { variant: "body2", sx: { color: "text.secondary", fontSize: { xs: "0.85rem", sm: "0.9rem" }, lineHeight: 1.5 }, children: "Click any template to automatically fill the creation form with a proven personality setup. You can then customize it further to match your specific needs." })
|
|
34419
|
-
] })
|
|
34420
|
-
}
|
|
34421
34432
|
),
|
|
34422
34433
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
34423
34434
|
import_material19.Card,
|
|
34424
34435
|
{
|
|
34425
34436
|
sx: {
|
|
34426
|
-
mb: { xs:
|
|
34437
|
+
mb: { xs: 1.5, md: 2 },
|
|
34427
34438
|
background: "linear-gradient(135deg, #1976d2 0%, #42a5f5 100%)",
|
|
34428
34439
|
border: "2px solid transparent",
|
|
34429
34440
|
borderRadius: { xs: 2.25, sm: 3 },
|
|
@@ -34460,7 +34471,7 @@ var PersonalitiesTab = ({
|
|
|
34460
34471
|
setPersonalityTabIndex(1);
|
|
34461
34472
|
},
|
|
34462
34473
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material19.CardContent, { sx: {
|
|
34463
|
-
p: { xs: 1.
|
|
34474
|
+
p: { xs: 1.5, sm: 1.75 },
|
|
34464
34475
|
color: "white",
|
|
34465
34476
|
textAlign: "left",
|
|
34466
34477
|
position: "relative",
|
|
@@ -34477,7 +34488,7 @@ var PersonalitiesTab = ({
|
|
|
34477
34488
|
fontSize: 0,
|
|
34478
34489
|
mb: 0,
|
|
34479
34490
|
flexShrink: 0
|
|
34480
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoAwesomeIcon, { sx: { fontSize: { xs:
|
|
34491
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoAwesomeIcon, { sx: { fontSize: { xs: 24, sm: 28 }, color: "common.white", filter: "drop-shadow(0 4px 12px rgba(0,0,0,0.25))" } }) }),
|
|
34481
34492
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material19.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
34482
34493
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
34483
34494
|
import_material19.Typography,
|
|
@@ -34487,7 +34498,7 @@ var PersonalitiesTab = ({
|
|
|
34487
34498
|
fontWeight: 700,
|
|
34488
34499
|
mb: 0.25,
|
|
34489
34500
|
textShadow: "0 2px 4px rgba(0,0,0,0.2)",
|
|
34490
|
-
fontSize: { xs: "
|
|
34501
|
+
fontSize: { xs: "1rem", sm: "1.1rem" }
|
|
34491
34502
|
},
|
|
34492
34503
|
children: "Create from Scratch"
|
|
34493
34504
|
}
|
|
@@ -34551,7 +34562,7 @@ var PersonalitiesTab = ({
|
|
|
34551
34562
|
border: "1px solid",
|
|
34552
34563
|
borderColor: "rgba(255,255,255,0.1)",
|
|
34553
34564
|
borderRadius: 3,
|
|
34554
|
-
minHeight: { xs: "auto", md: "
|
|
34565
|
+
minHeight: { xs: "auto", md: "150px" },
|
|
34555
34566
|
display: "flex",
|
|
34556
34567
|
flexDirection: "column",
|
|
34557
34568
|
overflow: "hidden",
|
|
@@ -34592,7 +34603,7 @@ var PersonalitiesTab = ({
|
|
|
34592
34603
|
},
|
|
34593
34604
|
onClick: () => handleTemplateSelect(template),
|
|
34594
34605
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material19.CardContent, { sx: {
|
|
34595
|
-
p: { xs:
|
|
34606
|
+
p: { xs: 1.5, sm: 2 },
|
|
34596
34607
|
display: "flex",
|
|
34597
34608
|
flexDirection: "column",
|
|
34598
34609
|
height: "100%",
|
|
@@ -34602,8 +34613,8 @@ var PersonalitiesTab = ({
|
|
|
34602
34613
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material19.Box, { sx: {
|
|
34603
34614
|
display: "flex",
|
|
34604
34615
|
alignItems: "center",
|
|
34605
|
-
mb: { xs: 1
|
|
34606
|
-
minHeight: { xs: "auto", md: "
|
|
34616
|
+
mb: { xs: 1, md: 1.5 },
|
|
34617
|
+
minHeight: { xs: "auto", md: "auto" }
|
|
34607
34618
|
}, children: [
|
|
34608
34619
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
34609
34620
|
import_material19.Avatar,
|
|
@@ -34611,8 +34622,8 @@ var PersonalitiesTab = ({
|
|
|
34611
34622
|
src: template.avatar,
|
|
34612
34623
|
alt: template.name,
|
|
34613
34624
|
sx: {
|
|
34614
|
-
width: { xs: 40, sm:
|
|
34615
|
-
height: { xs: 40, sm:
|
|
34625
|
+
width: { xs: 40, sm: 48, md: 52 },
|
|
34626
|
+
height: { xs: 40, sm: 48, md: 52 },
|
|
34616
34627
|
mr: { xs: 1.2, md: 2 },
|
|
34617
34628
|
transition: "transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
34618
34629
|
boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
|
|
@@ -34667,11 +34678,11 @@ var PersonalitiesTab = ({
|
|
|
34667
34678
|
lineHeight: 1.5,
|
|
34668
34679
|
fontSize: { xs: "0.82rem", sm: "0.85rem", md: "0.875rem" },
|
|
34669
34680
|
display: "-webkit-box",
|
|
34670
|
-
WebkitLineClamp: { xs: 2, sm:
|
|
34681
|
+
WebkitLineClamp: { xs: 2, sm: 3 },
|
|
34671
34682
|
WebkitBoxOrient: "vertical",
|
|
34672
34683
|
overflow: "hidden",
|
|
34673
|
-
mb: { xs: 1
|
|
34674
|
-
minHeight: { xs: "auto", md: "
|
|
34684
|
+
mb: { xs: 1, md: 1.5 },
|
|
34685
|
+
minHeight: { xs: "auto", md: "auto" }
|
|
34675
34686
|
},
|
|
34676
34687
|
children: template.description
|
|
34677
34688
|
}
|
|
@@ -34706,18 +34717,7 @@ var PersonalitiesTab = ({
|
|
|
34706
34717
|
] })
|
|
34707
34718
|
},
|
|
34708
34719
|
index
|
|
34709
|
-
)) })
|
|
34710
|
-
!isMobile && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
34711
|
-
import_material19.Alert,
|
|
34712
|
-
{
|
|
34713
|
-
severity: "info",
|
|
34714
|
-
sx: { mt: { xs: 2.5, md: 4 }, borderRadius: 2, px: { xs: 1.5, sm: 2 }, py: { xs: 1.25, sm: 1.5 } },
|
|
34715
|
-
children: [
|
|
34716
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material19.Typography, { variant: "body2", sx: { fontWeight: 600, fontSize: { xs: "0.85rem", sm: "0.9rem" } }, children: "Pro Tip:" }),
|
|
34717
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material19.Typography, { variant: "body2", sx: { fontSize: { xs: "0.85rem", sm: "0.9rem" }, lineHeight: 1.5 }, children: "Click any template to automatically switch to the Create/Edit tab with the form pre-filled. Mix and match ideas to create your perfect AI personality!" })
|
|
34718
|
-
]
|
|
34719
|
-
}
|
|
34720
|
-
)
|
|
34720
|
+
)) })
|
|
34721
34721
|
] })
|
|
34722
34722
|
] });
|
|
34723
34723
|
const renderCreateEditTab = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material19.Box, { sx: { p: { xs: 1.5, sm: 2 } }, children: [
|