@burtson-labs/bandit-engine 2.0.65 → 2.0.66

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.
Files changed (40) hide show
  1. package/dist/chat-IWRBVOVP.mjs +16 -0
  2. package/dist/chat-provider.js +4 -0
  3. package/dist/chat-provider.js.map +1 -1
  4. package/dist/chat-provider.mjs +5 -5
  5. package/dist/{chunk-EUBVBTB3.mjs → chunk-4D7245ZO.mjs} +55 -30
  6. package/dist/chunk-4D7245ZO.mjs.map +1 -0
  7. package/dist/{chunk-FXFTA5PZ.mjs → chunk-6DY7W4NK.mjs} +3 -3
  8. package/dist/{chunk-VTC6AIWY.mjs → chunk-6ITUH375.mjs} +3 -3
  9. package/dist/{chunk-O44AP4XI.mjs → chunk-EM2DB6NP.mjs} +53 -9
  10. package/dist/chunk-EM2DB6NP.mjs.map +1 -0
  11. package/dist/{chunk-D55E6ZDV.mjs → chunk-HHMGNCBS.mjs} +5 -5
  12. package/dist/{chunk-6QTTNYF2.mjs → chunk-IDZEEONG.mjs} +2 -2
  13. package/dist/{chunk-HKQSZALO.mjs → chunk-JURUEF52.mjs} +4 -4
  14. package/dist/{chunk-IPMTNREZ.mjs → chunk-LWHSOEPR.mjs} +6 -2
  15. package/dist/{chunk-IPMTNREZ.mjs.map → chunk-LWHSOEPR.mjs.map} +1 -1
  16. package/dist/{chunk-O7M4OPZU.mjs → chunk-U633CJBV.mjs} +2 -2
  17. package/dist/{chunk-7EPFQDJW.mjs → chunk-ZYQJVZK2.mjs} +18 -11
  18. package/dist/{chunk-7EPFQDJW.mjs.map → chunk-ZYQJVZK2.mjs.map} +1 -1
  19. package/dist/index.js +115 -35
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +10 -10
  22. package/dist/management/management.js +114 -34
  23. package/dist/management/management.js.map +1 -1
  24. package/dist/management/management.mjs +8 -8
  25. package/dist/modals/chat-modal/chat-modal.js +4 -0
  26. package/dist/modals/chat-modal/chat-modal.js.map +1 -1
  27. package/dist/modals/chat-modal/chat-modal.mjs +4 -4
  28. package/dist/{modelStore-FBPBG7TI.mjs → modelStore-KCJPXFKO.mjs} +2 -2
  29. package/package.json +1 -1
  30. package/dist/chat-57M4OXFX.mjs +0 -16
  31. package/dist/chunk-EUBVBTB3.mjs.map +0 -1
  32. package/dist/chunk-O44AP4XI.mjs.map +0 -1
  33. /package/dist/{chat-57M4OXFX.mjs.map → chat-IWRBVOVP.mjs.map} +0 -0
  34. /package/dist/{chunk-FXFTA5PZ.mjs.map → chunk-6DY7W4NK.mjs.map} +0 -0
  35. /package/dist/{chunk-VTC6AIWY.mjs.map → chunk-6ITUH375.mjs.map} +0 -0
  36. /package/dist/{chunk-D55E6ZDV.mjs.map → chunk-HHMGNCBS.mjs.map} +0 -0
  37. /package/dist/{chunk-6QTTNYF2.mjs.map → chunk-IDZEEONG.mjs.map} +0 -0
  38. /package/dist/{chunk-HKQSZALO.mjs.map → chunk-JURUEF52.mjs.map} +0 -0
  39. /package/dist/{chunk-O7M4OPZU.mjs.map → chunk-U633CJBV.mjs.map} +0 -0
  40. /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-7EPFQDJW.mjs";
