@burtson-labs/bandit-engine 2.0.44 → 2.0.49

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 (54) hide show
  1. package/README.md +7 -5
  2. package/dist/{aiProviderStore-UQI33C5E.mjs → aiProviderStore-3N3VE6D4.mjs} +2 -2
  3. package/dist/chat-647M6BRG.mjs +15 -0
  4. package/dist/chat-provider.js +45 -10
  5. package/dist/chat-provider.js.map +1 -1
  6. package/dist/chat-provider.mjs +6 -6
  7. package/dist/{chunk-UXE67LR7.mjs → chunk-6WZUQHZT.mjs} +11 -7
  8. package/dist/chunk-6WZUQHZT.mjs.map +1 -0
  9. package/dist/{chunk-QV4ELNLP.mjs → chunk-7HXARU5R.mjs} +58 -19
  10. package/dist/chunk-7HXARU5R.mjs.map +1 -0
  11. package/dist/{chunk-XUBYA5I7.mjs → chunk-7ZDS33S2.mjs} +34 -6
  12. package/dist/chunk-7ZDS33S2.mjs.map +1 -0
  13. package/dist/{chunk-SBNENBUQ.mjs → chunk-AXFX2HUK.mjs} +12 -12
  14. package/dist/{chunk-SBNENBUQ.mjs.map → chunk-AXFX2HUK.mjs.map} +1 -1
  15. package/dist/{chunk-54ZQ3FSN.mjs → chunk-BENL3EF2.mjs} +7 -4
  16. package/dist/chunk-BENL3EF2.mjs.map +1 -0
  17. package/dist/{chunk-RTQDQ6TC.mjs → chunk-EHNWQ4T3.mjs} +2 -2
  18. package/dist/{chunk-KBKWVG7X.mjs → chunk-HKJTRBWC.mjs} +5 -5
  19. package/dist/{chunk-JRGCRBWE.mjs → chunk-JCLL7AGP.mjs} +63 -45
  20. package/dist/chunk-JCLL7AGP.mjs.map +1 -0
  21. package/dist/{chunk-ERV7GLY3.mjs → chunk-TVF45U7B.mjs} +5 -5
  22. package/dist/{chunk-H4PBQ5LJ.mjs → chunk-VL3CMSDO.mjs} +4 -4
  23. package/dist/cli.js +44 -44
  24. package/dist/cli.js.map +1 -1
  25. package/dist/{gateway-5yt_3QDP.d.mts → gateway-oScD5tvE.d.mts} +4 -3
  26. package/dist/{gateway-5yt_3QDP.d.ts → gateway-oScD5tvE.d.ts} +4 -3
  27. package/dist/index.d.mts +2 -2
  28. package/dist/index.d.ts +2 -2
  29. package/dist/index.js +159 -67
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +10 -10
  32. package/dist/management/management.js +159 -67
  33. package/dist/management/management.js.map +1 -1
  34. package/dist/management/management.mjs +8 -8
  35. package/dist/modals/chat-modal/chat-modal.js +53 -18
  36. package/dist/modals/chat-modal/chat-modal.js.map +1 -1
  37. package/dist/modals/chat-modal/chat-modal.mjs +5 -5
  38. package/dist/{modelStore-UMJBDSEF.mjs → modelStore-XWFHNTBT.mjs} +2 -2
  39. package/dist/public-types.d.mts +2 -1
  40. package/dist/public-types.d.ts +2 -1
  41. package/package.json +1 -1
  42. package/dist/chat-7U633EWN.mjs +0 -15
  43. package/dist/chunk-54ZQ3FSN.mjs.map +0 -1
  44. package/dist/chunk-JRGCRBWE.mjs.map +0 -1
  45. package/dist/chunk-QV4ELNLP.mjs.map +0 -1
  46. package/dist/chunk-UXE67LR7.mjs.map +0 -1
  47. package/dist/chunk-XUBYA5I7.mjs.map +0 -1
  48. /package/dist/{aiProviderStore-UQI33C5E.mjs.map → aiProviderStore-3N3VE6D4.mjs.map} +0 -0
  49. /package/dist/{chat-7U633EWN.mjs.map → chat-647M6BRG.mjs.map} +0 -0
  50. /package/dist/{chunk-RTQDQ6TC.mjs.map → chunk-EHNWQ4T3.mjs.map} +0 -0
  51. /package/dist/{chunk-KBKWVG7X.mjs.map → chunk-HKJTRBWC.mjs.map} +0 -0
  52. /package/dist/{chunk-ERV7GLY3.mjs.map → chunk-TVF45U7B.mjs.map} +0 -0
  53. /package/dist/{chunk-H4PBQ5LJ.mjs.map → chunk-VL3CMSDO.mjs.map} +0 -0
  54. /package/dist/{modelStore-UMJBDSEF.mjs.map → modelStore-XWFHNTBT.mjs.map} +0 -0
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  management_default
3
- } from "../chunk-JRGCRBWE.mjs";
4
- import "../chunk-H4PBQ5LJ.mjs";
5
- import "../chunk-RTQDQ6TC.mjs";
6
- import "../chunk-ERV7GLY3.mjs";
7
- import "../chunk-SBNENBUQ.mjs";
8
- import "../chunk-UXE67LR7.mjs";
9
- import "../chunk-XUBYA5I7.mjs";
10
- import "../chunk-54ZQ3FSN.mjs";
3
+ } from "../chunk-JCLL7AGP.mjs";
4
+ import "../chunk-VL3CMSDO.mjs";
5
+ import "../chunk-EHNWQ4T3.mjs";
6
+ import "../chunk-TVF45U7B.mjs";
7
+ import "../chunk-AXFX2HUK.mjs";
8
+ import "../chunk-6WZUQHZT.mjs";
9
+ import "../chunk-7ZDS33S2.mjs";
10
+ import "../chunk-BENL3EF2.mjs";
11
11
  import "../chunk-KCI46M23.mjs";
