@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.js CHANGED
@@ -710,6 +710,8 @@ var init_preferencesStore = __esm({
710
710
  sttEnabled: true,
711
711
  banditModelsEnabled: true,
712
712
  feedbackEnabled: true,
713
+ interests: [],
714
+ useKnowledgeForStarters: false,
713
715
  homeUrl: ""
714
716
  };
715
717
  sanitizePreferences = (preferences) => {
@@ -807,6 +809,8 @@ var init_preferencesStore = __esm({
807
809
  sttEnabled: typeof mergedPreferences.sttEnabled === "boolean" ? mergedPreferences.sttEnabled : defaultPreferences.sttEnabled,
808
810
  banditModelsEnabled: typeof mergedPreferences.banditModelsEnabled === "boolean" ? mergedPreferences.banditModelsEnabled : defaultPreferences.banditModelsEnabled,
809
811
  feedbackEnabled: typeof mergedPreferences.feedbackEnabled === "boolean" ? mergedPreferences.feedbackEnabled : defaultPreferences.feedbackEnabled,
812
+ interests: Array.isArray(mergedPreferences.interests) ? mergedPreferences.interests.filter((i) => typeof i === "string") : defaultPreferences.interests,
813
+ useKnowledgeForStarters: typeof mergedPreferences.useKnowledgeForStarters === "boolean" ? mergedPreferences.useKnowledgeForStarters : defaultPreferences.useKnowledgeForStarters,
810
814
  homeUrl: typeof mergedPreferences.homeUrl === "string" ? mergedPreferences.homeUrl : defaultPreferences.homeUrl
811
815
  };
812
816
  set({ preferences: validatedPreferences });
@@ -6620,7 +6624,7 @@ var init_util = __esm({
6620
6624
  });
6621
6625
 
6622
6626
  // src/prompts/getStableQuestionPrompt.ts
6623
- var TOPICS, getRandomTopicOfInterest, getStableQuestionPrompt;
6627
+ var TOPICS, getRandomTopicOfInterest, pickDistinctRandomTopics, getStableQuestionPrompt;
6624
6628
  var init_getStableQuestionPrompt = __esm({
6625
6629
  "src/prompts/getStableQuestionPrompt.ts"() {
6626
6630
  "use strict";
@@ -6633,42 +6637,65 @@ var init_getStableQuestionPrompt = __esm({
6633
6637
  const randomTopic = TOPICS[randomIndex];
6634
6638
  return randomTopic;
6635
6639
  };
6640
+ pickDistinctRandomTopics = (count) => {
6641
+ const pool = [...TOPICS];
6642
+ const picked = [];
6643
+ const n = Math.min(Math.max(count, 0), pool.length);
6644
+ for (let i = 0; i < n; i++) {
6645
+ const idx = randomRange(0, pool.length - 1);
6646
+ picked.push(pool[idx]);
6647
+ pool.splice(idx, 1);
6648
+ }
6649
+ return picked;
6650
+ };
6636
6651
  getStableQuestionPrompt = (args) => {
6637
- const { limit, topicOfInterest, modelSystemPrompt } = args;
6652
+ const { limit, topicOfInterest, modelSystemPrompt, interests, knowledgeTopics, webSearchAvailable } = args;
6638
6653
  if (limit < 1 || limit > 10) {
6639
6654
  throw new Error("Limit must be between 1 and 10");
6640
6655
  }
6641
6656
  const seed = generateSeed();
6642
- let prompt = `You are a helpful assistant.
6643
-
6644
- The following seed uniquely identifies the topic: "${seed}"`;
6657
+ const lines = [
6658
+ `You are crafting fresh, engaging conversation starters for a chat app's home screen.`,
6659
+ ``,
6660
+ `Variation seed (make this set different from any previous set): "${seed}"`
6661
+ ];
6645
6662
  if (modelSystemPrompt && modelSystemPrompt.trim()) {
6646
- prompt += `
6647
-
6648
- Based on this specialized assistant profile: "${modelSystemPrompt.trim()}"`;
6663
+ lines.push(``, `Tailor the questions to this assistant's role and expertise: "${modelSystemPrompt.trim()}"`);
6649
6664
  }
6650
- prompt += `
6651
-
6652
- 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:
6653
-
6654
- - Relevant to ${topicOfInterest}`;
6655
- if (modelSystemPrompt && modelSystemPrompt.trim()) {
6656
- prompt += `
6657
- - Aligned with the assistant's specialized capabilities and knowledge area`;
6658
- }
6659
- prompt += `
6660
- - Specific enough to be practical
6661
- - Easy to understand and not abstract
6662
-
6663
- Do not:
6664
- - Refer to yourself or use phrases like "As an AI..."
6665
- - Include greetings, explanations, or personality
6666
- - Include jokes, fiction, or quotes
6667
- - Number, bullet, or otherwise prefix the questions with extra characters
6668
- - Repeat the same idea phrased differently \u2014 each question must explore a distinct angle or subtopic
6669
-
6670
- Output only ${limit} questions \u2014 one per line, with no leading numbers, bullets, or prefixes.`;
6671
- return prompt.trim();
6665
+ if (interests && interests.length) {
6666
+ lines.push(
6667
+ ``,
6668
+ `The user is especially interested in: ${interests.join(", ")}. Lean toward these, but do NOT make every question about the same one.`
6669
+ );
6670
+ }
6671
+ if (knowledgeTopics && knowledgeTopics.length) {
6672
+ lines.push(
6673
+ ``,
6674
+ `The user keeps these documents in their library: ${knowledgeTopics.join("; ")}. Include one or two questions that draw on this material.`
6675
+ );
6676
+ }
6677
+ lines.push(
6678
+ ``,
6679
+ `Spread the set across a VARIETY of these topics so it never feels repetitive (do not cluster on one): ${topicOfInterest}.`
6680
+ );
6681
+ if (webSearchAvailable) {
6682
+ lines.push(
6683
+ ``,
6684
+ `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.`
6685
+ );
6686
+ }
6687
+ lines.push(
6688
+ ``,
6689
+ `Generate ${limit} concise (5\u201320 words), natural-sounding questions a user might ask${modelSystemPrompt ? " this specialized assistant" : " an AI assistant"}. Requirements:`,
6690
+ `- Each question must explore a DISTINCT topic or angle \u2014 no two may be similar or rephrasings of each other.`,
6691
+ `- Vary the type across the set: practical how-to, curious exploration, current/topical, creative, and learning.`,
6692
+ `- Specific and concrete, easy to understand, not abstract.`,
6693
+ ``,
6694
+ `Do not refer to yourself, say "As an AI", add greetings, explanations, jokes, fiction, quotes, or number/bullet the lines.`,
6695
+ ``,
6696
+ `Output only ${limit} questions \u2014 one per line, with no leading numbers, bullets, or prefixes.`
6697
+ );
6698
+ return lines.join("\n").trim();
6672
6699
  };
6673
6700
  }
6674
6701
  });
@@ -25596,6 +25623,9 @@ var init_query_suggestion_picker = __esm({
25596
25623
  init_prompts();
25597
25624
  init_getStableQuestionPrompt();
25598
25625
  init_modelStore();
25626
+ init_preferencesStore();
25627
+ init_knowledgeStore();
25628
+ init_mcpToolsStore();
25599
25629
  import_jsx_runtime25 = require("react/jsx-runtime");
25600
25630
  markdownComponents = {
25601
25631
  p: ({ node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { ...props }),
@@ -25622,13 +25652,19 @@ var init_query_suggestion_picker = __esm({
25622
25652
  if (hasGenerated.current || isLoading) return;
25623
25653
  hasGenerated.current = true;
25624
25654
  const currentModel = getCurrentModel();
25655
+ const prefs = usePreferencesStore.getState().preferences;
25656
+ const interests = (prefs.interests ?? []).filter((i) => i && i.trim());
25657
+ const randomTopics = pickDistinctRandomTopics(interests.length ? 3 : 5);
25658
+ const topicOfInterest = Array.from(/* @__PURE__ */ new Set([...interests, ...randomTopics])).join(", ") || getRandomTopicOfInterest();
25659
+ const webSearchAvailable = useMCPToolsStore.getState().getEnabledTools().some((t) => t.name === "web_search");
25660
+ const knowledgeTopics = prefs.useKnowledgeForStarters ? useKnowledgeStore.getState().docs.map((d) => d.name).filter((n) => n && n.trim()).slice(0, 12) : void 0;
25625
25661
  const args = {
25626
- // keep responses quick and snappy, server may be handling concurrent requests adjust as needed
25627
25662
  limit: 9,
25628
- // pick a random topic of interest from the list, consider using the users preference topics dynamically, otherwise get a random one
25629
- topicOfInterest: getRandomTopicOfInterest(),
25630
- // Pass the current model's system prompt to tailor suggestions
25631
- modelSystemPrompt: currentModel?.systemPrompt
25663
+ topicOfInterest,
25664
+ modelSystemPrompt: currentModel?.systemPrompt,
25665
+ interests,
25666
+ knowledgeTopics,
25667
+ webSearchAvailable
25632
25668
  };
25633
25669
  generateConversationStarters(args).then((prompts) => {
25634
25670
  if (prompts.length > 0) {
@@ -35302,6 +35338,7 @@ var PersonalitiesTab_default = PersonalitiesTab;
35302
35338
  var import_react47 = require("react");
35303
35339
  var import_material38 = require("@mui/material");
35304
35340
  init_preferencesStore();
35341
+ init_getStableQuestionPrompt();
35305
35342
  init_modelStore();
35306
35343
  init_voiceStore();
35307
35344
  init_useFeatures();
@@ -35759,6 +35796,49 @@ var PreferencesTab = ({
35759
35796
  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."
35760
35797
  }
35761
35798
  ),
35799
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Paper, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 } }, children: [
35800
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Box, { children: [
35801
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material38.Typography, { variant: "h6", sx: { fontWeight: 600, color: "text.primary" }, children: "Conversation Starters" }),
35802
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material38.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." })
35803
+ ] }),
35804
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material38.Box, { sx: { mt: 2, display: "flex", flexWrap: "wrap", gap: 1 }, children: TOPICS.map((topic) => {
35805
+ const selected = (preferences.interests ?? []).includes(topic);
35806
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
35807
+ import_material38.Chip,
35808
+ {
35809
+ label: topic,
35810
+ size: "small",
35811
+ color: selected ? "primary" : "default",
35812
+ variant: selected ? "filled" : "outlined",
35813
+ onClick: () => {
35814
+ const current = preferences.interests ?? [];
35815
+ const next = selected ? current.filter((t) => t !== topic) : [...current, topic];
35816
+ updatePreference("interests", next);
35817
+ },
35818
+ sx: { textTransform: "capitalize" }
35819
+ },
35820
+ topic
35821
+ );
35822
+ }) }),
35823
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material38.Box, { sx: { mt: 2.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
35824
+ import_material38.FormControlLabel,
35825
+ {
35826
+ control: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
35827
+ import_material38.Switch,
35828
+ {
35829
+ checked: !!preferences.useKnowledgeForStarters,
35830
+ onChange: (e) => updatePreference("useKnowledgeForStarters", e.target.checked),
35831
+ color: "primary"
35832
+ }
35833
+ ),
35834
+ label: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Box, { textAlign: "left", children: [
35835
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material38.Typography, { variant: "body1", sx: { fontWeight: 600, color: "text.primary" }, children: "Use my knowledge documents" }),
35836
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material38.Typography, { variant: "body2", color: "text.secondary", children: "Let some starters reference the documents in your library." })
35837
+ ] }),
35838
+ sx: { alignSelf: "flex-start", ml: 0 }
35839
+ }
35840
+ ) })
35841
+ ] }),
35762
35842
  /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Paper, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 } }, children: [
35763
35843
  /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Box, { sx: { display: "flex", flexDirection: { xs: "column", sm: "row" }, justifyContent: "space-between", gap: 2 }, children: [
35764
35844
  /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Box, { children: [