3
+ } from "./chunk-ZYQJVZK2.mjs";
4
4
  import {
5
5
  chat_provider_default
6
- } from "./chunk-D55E6ZDV.mjs";
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-O44AP4XI.mjs";
14
- import "./chunk-O7M4OPZU.mjs";
15
- import "./chunk-VTC6AIWY.mjs";
16
- import "./chunk-6QTTNYF2.mjs";
13
+ } from "./chunk-EM2DB6NP.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-HKQSZALO.mjs";
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-FXFTA5PZ.mjs";
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-EUBVBTB3.mjs";
60
+ } from "./chunk-4D7245ZO.mjs";
61
61
  import {
62
62
  usePackageSettingsStore
63
- } from "./chunk-IPMTNREZ.mjs";
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
- let prompt = `You are a helpful assistant.
3659
-
3660
- The following seed uniquely identifies the topic: "${seed}"`;
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
- prompt += `
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
- prompt += `
3667
-
3668
- Generate ${limit} concise (5\u201320 words, try to use this entire range), natural-sounding questions a user might ask${modelSystemPrompt ? " this specialized assistant" : " an AI assistant"}. These should be:
3669
-
3670
- - Relevant to ${topicOfInterest}`;
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
- prompt += `
3676
- - Specific enough to be practical
3677
- - Easy to understand and not abstract
3678
-
3679
- Do not:
3680
- - Refer to yourself or use phrases like "As an AI..."
3681
- - Include greetings, explanations, or personality
3682
- - Include jokes, fiction, or quotes
3683
- - Number, bullet, or otherwise prefix the questions with extra characters
3684
- - Repeat the same idea phrased differently \u2014 each question must explore a distinct angle or subtopic
3685
-
3686
- Output only ${limit} questions \u2014 one per line, with no leading numbers, bullets, or prefixes.`;
3687
- return prompt.trim();
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 });
@@ -27835,6 +27862,9 @@ var init_query_suggestion_picker = __esm({
27835
27862
  init_prompts();
27836
27863
  init_getStableQuestionPrompt();
27837
27864
  init_modelStore();
27865
+ init_preferencesStore();
27866
+ init_knowledgeStore();
27867
+ init_mcpToolsStore();
27838
27868
  import_jsx_runtime43 = require("react/jsx-runtime");
27839
27869
  markdownComponents = {
27840
27870
  p: ({ node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { ...props }),
@@ -27861,13 +27891,19 @@ var init_query_suggestion_picker = __esm({
27861
27891
  if (hasGenerated.current || isLoading) return;
27862
27892
  hasGenerated.current = true;
27863
27893
  const currentModel = getCurrentModel();
27894
+ const prefs = usePreferencesStore.getState().preferences;
27895
+ const interests = (prefs.interests ?? []).filter((i) => i && i.trim());
27896
+ const randomTopics = pickDistinctRandomTopics(interests.length ? 3 : 5);
27897
+ const topicOfInterest = Array.from(/* @__PURE__ */ new Set([...interests, ...randomTopics])).join(", ") || getRandomTopicOfInterest();
27898
+ const webSearchAvailable = useMCPToolsStore.getState().getEnabledTools().some((t) => t.name === "web_search");
27899
+ const knowledgeTopics = prefs.useKnowledgeForStarters ? useKnowledgeStore.getState().docs.map((d) => d.name).filter((n) => n && n.trim()).slice(0, 12) : void 0;
27864
27900
  const args = {
27865
- // keep responses quick and snappy, server may be handling concurrent requests adjust as needed
27866
27901
  limit: 9,
27867
- // pick a random topic of interest from the list, consider using the users preference topics dynamically, otherwise get a random one
27868
- topicOfInterest: getRandomTopicOfInterest(),
27869
- // Pass the current model's system prompt to tailor suggestions
27870
- modelSystemPrompt: currentModel?.systemPrompt
27902
+ topicOfInterest,
27903
+ modelSystemPrompt: currentModel?.systemPrompt,
27904
+ interests,
27905
+ knowledgeTopics,
27906
+ webSearchAvailable
27871
27907
  };
27872
27908
  generateConversationStarters(args).then((prompts) => {
27873
27909
  if (prompts.length > 0) {
@@ -34397,6 +34433,7 @@ var PersonalitiesTab_default = PersonalitiesTab;
34397
34433
  var import_react27 = require("react");
34398
34434
  var import_material20 = require("@mui/material");
34399
34435
  init_preferencesStore();
34436
+ init_getStableQuestionPrompt();
34400
34437
  init_modelStore();
34401
34438
  init_voiceStore();
34402
34439
  init_useFeatures();
@@ -34824,6 +34861,49 @@ var PreferencesTab = ({
34824
34861
  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
34862
  }
34826
34863
  ),
34864
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material20.Paper, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 } }, children: [
34865
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material20.Box, { children: [
34866
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material20.Typography, { variant: "h6", sx: { fontWeight: 600, color: "text.primary" }, children: "Conversation Starters" }),
34867
+ /* @__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." })
34868
+ ] }),
34869
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material20.Box, { sx: { mt: 2, display: "flex", flexWrap: "wrap", gap: 1 }, children: TOPICS.map((topic) => {
34870
+ const selected = (preferences.interests ?? []).includes(topic);
34871
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
34872
+ import_material20.Chip,
34873
+ {
34874
+ label: topic,
34875
+ size: "small",
34876
+ color: selected ? "primary" : "default",
34877
+ variant: selected ? "filled" : "outlined",
34878
+ onClick: () => {
34879
+ const current = preferences.interests ?? [];
34880
+ const next = selected ? current.filter((t) => t !== topic) : [...current, topic];
34881
+ updatePreference("interests", next);
34882
+ },
34883
+ sx: { textTransform: "capitalize" }
34884
+ },
34885
+ topic
34886
+ );
34887
+ }) }),
34888
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material20.Box, { sx: { mt: 2.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
34889
+ import_material20.FormControlLabel,
34890
+ {
34891
+ control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
34892
+ import_material20.Switch,
34893
+ {
34894
+ checked: !!preferences.useKnowledgeForStarters,
34895
+ onChange: (e) => updatePreference("useKnowledgeForStarters", e.target.checked),
34896
+ color: "primary"
34897
+ }
34898
+ ),
34899
+ label: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material20.Box, { textAlign: "left", children: [
34900
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material20.Typography, { variant: "body1", sx: { fontWeight: 600, color: "text.primary" }, children: "Use my knowledge documents" }),
34901
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material20.Typography, { variant: "body2", color: "text.secondary", children: "Let some starters reference the documents in your library." })
34902
+ ] }),
34903
+ sx: { alignSelf: "flex-start", ml: 0 }
34904
+ }
34905
+ ) })
34906
+ ] }),
34827
34907
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material20.Paper, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 } }, children: [
34828
34908
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material20.Box, { sx: { display: "flex", flexDirection: { xs: "column", sm: "row" }, justifyContent: "space-between", gap: 2 }, children: [
34829
34909
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material20.Box, { children: [