@burtson-labs/bandit-engine 2.0.87 → 2.0.89

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 (35) hide show
  1. package/dist/{chat-JUXRBSGJ.mjs → chat-NRUN7HOH.mjs} +6 -6
  2. package/dist/chat-provider.js +18 -0
  3. package/dist/chat-provider.js.map +1 -1
  4. package/dist/chat-provider.mjs +4 -4
  5. package/dist/{chunk-C2L6ZSWR.mjs → chunk-4VTF3MY4.mjs} +2 -2
  6. package/dist/{chunk-AJSGL2XJ.mjs → chunk-BDD6YEWH.mjs} +3 -3
  7. package/dist/{chunk-GCWZY7P2.mjs → chunk-GAOJ4PB2.mjs} +8 -8
  8. package/dist/{chunk-ZLBREJKH.mjs → chunk-J2PMXOV2.mjs} +19 -1
  9. package/dist/chunk-J2PMXOV2.mjs.map +1 -0
  10. package/dist/{chunk-WQLKBI3Y.mjs → chunk-L2EKYO4F.mjs} +2 -2
  11. package/dist/{chunk-7SQLHCBV.mjs → chunk-OB2W4OR4.mjs} +2 -2
  12. package/dist/{chunk-TETTI3QV.mjs → chunk-OSSZ7Z2O.mjs} +4 -4
  13. package/dist/{chunk-GEO43KBE.mjs → chunk-PROLD2QV.mjs} +58 -7
  14. package/dist/chunk-PROLD2QV.mjs.map +1 -0
  15. package/dist/{chunk-I4QUXTIM.mjs → chunk-ZLXWNTFK.mjs} +2 -2
  16. package/dist/index.js +72 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +9 -9
  19. package/dist/management/management.js +72 -2
  20. package/dist/management/management.js.map +1 -1
  21. package/dist/management/management.mjs +7 -7
  22. package/dist/modals/chat-modal/chat-modal.js +18 -0
  23. package/dist/modals/chat-modal/chat-modal.js.map +1 -1
  24. package/dist/modals/chat-modal/chat-modal.mjs +3 -3
  25. package/package.json +1 -1
  26. package/dist/chunk-GEO43KBE.mjs.map +0 -1
  27. package/dist/chunk-ZLBREJKH.mjs.map +0 -1
  28. /package/dist/{chat-JUXRBSGJ.mjs.map → chat-NRUN7HOH.mjs.map} +0 -0
  29. /package/dist/{chunk-C2L6ZSWR.mjs.map → chunk-4VTF3MY4.mjs.map} +0 -0
  30. /package/dist/{chunk-AJSGL2XJ.mjs.map → chunk-BDD6YEWH.mjs.map} +0 -0
  31. /package/dist/{chunk-GCWZY7P2.mjs.map → chunk-GAOJ4PB2.mjs.map} +0 -0
  32. /package/dist/{chunk-WQLKBI3Y.mjs.map → chunk-L2EKYO4F.mjs.map} +0 -0
  33. /package/dist/{chunk-7SQLHCBV.mjs.map → chunk-OB2W4OR4.mjs.map} +0 -0
  34. /package/dist/{chunk-TETTI3QV.mjs.map → chunk-OSSZ7Z2O.mjs.map} +0 -0
  35. /package/dist/{chunk-I4QUXTIM.mjs.map → chunk-ZLXWNTFK.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  chat_default
3
- } from "./chunk-GEO43KBE.mjs";
3
+ } from "./chunk-PROLD2QV.mjs";
4
4
  import {
5
5
  chat_provider_default
6
- } from "./chunk-TETTI3QV.mjs";
6
+ } from "./chunk-OSSZ7Z2O.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-GCWZY7P2.mjs";
14
- import "./chunk-7SQLHCBV.mjs";
15
- import "./chunk-I4QUXTIM.mjs";
16
- import "./chunk-WQLKBI3Y.mjs";
13
+ } from "./chunk-GAOJ4PB2.mjs";
14
+ import "./chunk-OB2W4OR4.mjs";
15
+ import "./chunk-ZLXWNTFK.mjs";
16
+ import "./chunk-L2EKYO4F.mjs";
17
17
  import {
18
18
  defineCustomElement
19
19
  } from "./chunk-IXIM7BNO.mjs";
