@burtson-labs/bandit-engine 2.0.65 → 2.0.67
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-5XCDDPTK.mjs +16 -0
- package/dist/chat-provider.js +4 -0
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +5 -5
- package/dist/{chunk-EUBVBTB3.mjs → chunk-4D7245ZO.mjs} +55 -30
- package/dist/chunk-4D7245ZO.mjs.map +1 -0
- package/dist/{chunk-7EPFQDJW.mjs → chunk-5UD7EJ23.mjs} +24 -13
- package/dist/chunk-5UD7EJ23.mjs.map +1 -0
- package/dist/{chunk-FXFTA5PZ.mjs → chunk-6DY7W4NK.mjs} +3 -3
- package/dist/{chunk-VTC6AIWY.mjs → chunk-6ITUH375.mjs} +3 -3
- package/dist/{chunk-D55E6ZDV.mjs → chunk-HHMGNCBS.mjs} +5 -5
- package/dist/{chunk-6QTTNYF2.mjs → chunk-IDZEEONG.mjs} +2 -2
- package/dist/{chunk-HKQSZALO.mjs → chunk-JURUEF52.mjs} +4 -4
- package/dist/{chunk-IPMTNREZ.mjs → chunk-LWHSOEPR.mjs} +6 -2
- package/dist/{chunk-IPMTNREZ.mjs.map → chunk-LWHSOEPR.mjs.map} +1 -1
- package/dist/{chunk-O44AP4XI.mjs → chunk-RI4LBQ3Q.mjs} +53 -9
- package/dist/chunk-RI4LBQ3Q.mjs.map +1 -0
- package/dist/{chunk-O7M4OPZU.mjs → chunk-U633CJBV.mjs} +2 -2
- package/dist/index.js +121 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/management/management.js +120 -36
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +8 -8
- package/dist/modals/chat-modal/chat-modal.js +4 -0
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +4 -4
- package/dist/{modelStore-FBPBG7TI.mjs → modelStore-KCJPXFKO.mjs} +2 -2
- package/package.json +1 -1
- package/dist/chat-57M4OXFX.mjs +0 -16
- package/dist/chunk-7EPFQDJW.mjs.map +0 -1
- package/dist/chunk-EUBVBTB3.mjs.map +0 -1
- package/dist/chunk-O44AP4XI.mjs.map +0 -1
- /package/dist/{chat-57M4OXFX.mjs.map → chat-5XCDDPTK.mjs.map} +0 -0
- /package/dist/{chunk-FXFTA5PZ.mjs.map → chunk-6DY7W4NK.mjs.map} +0 -0
- /package/dist/{chunk-VTC6AIWY.mjs.map → chunk-6ITUH375.mjs.map} +0 -0
- /package/dist/{chunk-D55E6ZDV.mjs.map → chunk-HHMGNCBS.mjs.map} +0 -0
- /package/dist/{chunk-6QTTNYF2.mjs.map → chunk-IDZEEONG.mjs.map} +0 -0
- /package/dist/{chunk-HKQSZALO.mjs.map → chunk-JURUEF52.mjs.map} +0 -0
- /package/dist/{chunk-O7M4OPZU.mjs.map → chunk-U633CJBV.mjs.map} +0 -0
- /package/dist/{modelStore-FBPBG7TI.mjs.map → modelStore-KCJPXFKO.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
chat_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5UD7EJ23.mjs";
|
|
4
4
|
import {
|
|
5
5
|
chat_provider_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HHMGNCBS.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-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-RI4LBQ3Q.mjs";
|
|
14
|
+
import "./chunk-U633CJBV.mjs";
|
|
15
|
+
import "./chunk-6ITUH375.mjs";
|
|
16
|
+
import "./chunk-IDZEEONG.mjs";
|
|
17
17
|
import {
|
|
18
18
|
defineCustomElement
|
|
19
19
|
} from "./chunk-IXIM7BNO.mjs";
|
|
20
20
|
import {
|
|
21
21
|
chat_modal_default
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JURUEF52.mjs";
|
|
23
23
|
import {
|
|
24
24
|
FeedbackButton,
|
|
25
25
|
FeedbackModal,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
useTTS,
|
|
38
38
|
useVoiceStore,
|
|
39
39
|
voiceService
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-6DY7W4NK.mjs";
|
|
41
41
|
import {
|
|
42
42
|
DEFAULT_TIER_FEATURES,
|
|
43
43
|
FeatureFlagContext,
|
|
@@ -57,10 +57,10 @@ import {
|
|
|
57
57
|
useVectorStore,
|
|
58
58
|
vectorDatabaseService,
|
|
59
59
|
vectorMigrationService
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-4D7245ZO.mjs";
|
|
61
61
|
import {
|
|
62
62
|
usePackageSettingsStore
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-LWHSOEPR.mjs";
|
|
64
64
|
import "./chunk-H3BYFEIE.mjs";
|
|
65
65
|
import {
|
|
66
66
|
DebugLogger,
|
|
@@ -3636,7 +3636,7 @@ var init_util = __esm({
|
|
|
3636
3636
|
});
|
|
3637
3637
|
|
|
3638
3638
|
// src/prompts/getStableQuestionPrompt.ts
|
|
3639
|
-
var TOPICS, getRandomTopicOfInterest, getStableQuestionPrompt;
|
|
3639
|
+
var TOPICS, getRandomTopicOfInterest, pickDistinctRandomTopics, getStableQuestionPrompt;
|
|
3640
3640
|
var init_getStableQuestionPrompt = __esm({
|
|
3641
3641
|
"src/prompts/getStableQuestionPrompt.ts"() {
|
|
3642
3642
|
"use strict";
|
|
@@ -3649,42 +3649,65 @@ var init_getStableQuestionPrompt = __esm({
|
|
|
3649
3649
|
const randomTopic = TOPICS[randomIndex];
|
|
3650
3650
|
return randomTopic;
|
|
3651
3651
|
};
|
|
3652
|
+
pickDistinctRandomTopics = (count) => {
|
|
3653
|
+
const pool = [...TOPICS];
|
|
3654
|
+
const picked = [];
|
|
3655
|
+
const n = Math.min(Math.max(count, 0), pool.length);
|
|
3656
|
+
for (let i = 0; i < n; i++) {
|
|
3657
|
+
const idx = randomRange(0, pool.length - 1);
|
|
3658
|
+
picked.push(pool[idx]);
|
|
3659
|
+
pool.splice(idx, 1);
|
|
3660
|
+
}
|
|
3661
|
+
return picked;
|
|
3662
|
+
};
|
|
3652
3663
|
getStableQuestionPrompt = (args) => {
|
|
3653
|
-
const { limit, topicOfInterest, modelSystemPrompt } = args;
|
|
3664
|
+
const { limit, topicOfInterest, modelSystemPrompt, interests, knowledgeTopics, webSearchAvailable } = args;
|
|
3654
3665
|
if (limit < 1 || limit > 10) {
|
|
3655
3666
|
throw new Error("Limit must be between 1 and 10");
|
|
3656
3667
|
}
|
|
3657
3668
|
const seed = generateSeed();
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3669
|
+
const lines = [
|
|
3670
|
+
`You are crafting fresh, engaging conversation starters for a chat app's home screen.`,
|
|
3671
|
+
``,
|
|
3672
|
+
`Variation seed (make this set different from any previous set): "${seed}"`
|
|
3673
|
+
];
|
|
3661
3674
|
if (modelSystemPrompt && modelSystemPrompt.trim()) {
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
Based on this specialized assistant profile: "${modelSystemPrompt.trim()}"`;
|
|
3675
|
+
lines.push(``, `Tailor the questions to this assistant's role and expertise: "${modelSystemPrompt.trim()}"`);
|
|
3665
3676
|
}
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
if (modelSystemPrompt && modelSystemPrompt.trim()) {
|
|
3672
|
-
prompt += `
|
|
3673
|
-
- Aligned with the assistant's specialized capabilities and knowledge area`;
|
|
3677
|
+
if (interests && interests.length) {
|
|
3678
|
+
lines.push(
|
|
3679
|
+
``,
|
|
3680
|
+
`The user is especially interested in: ${interests.join(", ")}. Lean toward these, but do NOT make every question about the same one.`
|
|
3681
|
+
);
|
|
3674
3682
|
}
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3683
|
+
if (knowledgeTopics && knowledgeTopics.length) {
|
|
3684
|
+
lines.push(
|
|
3685
|
+
``,
|
|
3686
|
+
`The user keeps these documents in their library: ${knowledgeTopics.join("; ")}. Include one or two questions that draw on this material.`
|
|
3687
|
+
);
|
|
3688
|
+
}
|
|
3689
|
+
lines.push(
|
|
3690
|
+
``,
|
|
3691
|
+
`Spread the set across a VARIETY of these topics so it never feels repetitive (do not cluster on one): ${topicOfInterest}.`
|
|
3692
|
+
);
|
|
3693
|
+
if (webSearchAvailable) {
|
|
3694
|
+
lines.push(
|
|
3695
|
+
``,
|
|
3696
|
+
`This assistant can search the web for live information. Include 2\u20133 questions that invite current, up-to-date answers (latest news, recent developments, "today" / "this week") so the user discovers that capability.`
|
|
3697
|
+
);
|
|
3698
|
+
}
|
|
3699
|
+
lines.push(
|
|
3700
|
+
``,
|
|
3701
|
+
`Generate ${limit} concise (5\u201320 words), natural-sounding questions a user might ask${modelSystemPrompt ? " this specialized assistant" : " an AI assistant"}. Requirements:`,
|
|
3702
|
+
`- Each question must explore a DISTINCT topic or angle \u2014 no two may be similar or rephrasings of each other.`,
|
|
3703
|
+
`- Vary the type across the set: practical how-to, curious exploration, current/topical, creative, and learning.`,
|
|
3704
|
+
`- Specific and concrete, easy to understand, not abstract.`,
|
|
3705
|
+
``,
|
|
3706
|
+
`Do not refer to yourself, say "As an AI", add greetings, explanations, jokes, fiction, quotes, or number/bullet the lines.`,
|
|
3707
|
+
``,
|
|
3708
|
+
`Output only ${limit} questions \u2014 one per line, with no leading numbers, bullets, or prefixes.`
|
|
3709
|
+
);
|
|
3710
|
+
return lines.join("\n").trim();
|
|
3688
3711
|
};
|
|
3689
3712
|
}
|
|
3690
3713
|
});
|
|
@@ -6671,6 +6694,8 @@ var init_preferencesStore = __esm({
|
|
|
6671
6694
|
sttEnabled: true,
|
|
6672
6695
|
banditModelsEnabled: true,
|
|
6673
6696
|
feedbackEnabled: true,
|
|
6697
|
+
interests: [],
|
|
6698
|
+
useKnowledgeForStarters: false,
|
|
6674
6699
|
homeUrl: ""
|
|
6675
6700
|
};
|
|
6676
6701
|
sanitizePreferences = (preferences) => {
|
|
@@ -6768,6 +6793,8 @@ var init_preferencesStore = __esm({
|
|
|
6768
6793
|
sttEnabled: typeof mergedPreferences.sttEnabled === "boolean" ? mergedPreferences.sttEnabled : defaultPreferences.sttEnabled,
|
|
6769
6794
|
banditModelsEnabled: typeof mergedPreferences.banditModelsEnabled === "boolean" ? mergedPreferences.banditModelsEnabled : defaultPreferences.banditModelsEnabled,
|
|
6770
6795
|
feedbackEnabled: typeof mergedPreferences.feedbackEnabled === "boolean" ? mergedPreferences.feedbackEnabled : defaultPreferences.feedbackEnabled,
|
|
6796
|
+
interests: Array.isArray(mergedPreferences.interests) ? mergedPreferences.interests.filter((i) => typeof i === "string") : defaultPreferences.interests,
|
|
6797
|
+
useKnowledgeForStarters: typeof mergedPreferences.useKnowledgeForStarters === "boolean" ? mergedPreferences.useKnowledgeForStarters : defaultPreferences.useKnowledgeForStarters,
|
|
6771
6798
|
homeUrl: typeof mergedPreferences.homeUrl === "string" ? mergedPreferences.homeUrl : defaultPreferences.homeUrl
|
|
6772
6799
|
};
|
|
6773
6800
|
set({ preferences: validatedPreferences });
|
|
@@ -23288,7 +23315,7 @@ ${r.output}`).join("\n\n");
|
|
|
23288
23315
|
|
|
23289
23316
|
${toolResultsText}
|
|
23290
23317
|
|
|
23291
|
-
Using these results together with your own knowledge, answer my original question concisely and in a natural, well-formatted way.
|
|
23318
|
+
Using these results together with your own knowledge, answer my original question concisely and in a natural, well-formatted way. Do NOT add a "Sources", "References", or "Citations" list of any kind \u2014 not names and not URLs. A clean, clickable Sources section is appended automatically below your answer, so any list you add just duplicates it. (Mentioning a source naturally inside a sentence is fine; a trailing list is not.) Do NOT output tool_code or call any tools again.`
|
|
23292
23319
|
}
|
|
23293
23320
|
];
|
|
23294
23321
|
const summaryRequest = {
|
|
@@ -23343,6 +23370,10 @@ _Writing the answer\u2026_` : "_Writing the answer\u2026_"
|
|
|
23343
23370
|
}, 3e4);
|
|
23344
23371
|
});
|
|
23345
23372
|
if (summaryText.trim()) {
|
|
23373
|
+
const cleanedSummary = summaryText.replace(
|
|
23374
|
+
/\n{1,}\s*(?:[*_#>\s]*)(?:sources?|references?|citations?|further reading)(?:\s*:)?\s*(?:[*_]*)\s*\n[\s\S]*$/i,
|
|
23375
|
+
""
|
|
23376
|
+
).trimEnd();
|
|
23346
23377
|
const sourcesMd = collectedSources.length ? `
|
|
23347
23378
|
|
|
23348
23379
|
**Sources**
|
|
@@ -23354,7 +23385,7 @@ ${collectedSources.slice(0, 6).map((s) => {
|
|
|
23354
23385
|
}
|
|
23355
23386
|
return `- [${s.title || domain}](${s.url}) \u2014 ${domain}`;
|
|
23356
23387
|
}).join("\n")}` : "";
|
|
23357
|
-
enhancedMessage =
|
|
23388
|
+
enhancedMessage = cleanedSummary + sourcesMd + (inlineImageBlocks.length ? `
|
|
23358
23389
|
|
|
23359
23390
|
${inlineImageBlocks.join("\n\n")}` : "");
|
|
23360
23391
|
}
|
|
@@ -27835,6 +27866,9 @@ var init_query_suggestion_picker = __esm({
|
|
|
27835
27866
|
init_prompts();
|
|
27836
27867
|
init_getStableQuestionPrompt();
|
|
27837
27868
|
init_modelStore();
|
|
27869
|
+
init_preferencesStore();
|
|
27870
|
+
init_knowledgeStore();
|
|
27871
|
+
init_mcpToolsStore();
|
|
27838
27872
|
import_jsx_runtime43 = require("react/jsx-runtime");
|
|
27839
27873
|
markdownComponents = {
|
|
27840
27874
|
p: ({ node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { ...props }),
|
|
@@ -27861,13 +27895,19 @@ var init_query_suggestion_picker = __esm({
|
|
|
27861
27895
|
if (hasGenerated.current || isLoading) return;
|
|
27862
27896
|
hasGenerated.current = true;
|
|
27863
27897
|
const currentModel = getCurrentModel();
|
|
27898
|
+
const prefs = usePreferencesStore.getState().preferences;
|
|
27899
|
+
const interests = (prefs.interests ?? []).filter((i) => i && i.trim());
|
|
27900
|
+
const randomTopics = pickDistinctRandomTopics(interests.length ? 3 : 5);
|
|
27901
|
+
const topicOfInterest = Array.from(/* @__PURE__ */ new Set([...interests, ...randomTopics])).join(", ") || getRandomTopicOfInterest();
|
|
27902
|
+
const webSearchAvailable = useMCPToolsStore.getState().getEnabledTools().some((t) => t.name === "web_search");
|
|
27903
|
+
const knowledgeTopics = prefs.useKnowledgeForStarters ? useKnowledgeStore.getState().docs.map((d) => d.name).filter((n) => n && n.trim()).slice(0, 12) : void 0;
|
|
27864
27904
|
const args = {
|
|
27865
|
-
// keep responses quick and snappy, server may be handling concurrent requests adjust as needed
|
|
27866
27905
|
limit: 9,
|
|
27867
|
-
|
|
27868
|
-
|
|
27869
|
-
|
|
27870
|
-
|
|
27906
|
+
topicOfInterest,
|
|
27907
|
+
modelSystemPrompt: currentModel?.systemPrompt,
|
|
27908
|
+
interests,
|
|
27909
|
+
knowledgeTopics,
|
|
27910
|
+
webSearchAvailable
|
|
27871
27911
|
};
|
|
27872
27912
|
generateConversationStarters(args).then((prompts) => {
|
|
27873
27913
|
if (prompts.length > 0) {
|
|
@@ -34397,6 +34437,7 @@ var PersonalitiesTab_default = PersonalitiesTab;
|
|
|
34397
34437
|
var import_react27 = require("react");
|
|
34398
34438
|
var import_material20 = require("@mui/material");
|
|
34399
34439
|
init_preferencesStore();
|
|
34440
|
+
init_getStableQuestionPrompt();
|
|
34400
34441
|
init_modelStore();
|
|
34401
34442
|
init_voiceStore();
|
|
34402
34443
|
init_useFeatures();
|
|
@@ -34824,6 +34865,49 @@ var PreferencesTab = ({
|
|
|
34824
34865
|
children: "Control which AI features are enabled to optimize performance for your device. Disabling features can help reduce resource usage on machines with limited capabilities."
|
|
34825
34866
|
}
|
|
34826
34867
|
),
|
|
34868
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material20.Paper, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 } }, children: [
|
|
34869
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material20.Box, { children: [
|
|
34870
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material20.Typography, { variant: "h6", sx: { fontWeight: 600, color: "text.primary" }, children: "Conversation Starters" }),
|
|
34871
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material20.Typography, { variant: "body2", color: "text.secondary", children: "Personalize the suggested prompts on your home screen. Pick the topics you care about \u2014 starters lean toward them (blended with fresh ones each time) instead of generic blanket questions." })
|
|
34872
|
+
] }),
|
|
34873
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material20.Box, { sx: { mt: 2, display: "flex", flexWrap: "wrap", gap: 1 }, children: TOPICS.map((topic) => {
|
|
34874
|
+
const selected = (preferences.interests ?? []).includes(topic);
|
|
34875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
34876
|
+
import_material20.Chip,
|
|
34877
|
+
{
|
|
34878
|
+
label: topic,
|
|
34879
|
+
size: "small",
|
|
34880
|
+
color: selected ? "primary" : "default",
|
|
34881
|
+
variant: selected ? "filled" : "outlined",
|
|
34882
|
+
onClick: () => {
|
|
34883
|
+
const current = preferences.interests ?? [];
|
|
34884
|
+
const next = selected ? current.filter((t) => t !== topic) : [...current, topic];
|
|
34885
|
+
updatePreference("interests", next);
|
|
34886
|
+
},
|
|
34887
|
+
sx: { textTransform: "capitalize" }
|
|
34888
|
+
},
|
|
34889
|
+
topic
|
|
34890
|
+
);
|
|
34891
|
+
}) }),
|
|
34892
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material20.Box, { sx: { mt: 2.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
34893
|
+
import_material20.FormControlLabel,
|
|
34894
|
+
{
|
|
34895
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
34896
|
+
import_material20.Switch,
|
|
34897
|
+
{
|
|
34898
|
+
checked: !!preferences.useKnowledgeForStarters,
|
|
34899
|
+
onChange: (e) => updatePreference("useKnowledgeForStarters", e.target.checked),
|
|
34900
|
+
color: "primary"
|
|
34901
|
+
}
|
|
34902
|
+
),
|
|
34903
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material20.Box, { textAlign: "left", children: [
|
|
34904
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material20.Typography, { variant: "body1", sx: { fontWeight: 600, color: "text.primary" }, children: "Use my knowledge documents" }),
|
|
34905
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material20.Typography, { variant: "body2", color: "text.secondary", children: "Let some starters reference the documents in your library." })
|
|
34906
|
+
] }),
|
|
34907
|
+
sx: { alignSelf: "flex-start", ml: 0 }
|
|
34908
|
+
}
|
|
34909
|
+
) })
|
|
34910
|
+
] }),
|
|
34827
34911
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material20.Paper, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 } }, children: [
|
|
34828
34912
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material20.Box, { sx: { display: "flex", flexDirection: { xs: "column", sm: "row" }, justifyContent: "space-between", gap: 2 }, children: [
|
|
34829
34913
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material20.Box, { children: [
|