12
12
  import "../chunk-BJTO5JO5.mjs";
13
13
  export {
@@ -1549,7 +1549,7 @@ var init_gateway_service = __esm({
1549
1549
  * Chat completion using the gateway API
1550
1550
  */
1551
1551
  chat(request) {
1552
- const endpoint = request.provider === "ollama" ? `/api/${request.provider}/chat` : request.provider ? `/api/${request.provider}/chat/completions` : "/api/chat/completions";
1552
+ const endpoint = request.provider === "ollama" ? `/api/${request.provider}/chat` : request.provider === "playground" ? "/api/playground/chat/completions" : request.provider ? `/api/${request.provider}/chat/completions` : "/api/chat/completions";
1553
1553
  const fallbackEndpoint = request.provider === "bandit" ? "/completions" : null;
1554
1554
  const normalizedModel = request.provider === "bandit" ? (() => {
1555
1555
  const trimmed = (request.model ?? "").replace(/^bandit:/, "").trim();
@@ -2520,6 +2520,9 @@ var init_gateway_provider = __esm({
2520
2520
  case "ollama":
2521
2521
  this.providerSpecificService = new OllamaGatewayService(gatewayUrl, tokenFactory);
2522
2522
  break;
2523
+ case "playground":
2524
+ this.providerSpecificService = null;
2525
+ break;
2523
2526
  default:
2524
2527
  debugLogger.warn("Unknown provider for gateway, using generic gateway service", {
2525
2528
  provider: this.config.provider
@@ -2550,7 +2553,7 @@ var init_gateway_provider = __esm({
2550
2553
  images: request.images
2551
2554
  };
2552
2555
  }
2553
- } else if (["openai", "azure-openai", "anthropic", "bandit"].includes(this.config.provider || "")) {
2556
+ } else if (["openai", "azure-openai", "anthropic", "bandit", "playground"].includes(this.config.provider || "")) {
2554
2557
  if (lastUserMessageIndex !== -1) {
2555
2558
  const currentMessage = messages[lastUserMessageIndex];
2556
2559
  const contentArray = [
@@ -2597,7 +2600,7 @@ var init_gateway_provider = __esm({
2597
2600
  stream: request.stream,
2598
2601
  hasImages: !!(request.images && request.images.length > 0),
2599
2602
  imageCount: request.images?.length || 0,
2600
- imageStrategy: this.config.provider === "ollama" ? "message-level-array" : ["openai", "azure-openai", "anthropic"].includes(this.config.provider || "") ? "structured-content" : "top-level-fallback",
2603
+ imageStrategy: this.config.provider === "ollama" ? "message-level-array" : ["openai", "azure-openai", "anthropic", "playground"].includes(this.config.provider || "") ? "structured-content" : "top-level-fallback",
2601
2604
  finalMessages: messages.map((m) => ({
2602
2605
  role: m.role,
2603
2606
  hasImages: Array.isArray(m.images) && m.images.length > 0,
@@ -3985,6 +3988,27 @@ var init_modelStore = __esm({
3985
3988
  });
3986
3989
  }
3987
3990
  }
3991
+ (async () => {
3992
+ const storeConfigs6 = [{ name: "config", keyPath: "id" }];
3993
+ try {
3994
+ const existing = await indexedDBService_default.get("banditConfig", 1, "config", "main", storeConfigs6);
3995
+ await indexedDBService_default.put(
3996
+ "banditConfig",
3997
+ 1,
3998
+ "config",
3999
+ {
4000
+ ...existing,
4001
+ id: "main",
4002
+ model: { ...existing?.model ?? {}, selectedModel: modelName }
4003
+ },
4004
+ storeConfigs6
4005
+ );
4006
+ } catch (err) {
4007
+ debugLogger.warn("setSelectedModel: failed to persist selected model", {
4008
+ error: err instanceof Error ? err.message : String(err)
4009
+ });
4010
+ }
4011
+ })();
3988
4012
  },
3989
4013
  saveModel: async () => {
3990
4014
  const state = get();
@@ -3994,7 +4018,8 @@ var init_modelStore = __esm({
3994
4018
  tagline: state.tagline,
3995
4019
  systemPrompt: state.systemPrompt,
3996
4020
  commands: state.commands,
3997
- avatarBase64: state.avatarBase64 ?? void 0
4021
+ // Ensure avatar changes are persisted even when cleared
4022
+ avatarBase64: state.avatarBase64 ?? null
3998
4023
  };
3999
4024
  await indexedDBService_default.put("banditConfig", 1, "config", { id: newModel.name, model: newModel }, storeConfigs6);
4000
4025
  const exists = state.availableModels.find((m) => m.name === newModel.name);
@@ -4021,7 +4046,12 @@ var init_modelStore = __esm({
4021
4046
  debugLogger.info("initModels: starting initialization");
4022
4047
  set({ isLoading: true, isInitializing: true });
4023
4048
  const storeConfigs6 = [{ name: "config", keyPath: "id" }];
4024
- const entries = await indexedDBService_default.getAll("banditConfig", 1, "config", storeConfigs6);
4049
+ const entries = await indexedDBService_default.getAll(
4050
+ "banditConfig",
4051
+ 1,
4052
+ "config",
4053
+ storeConfigs6
4054
+ );
4025
4055
  const mainEntry = entries.find((entry) => entry.id === "main");
4026
4056
  const modelEntries = entries.filter((entry) => entry.id !== "main" && entry.id !== "deletedModels");
4027
4057
  const deletedEntry = await indexedDBService_default.get("banditConfig", 1, "config", "deletedModels", storeConfigs6);
@@ -4031,13 +4061,14 @@ var init_modelStore = __esm({
4031
4061
  if (modelEntries.length > 0) {
4032
4062
  debugLogger.info("Loading models from IndexedDB");
4033
4063
  allModels = modelEntries.map((entry) => {
4034
- const modelData = entry.model?.name ? entry.model : entry;
4064
+ const modelData = entry.model ?? entry;
4035
4065
  return {
4036
4066
  name: modelData.name,
4037
4067
  tagline: modelData.tagline || "",
4038
4068
  systemPrompt: modelData.systemPrompt || "",
4039
4069
  commands: modelData.commands ?? [],
4040
- avatarBase64: modelData.avatarBase64 ?? null
4070
+ // Fall back to legacy top-level avatar when the nested model config omitted it
4071
+ avatarBase64: modelData.avatarBase64 ?? entry.avatarBase64 ?? null
4041
4072
  };
4042
4073
  }).filter((m) => m.name && !deletedModelNames.includes(m.name));
4043
4074
  const preferences = usePreferencesStore.getState().preferences;
@@ -7970,6 +8001,9 @@ function ensureDeviceId() {
7970
8001
  return (0, import_uuid4.v4)();
7971
8002
  }
7972
8003
  }
8004
+ function getPackageDefaultAdvancedKnowledgeSync() {
8005
+ return usePackageSettingsStore.getState().settings?.advancedKnowledgeSyncDefaultEnabled;
8006
+ }
7973
8007
  function mapConversationToDTO(conversation) {
7974
8008
  const updatedAtIso = (conversation.updatedAt ?? /* @__PURE__ */ new Date()).toISOString();
7975
8009
  const createdAtIso = conversation.createdAt ? conversation.createdAt.toISOString() : null;
@@ -8344,7 +8378,7 @@ var useConversationSyncStore = (0, import_zustand11.create)((set, get) => ({
8344
8378
  cursor: null,
8345
8379
  lastError: null,
8346
8380
  keepLocalOnly: false,
8347
- isAdvancedVectorFeaturesEnabled: false,
8381
+ isAdvancedVectorFeaturesEnabled: getPackageDefaultAdvancedKnowledgeSync() ?? false,
8348
8382
  conflicts: null,
8349
8383
  deviceId: ensureDeviceId(),
8350
8384
  pendingConversationUpserts: /* @__PURE__ */ new Set(),
@@ -8468,7 +8502,7 @@ var useConversationSyncStore = (0, import_zustand11.create)((set, get) => ({
8468
8502
  await get().runSync({ force: true });
8469
8503
  }
8470
8504
  } catch (error) {
8471
- const message = error instanceof Error ? error.message : "Failed to update advanced vector setting";
8505
+ const message = error instanceof Error ? error.message : "Failed to update advanced knowledge setting";
8472
8506
  debugLogger.error("conversationSyncStore: setAdvancedVectorFeaturesEnabled failed", { error: message });
8473
8507
  set({ status: "error", lastError: message });
8474
8508
  throw error;
@@ -8676,7 +8710,8 @@ function applyPreference(preference, set, getState, options) {
8676
8710
  const override = options?.override ?? {};
8677
8711
  const preferenceVectorFlag = preference.isAdvancedVectorFeaturesEnabled;
8678
8712
  const overrideVectorFlag = override.isAdvancedVectorFeaturesEnabled;
8679
- const resolvedVectorFlag = preferenceVectorFlag !== void 0 ? preferenceVectorFlag : overrideVectorFlag !== void 0 ? overrideVectorFlag : current.isAdvancedVectorFeaturesEnabled ?? false;
8713
+ const packageDefaultVectorFlag = getPackageDefaultAdvancedKnowledgeSync();
8714
+ const resolvedVectorFlag = preferenceVectorFlag !== void 0 ? preferenceVectorFlag : overrideVectorFlag !== void 0 ? overrideVectorFlag : packageDefaultVectorFlag !== void 0 ? packageDefaultVectorFlag : current.isAdvancedVectorFeaturesEnabled ?? false;
8680
8715
  set({
8681
8716
  syncEnabled: preference.syncEnabled,
8682
8717
  status: preference.syncEnabled ? "idle" : "disabled",
@@ -13702,7 +13737,7 @@ var MemoryModal = ({ open, onClose }) => {
13702
13737
  children: [
13703
13738
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_material8.Box, { sx: { display: "flex", alignItems: "center", gap: 0.75 }, children: [
13704
13739
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material8.Typography, { variant: "h6", sx: { fontWeight: 600 }, children: "Memory" }),
13705
- shouldUseVectorForMemories && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material8.Tooltip, { title: "Memories are stored in an AI vector database with semantic search capabilities", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
13740
+ shouldUseVectorForMemories && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material8.Tooltip, { title: "Memories stay in your private knowledge space for faster, more accurate answers.", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
13706
13741
  import_material8.Typography,
13707
13742
  {
13708
13743
  variant: "caption",
@@ -13717,7 +13752,7 @@ var MemoryModal = ({ open, onClose }) => {
13717
13752
  textTransform: "uppercase",
13718
13753
  cursor: "help"
13719
13754
  },
13720
- children: "Vector"
13755
+ children: "Synced"
13721
13756
  }
13722
13757
  ) })
13723
13758
  ] }),
@@ -13816,7 +13851,7 @@ var MemoryModal = ({ open, onClose }) => {
13816
13851
  onClick: () => setBulkImportOpen(true),
13817
13852
  startIcon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_CloudSync.default, {}),
13818
13853
  sx: { textTransform: "none", borderRadius: 2, fontSize: "0.75rem" },
13819
- children: "Import to Vector"
13854
+ children: "Import to workspace"
13820
13855
  }
13821
13856
  ),
13822
13857
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -14058,7 +14093,7 @@ var MemoryModal = ({ open, onClose }) => {
14058
14093
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material8.Typography, { variant: "body2", sx: {
14059
14094
  color: (0, import_styles3.alpha)(theme.palette.text.secondary, 0.7),
14060
14095
  maxWidth: 280
14061
- }, children: selectedTab === "user" ? shouldUseVectorForMemories ? "Start by adding something you'd like me to remember. Your memories will be stored in the AI vector database for intelligent retrieval." : "Start by adding something you'd like me to remember about you or your preferences." : shouldUseVectorForMemories ? "Auto memories are created automatically based on our conversations and stored in the vector database for semantic search." : "Auto memories are created automatically based on our conversations." })
14096
+ }, children: selectedTab === "user" ? shouldUseVectorForMemories ? "Start by adding something you'd like me to remember. Your memories will be kept in a private workspace for quick recall." : "Start by adding something you'd like me to remember about you or your preferences." : shouldUseVectorForMemories ? "Auto memories are created automatically based on our conversations and kept in your private workspace for better answers." : "Auto memories are created automatically based on our conversations." })
14062
14097
  ] }) : filteredMemories.map((memory) => {
14063
14098
  const isSelected = selectedIds.includes(memory.id);
14064
14099
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react14.default.Fragment, { children: [
@@ -14330,7 +14365,7 @@ var MemoryModal = ({ open, onClose }) => {
14330
14365
  size: "small",
14331
14366
  value: newMemory,
14332
14367
  onChange: (e) => setNewMemory(e.target.value),
14333
- placeholder: shouldUseVectorForMemories ? `Add a new ${selectedTab} memory to vector database...` : `Add a new ${selectedTab} memory...`,
14368
+ placeholder: shouldUseVectorForMemories ? `Add a new ${selectedTab} memory to your workspace...` : `Add a new ${selectedTab} memory...`,
14334
14369
  onKeyDown: (e) => {
14335
14370
  if (e.key === "Enter" && !e.shiftKey && newMemory.trim()) {
14336
14371
  e.preventDefault();
@@ -14570,15 +14605,15 @@ var MemoryModal = ({ open, onClose }) => {
14570
14605
  gap: 1
14571
14606
  }, children: [
14572
14607
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_CloudSync.default, { color: "primary" }),
14573
- "Import Memories to Vector Database"
14608
+ "Import Memories to Secure Workspace"
14574
14609
  ] }),
14575
14610
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material8.DialogContent, { sx: { py: 2 }, children: !importProgress.isImporting ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_material8.Box, { children: [
14576
14611
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_material8.Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: [
14577
14612
  "This will import all your local memories (",
14578
14613
  entries.length,
14579
- " memories) to the vector database for enhanced semantic search capabilities."
14614
+ " memories) to your secure workspace for faster, more reliable answers."
14580
14615
  ] }),
14581
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material8.Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: "\u2022 Memories will be added to your vector storage \u2022 Local memories will remain unchanged \u2022 You can switch between local and vector storage anytime" }),
14616
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material8.Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: "\u2022 Memories will be added to your synced workspace \u2022 Local memories will remain unchanged \u2022 You can switch between synced and local storage anytime" }),
14582
14617
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_material8.Typography, { variant: "body2", color: "primary", sx: { fontWeight: 500 }, children: [
14583
14618
  "Ready to import ",
14584
14619
  entries.length,