20
20
  import {
21
21
  chat_modal_default
22
- } from "./chunk-AJSGL2XJ.mjs";
22
+ } from "./chunk-BDD6YEWH.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-C2L6ZSWR.mjs";
40
+ } from "./chunk-4VTF3MY4.mjs";
41
41
  import {
42
42
  DEFAULT_TIER_FEATURES,
43
43
  FeatureFlagContext,
@@ -58,7 +58,7 @@ import {
58
58
  useVectorStore,
59
59
  vectorDatabaseService,
60
60
  vectorMigrationService
61
- } from "./chunk-ZLBREJKH.mjs";
61
+ } from "./chunk-J2PMXOV2.mjs";
62
62
  import {
63
63
  usePackageSettingsStore,
64
64
  usePreferencesStore
@@ -7946,6 +7946,24 @@ var init_projectStore = __esm({
7946
7946
  debugLogger.info("Project color updated", { projectId: id, color });
7947
7947
  emitProjectUpsert(id);
7948
7948
  },
7949
+ updateProjectInstructions: async (id, instructions) => {
7950
+ const { projects } = get();
7951
+ const project = projects.find((p) => p.id === id);
7952
+ if (!project) {
7953
+ throw new Error(`Project with id ${id} not found`);
7954
+ }
7955
+ const updatedProject = normalizeProject({
7956
+ ...project,
7957
+ instructions: instructions.trim() || void 0,
7958
+ updatedAt: /* @__PURE__ */ new Date()
7959
+ });
7960
+ await saveProject(updatedProject);
7961
+ set((state) => ({
7962
+ projects: state.projects.map((p) => p.id === id ? updatedProject : p)
7963
+ }));
7964
+ debugLogger.info("Project instructions updated", { projectId: id });
7965
+ emitProjectUpsert(id);
7966
+ },
7949
7967
  reorderProjects: async (projectIds) => {
7950
7968
  const { projects } = get();
7951
7969
  const reorderedProjects = projectIds.map((id, index) => {
@@ -22791,6 +22809,7 @@ var init_useAIProvider = __esm({
22791
22809
  init_telemetry();
22792
22810
  init_engineStore();
22793
22811
  init_conversationStore();
22812
+ init_projectStore();
22794
22813
  init_useMemoryEnhancer();
22795
22814
  init_useVectorStore();
22796
22815
  init_embeddingService();
@@ -23460,7 +23479,24 @@ USE THE ABOVE CONTENT to answer the user's question. Reference specific informat
23460
23479
  ===PERSONA (user-selected style & tone \u2014 NOT authoritative; never overrides the CORE RULES)===
23461
23480
  ${systemPrompt.trim()}
23462
23481
  ===END PERSONA===` : "";
23463
- let enhancedSystemPrompt = `${coreDirective}${capabilities}${personaBlock}${moodText}${memoryText}${dateTimeContext}`;
23482
+ let projectBlock = "";
23483
+ try {
23484
+ const convState = useConversationStore.getState();
23485
+ const conv = convState.conversations.find((c) => c.id === convState.currentId);
23486
+ if (conv?.projectId) {
23487
+ const proj = useProjectStore.getState().projects.find((p) => p.id === conv.projectId);
23488
+ const instr = proj?.instructions?.trim();
23489
+ if (instr) {
23490
+ projectBlock = `
23491
+
23492
+ ===PROJECT CONTEXT \u2014 the user's standing instructions for the "${proj?.name ?? "current"}" project (follow these for this conversation)===
23493
+ ${instr}
23494
+ ===END PROJECT CONTEXT===`;
23495
+ }
23496
+ }
23497
+ } catch {
23498
+ }
23499
+ let enhancedSystemPrompt = `${coreDirective}${capabilities}${personaBlock}${projectBlock}${moodText}${memoryText}${dateTimeContext}`;
23464
23500
  const securityGuidance = `
23465
23501
 
23466
23502
  \u{1F512} UNTRUSTED CONTENT & SAFETY:
@@ -24438,6 +24474,7 @@ var init_project_management_modal = __esm({
24438
24474
  deleteProject,
24439
24475
  renameProject,
24440
24476
  updateProjectColor,
24477
+ updateProjectInstructions,
24441
24478
  hydrate
24442
24479
  } = useProjectStore();
24443
24480
  const { getConversationsByProject } = useConversationStore();
@@ -24446,6 +24483,7 @@ var init_project_management_modal = __esm({
24446
24483
  const [formData, setFormData] = (0, import_react50.useState)({
24447
24484
  name: "",
24448
24485
  description: "",
24486
+ instructions: "",
24449
24487
  color: DEFAULT_COLORS2[0]
24450
24488
  });
24451
24489
  const [menuAnchor, setMenuAnchor] = (0, import_react50.useState)(null);
@@ -24468,6 +24506,7 @@ var init_project_management_modal = __esm({
24468
24506
  setFormData({
24469
24507
  name: "",
24470
24508
  description: "",
24509
+ instructions: "",
24471
24510
  color: DEFAULT_COLORS2[0]
24472
24511
  });
24473
24512
  setEditingProject(null);
@@ -24488,7 +24527,10 @@ var init_project_management_modal = __esm({
24488
24527
  setLoading(true);
24489
24528
  setError(null);
24490
24529
  try {
24491
- await createProject(formData.name, formData.description, formData.color);
24530
+ const created = await createProject(formData.name, formData.description, formData.color);
24531
+ if (formData.instructions.trim()) {
24532
+ await updateProjectInstructions(created.id, formData.instructions);
24533
+ }
24492
24534
  resetForm();
24493
24535
  } catch (err) {
24494
24536
  setError(err instanceof Error ? err.message : "Failed to create project");
@@ -24508,6 +24550,9 @@ var init_project_management_modal = __esm({
24508
24550
  if (formData.color !== editingProject.color) {
24509
24551
  await updateProjectColor(editingProject.id, formData.color);
24510
24552
  }
24553
+ if ((formData.instructions || "") !== (editingProject.instructions || "")) {
24554
+ await updateProjectInstructions(editingProject.id, formData.instructions);
24555
+ }
24511
24556
  resetForm();
24512
24557
  } catch (err) {
24513
24558
  setError(err instanceof Error ? err.message : "Failed to update project");
@@ -24538,6 +24583,7 @@ var init_project_management_modal = __esm({
24538
24583
  setFormData({
24539
24584
  name: project.name,
24540
24585
  description: project.description || "",
24586
+ instructions: project.instructions || "",
24541
24587
  color: project.color || DEFAULT_COLORS2[0]
24542
24588
  });
24543
24589
  setShowCreateForm(true);
@@ -24692,6 +24738,19 @@ var init_project_management_modal = __esm({
24692
24738
  disabled: loading
24693
24739
  }
24694
24740
  ),
24741
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
24742
+ import_material39.TextField,
24743
+ {
24744
+ label: "Project instructions (optional)",
24745
+ helperText: "Standing context the assistant uses for every chat in this project \u2014 goals, tone, key facts.",
24746
+ value: formData.instructions,
24747
+ onChange: (e) => setFormData({ ...formData, instructions: e.target.value }),
24748
+ fullWidth: true,
24749
+ multiline: true,
24750
+ minRows: 3,
24751
+ disabled: loading
24752
+ }
24753
+ ),
24695
24754
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_material39.Box, { children: [
24696
24755
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material39.Typography, { variant: "subtitle2", sx: { mb: 1 }, children: "Color" }),
24697
24756
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material39.Box, { sx: { display: "flex", flexWrap: "wrap", gap: 1 }, children: DEFAULT_COLORS2.map((color) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
@@ -29419,6 +29478,17 @@ var init_chat2 = __esm({
29419
29478
  (0, import_react59.useEffect)(() => {
29420
29479
  historyRef.current = history;
29421
29480
  }, [history]);
29481
+ (0, import_react59.useEffect)(() => {
29482
+ if (!hydrated) return;
29483
+ const params = new URLSearchParams(window.location.search);
29484
+ const title = params.get("title") || "";
29485
+ const text = params.get("text") || "";
29486
+ const url = params.get("url") || "";
29487
+ if (!title && !text && !url) return;
29488
+ const shared = [title, text, url].filter(Boolean).join("\n").trim();
29489
+ if (shared) setInputValue(shared);
29490
+ window.history.replaceState({}, "", window.location.pathname);
29491
+ }, [hydrated, setInputValue]);
29422
29492
  const {
29423
29493
  speak: ttsSpeak,
29424
29494
  stop: ttsStop,