@burtson-labs/bandit-engine 2.1.5 → 2.1.8
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/CHANGELOG.md +29 -0
- package/dist/AdvancedTab-HZTDXFST.mjs +229 -0
- package/dist/AdvancedTab-HZTDXFST.mjs.map +1 -0
- package/dist/CrewSection-YM26YD2N.mjs +12 -0
- package/dist/InstructionsTab-MKOGBQ5L.mjs +195 -0
- package/dist/InstructionsTab-MKOGBQ5L.mjs.map +1 -0
- package/dist/PersonalizationTab-2XHFTYYW.mjs +179 -0
- package/dist/PersonalizationTab-2XHFTYYW.mjs.map +1 -0
- package/dist/{ProjectsPane-BSVOVNK7.mjs → ProjectsPane-KE5DGFN4.mjs} +11 -8
- package/dist/ProjectsPane-KE5DGFN4.mjs.map +1 -0
- package/dist/{SchedulesTab-TCUOAKLH.mjs → SchedulesTab-AM5QP36K.mjs} +8 -6
- package/dist/SchedulesTab-AM5QP36K.mjs.map +1 -0
- package/dist/{aiProviderStore-ANPQVHGD.mjs → aiProviderStore-GH4JZTMW.mjs} +3 -2
- package/dist/chat-D66YM4MB.mjs +26 -0
- package/dist/{chunk-SK7FSLCY.mjs → chunk-2FI2IICG.mjs} +7 -564
- package/dist/chunk-2FI2IICG.mjs.map +1 -0
- package/dist/{chunk-4257FVLK.mjs → chunk-2HFSBPOE.mjs} +6 -1
- package/dist/chunk-2HFSBPOE.mjs.map +1 -0
- package/dist/chunk-2THUYNVU.mjs +1203 -0
- package/dist/chunk-2THUYNVU.mjs.map +1 -0
- package/dist/{chunk-KWOUXBSF.mjs → chunk-5LXCZJLJ.mjs} +5 -213
- package/dist/chunk-5LXCZJLJ.mjs.map +1 -0
- package/dist/{chunk-ZG66NJC3.mjs → chunk-5URP2E5V.mjs} +3 -6
- package/dist/chunk-5URP2E5V.mjs.map +1 -0
- package/dist/chunk-5WCKKD3S.mjs +1742 -0
- package/dist/chunk-5WCKKD3S.mjs.map +1 -0
- package/dist/{chunk-GX4FVZNA.mjs → chunk-DHXSFFLX.mjs} +4 -26
- package/dist/chunk-DHXSFFLX.mjs.map +1 -0
- package/dist/chunk-EKPPIS3X.mjs +336 -0
- package/dist/chunk-EKPPIS3X.mjs.map +1 -0
- package/dist/chunk-FBLITVVY.mjs +5845 -0
- package/dist/chunk-FBLITVVY.mjs.map +1 -0
- package/dist/chunk-H2XUGGKV.mjs +168 -0
- package/dist/chunk-H2XUGGKV.mjs.map +1 -0
- package/dist/chunk-K4AO466X.mjs +570 -0
- package/dist/chunk-K4AO466X.mjs.map +1 -0
- package/dist/chunk-KPT7NNNK.mjs +214 -0
- package/dist/chunk-KPT7NNNK.mjs.map +1 -0
- package/dist/{chunk-IXD2TDA5.mjs → chunk-LAH6UL3Q.mjs} +11 -1727
- package/dist/chunk-LAH6UL3Q.mjs.map +1 -0
- package/dist/chunk-LC64VSDS.mjs +541 -0
- package/dist/chunk-LC64VSDS.mjs.map +1 -0
- package/dist/{chunk-DH5A2HT2.mjs → chunk-LY3O7UWA.mjs} +45 -1
- package/dist/chunk-LY3O7UWA.mjs.map +1 -0
- package/dist/chunk-WBKTQJNX.mjs +21 -0
- package/dist/chunk-WBKTQJNX.mjs.map +1 -0
- package/dist/{chunk-XGIQNHUO.mjs → chunk-WZGDQ4EA.mjs} +5776 -11713
- package/dist/chunk-WZGDQ4EA.mjs.map +1 -0
- package/dist/chunk-Y272M3D5.mjs +28 -0
- package/dist/chunk-Y272M3D5.mjs.map +1 -0
- package/dist/image-compare-NW5VCP4Q.mjs +74 -0
- package/dist/image-compare-NW5VCP4Q.mjs.map +1 -0
- package/dist/image-edit-acknowledgement-RZPQYKYJ.mjs +54 -0
- package/dist/image-edit-acknowledgement-RZPQYKYJ.mjs.map +1 -0
- package/dist/index.d.mts +135 -7
- package/dist/index.d.ts +135 -7
- package/dist/index.js +10491 -8632
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1393 -2368
- package/dist/index.mjs.map +1 -1
- package/dist/{modelStore-YNANSWCN.mjs → modelStore-KO45QAO2.mjs} +3 -2
- package/dist/modelStore-KO45QAO2.mjs.map +1 -0
- package/dist/{public-Tq2Pmw9m.d.mts → public-_W_Zew3C.d.mts} +14 -0
- package/dist/{public-Tq2Pmw9m.d.ts → public-_W_Zew3C.d.ts} +14 -0
- package/dist/public-types.d.mts +1 -1
- package/dist/public-types.d.ts +1 -1
- package/dist/{schedule-confirm-card-7CMATYSP.mjs → schedule-confirm-card-D4K76HEA.mjs} +5 -5
- package/package.json +1 -1
- package/dist/ProjectsPane-BSVOVNK7.mjs.map +0 -1
- package/dist/SchedulesTab-TCUOAKLH.mjs.map +0 -1
- package/dist/chat-Y7KPN54G.mjs +0 -18
- package/dist/chunk-4257FVLK.mjs.map +0 -1
- package/dist/chunk-DH5A2HT2.mjs.map +0 -1
- package/dist/chunk-GX4FVZNA.mjs.map +0 -1
- package/dist/chunk-IXD2TDA5.mjs.map +0 -1
- package/dist/chunk-KWOUXBSF.mjs.map +0 -1
- package/dist/chunk-SK7FSLCY.mjs.map +0 -1
- package/dist/chunk-XGIQNHUO.mjs.map +0 -1
- package/dist/chunk-ZG66NJC3.mjs.map +0 -1
- /package/dist/{aiProviderStore-ANPQVHGD.mjs.map → CrewSection-YM26YD2N.mjs.map} +0 -0
- /package/dist/{chat-Y7KPN54G.mjs.map → aiProviderStore-GH4JZTMW.mjs.map} +0 -0
- /package/dist/{modelStore-YNANSWCN.mjs.map → chat-D66YM4MB.mjs.map} +0 -0
- /package/dist/{schedule-confirm-card-7CMATYSP.mjs.map → schedule-confirm-card-D4K76HEA.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
Notable changes to `@burtson-labs/bandit-engine`. Versions follow semver.
|
|
4
4
|
|
|
5
|
+
## 2.1.8
|
|
6
|
+
|
|
7
|
+
### Management (web console; the native shells are unchanged)
|
|
8
|
+
|
|
9
|
+
- Personalities are retired from the web console in favour of two plain layers: **Assistant instructions** (Settings → Workspace; one standing prompt for everyone) and each person's **Custom instructions** (Settings → You → Personalization: "What should Bandit know about you?" and "How would you like Bandit to respond?", 1,500 characters each). Together they form the PERSONA block of the system prompt, where the active personality's prompt went. Stored personality records are not touched; the active one's prompt is still read as the fallback for one release, and a customized active personality is copied into that browser's Custom instructions once (`migrations.customInstructionsFromPersonality`). The voice greeting says the workspace's name (or Bandit) instead of a personality name. `useInstructionsStore`, `composePersonaPrompt` and `planPersonalityMigration` are exported.
|
|
10
|
+
- **What Bandit remembers** is a page: the Memories modal's body is now `MemoryManager` (exported), rendered under Personalization with the memory on/off switch, search, edit, pin, delete, select-several and clear-by-kind. Local edits and per-kind clears are persisted (the modal changed them in memory only). The sidebar's "Memories" entries open the page on the web; native keeps the sheet.
|
|
11
|
+
- **Crew** is its own section, and a new **Advanced** section holds the model provider page, service status and the workspace Export / Import / Reset. Import now MERGES by default (add or replace by name, delete nothing); "Replace everything" sits behind a confirmation. Exports carry `assistantInstructions` (`version: 2`); older files import unchanged. Importing branding no longer drops the active personality from the `main` record.
|
|
12
|
+
- "Include Bandit personalities" and "Restore deleted Bandit personalities" leave Preferences on the web (they edited the workspace's list from a personal page).
|
|
13
|
+
- "Reset all storage" confirms in a dialog that lists exactly what is deleted, including that it clears the saved sign-in and reloads.
|
|
14
|
+
|
|
15
|
+
### Deprecations
|
|
16
|
+
|
|
17
|
+
- `ChatModal` (and `ChatModalProps`) are deprecated and will be removed in 3.0. The floating assistant sends the raw personality prompt without the core rules, memory, project context or the Engine picker's model; embed `Chat` instead. The native shells still render it on Management; nothing else in the engine uses it.
|
|
18
|
+
|
|
19
|
+
## 2.1.7
|
|
20
|
+
|
|
21
|
+
### Management
|
|
22
|
+
|
|
23
|
+
- Settings: sections grouped as Overview, You and Workspace with plainer names (Appearance, Local data, Tools & integrations); the floating chat button and its modal are gone from the settings page; Personalities shows which one is active; Local data counts and resets the real stores (projects included); branding import reports failures; viewport diagnostics hidden. Native shells keep the previous layout.
|
|
24
|
+
|
|
25
|
+
## 2.1.6
|
|
26
|
+
|
|
27
|
+
### Chat
|
|
28
|
+
|
|
29
|
+
- Image generation and photo editing (paid plans). `image_generation` follows a queued job to the end and shows the queue position and an estimate on the tool trail ("Generating an image — queued at position 2, about 3 min"). The new `image_edit` tool sends a photo attached to the message (button, drop or paste; JPEG, PNG, WebP, and HEIC converted on the device where the browser can decode it; 20 MB, four photos per message) with the instruction as multipart to `/api/mcp/edit-image`. A finished edit shows a before/after toggle. A one-time acknowledgement is asked for before the first edit, then the edit is retried. Image tools get a 120 s tool timeout.
|
|
30
|
+
- A free account asking for an image gets the gateway's message with a link to the plans ("Image generation and photo editing are on paid plans. See plans"), shown as a normal answer, not an error. The trail says "Image generation is on paid plans".
|
|
31
|
+
- When a paid job runs on a cloud model to skip a long GPU queue, the trail says "Running in the cloud to skip the queue", the finished item reads "Generated an image in the cloud to skip the queue", and the note under the image says so. `ImageJobResponse` and `ImageJobProgress` carry `backend` (`gpu` | `cloud`); `ImageJobResponse` carries `upgradeUrl`.
|
|
32
|
+
- The trail shows the daily allowance after each result ("29 of 30 left today") and the gateway's own words for a used allowance or a refusal.
|
|
33
|
+
|
|
5
34
|
## 2.1.5
|
|
6
35
|
|
|
7
36
|
### Chat
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ProviderTab,
|
|
3
|
+
ServiceStatusCard
|
|
4
|
+
} from "./chunk-2THUYNVU.mjs";
|
|
5
|
+
import "./chunk-LC64VSDS.mjs";
|
|
6
|
+
import {
|
|
7
|
+
Download,
|
|
8
|
+
FileUp,
|
|
9
|
+
RotateCcw
|
|
10
|
+
} from "./chunk-K4AO466X.mjs";
|
|
11
|
+
import {
|
|
12
|
+
ManagementCard
|
|
13
|
+
} from "./chunk-LY3O7UWA.mjs";
|
|
14
|
+
import "./chunk-DHXSFFLX.mjs";
|
|
15
|
+
import "./chunk-Y272M3D5.mjs";
|
|
16
|
+
import "./chunk-KPT7NNNK.mjs";
|
|
17
|
+
import "./chunk-2HFSBPOE.mjs";
|
|
18
|
+
import "./chunk-K7SQWDNF.mjs";
|
|
19
|
+
import "./chunk-S3DWWUBD.mjs";
|
|
20
|
+
import "./chunk-NI7BKLC7.mjs";
|
|
21
|
+
|
|
22
|
+
// src/management/components/AdvancedTab.tsx
|
|
23
|
+
import { Stack as Stack2 } from "@mui/material";
|
|
24
|
+
|
|
25
|
+
// src/management/components/WorkspaceConfigCard.tsx
|
|
26
|
+
import { useRef, useState } from "react";
|
|
27
|
+
import {
|
|
28
|
+
Button,
|
|
29
|
+
Dialog,
|
|
30
|
+
DialogActions,
|
|
31
|
+
DialogContent,
|
|
32
|
+
DialogContentText,
|
|
33
|
+
DialogTitle,
|
|
34
|
+
Stack,
|
|
35
|
+
Typography
|
|
36
|
+
} from "@mui/material";
|
|
37
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
38
|
+
var WorkspaceConfigCard = ({
|
|
39
|
+
onExport,
|
|
40
|
+
onImport,
|
|
41
|
+
onReset,
|
|
42
|
+
showSnackbar
|
|
43
|
+
}) => {
|
|
44
|
+
const inputRef = useRef(null);
|
|
45
|
+
const [mode, setMode] = useState("merge");
|
|
46
|
+
const [confirmReplace, setConfirmReplace] = useState(false);
|
|
47
|
+
const [confirmReset, setConfirmReset] = useState(false);
|
|
48
|
+
const [busy, setBusy] = useState(false);
|
|
49
|
+
const pick = (next) => {
|
|
50
|
+
setMode(next);
|
|
51
|
+
requestAnimationFrame(() => inputRef.current?.click());
|
|
52
|
+
};
|
|
53
|
+
const handleFile = async (event) => {
|
|
54
|
+
const input = event.target;
|
|
55
|
+
const file = input.files?.[0];
|
|
56
|
+
if (!file) return;
|
|
57
|
+
setBusy(true);
|
|
58
|
+
try {
|
|
59
|
+
const summary = await onImport(file, mode);
|
|
60
|
+
showSnackbar?.(summary, "success");
|
|
61
|
+
} catch (error) {
|
|
62
|
+
showSnackbar?.(
|
|
63
|
+
error instanceof Error && error.message ? `Couldn't import: ${error.message}` : "Couldn't import that file.",
|
|
64
|
+
"error"
|
|
65
|
+
);
|
|
66
|
+
} finally {
|
|
67
|
+
setBusy(false);
|
|
68
|
+
input.value = "";
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const run = async (action, ok, failed) => {
|
|
72
|
+
setBusy(true);
|
|
73
|
+
try {
|
|
74
|
+
await action();
|
|
75
|
+
showSnackbar?.(ok, "success");
|
|
76
|
+
} catch {
|
|
77
|
+
showSnackbar?.(failed, "error");
|
|
78
|
+
} finally {
|
|
79
|
+
setBusy(false);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
return /* @__PURE__ */ jsxs(
|
|
83
|
+
ManagementCard,
|
|
84
|
+
{
|
|
85
|
+
title: "Workspace configuration",
|
|
86
|
+
description: "Move branding, assistant instructions, personalities and local knowledge documents between workspaces, or start again.",
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsxs(Stack, { spacing: 1.5, children: [
|
|
89
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "row", sx: { flexWrap: "wrap", gap: 1 }, children: [
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
Button,
|
|
92
|
+
{
|
|
93
|
+
variant: "outlined",
|
|
94
|
+
startIcon: /* @__PURE__ */ jsx(Download, {}),
|
|
95
|
+
disabled: busy,
|
|
96
|
+
onClick: () => void run(
|
|
97
|
+
onExport,
|
|
98
|
+
"Workspace configuration exported.",
|
|
99
|
+
"Couldn't export the configuration."
|
|
100
|
+
),
|
|
101
|
+
children: "Export"
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
Button,
|
|
106
|
+
{
|
|
107
|
+
variant: "outlined",
|
|
108
|
+
startIcon: /* @__PURE__ */ jsx(FileUp, {}),
|
|
109
|
+
disabled: busy,
|
|
110
|
+
onClick: () => pick("merge"),
|
|
111
|
+
children: "Import"
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
/* @__PURE__ */ jsx(
|
|
115
|
+
Button,
|
|
116
|
+
{
|
|
117
|
+
variant: "text",
|
|
118
|
+
color: "inherit",
|
|
119
|
+
disabled: busy,
|
|
120
|
+
onClick: () => setConfirmReplace(true),
|
|
121
|
+
children: "Replace everything\u2026"
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ jsx(
|
|
125
|
+
Button,
|
|
126
|
+
{
|
|
127
|
+
variant: "text",
|
|
128
|
+
color: "inherit",
|
|
129
|
+
startIcon: /* @__PURE__ */ jsx(RotateCcw, {}),
|
|
130
|
+
disabled: busy,
|
|
131
|
+
onClick: () => setConfirmReset(true),
|
|
132
|
+
children: "Reset to defaults\u2026"
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ jsx(
|
|
136
|
+
"input",
|
|
137
|
+
{
|
|
138
|
+
ref: inputRef,
|
|
139
|
+
type: "file",
|
|
140
|
+
accept: "application/json,.json",
|
|
141
|
+
hidden: true,
|
|
142
|
+
"aria-label": "Workspace configuration file",
|
|
143
|
+
onChange: (e) => void handleFile(e)
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
] }),
|
|
147
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Import adds what's in the file and replaces items with the same name; nothing is deleted. Replace everything also removes personalities and local documents the file doesn't list." })
|
|
148
|
+
] }),
|
|
149
|
+
/* @__PURE__ */ jsxs(Dialog, { open: confirmReplace, onClose: () => setConfirmReplace(false), children: [
|
|
150
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Replace everything from a file?" }),
|
|
151
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(DialogContentText, { children: "The file becomes the whole configuration for what it contains: personalities it doesn't list are deleted, and local knowledge documents are emptied before the file's are added. Branding and assistant instructions in the file overwrite the current ones. This can't be undone; export first if you may want to go back." }) }),
|
|
152
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
153
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => setConfirmReplace(false), children: "Cancel" }),
|
|
154
|
+
/* @__PURE__ */ jsx(
|
|
155
|
+
Button,
|
|
156
|
+
{
|
|
157
|
+
color: "error",
|
|
158
|
+
variant: "contained",
|
|
159
|
+
onClick: () => {
|
|
160
|
+
setConfirmReplace(false);
|
|
161
|
+
pick("replace");
|
|
162
|
+
},
|
|
163
|
+
children: "Choose file and replace"
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
] })
|
|
167
|
+
] }),
|
|
168
|
+
/* @__PURE__ */ jsxs(Dialog, { open: confirmReset, onClose: () => setConfirmReset(false), children: [
|
|
169
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Reset branding to defaults?" }),
|
|
170
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(DialogContentText, { children: "Name, logo and theme go back to this deployment's defaults. Assistant instructions, personalities and knowledge documents are not touched." }) }),
|
|
171
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
172
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => setConfirmReset(false), children: "Cancel" }),
|
|
173
|
+
/* @__PURE__ */ jsx(
|
|
174
|
+
Button,
|
|
175
|
+
{
|
|
176
|
+
color: "error",
|
|
177
|
+
variant: "contained",
|
|
178
|
+
onClick: () => {
|
|
179
|
+
setConfirmReset(false);
|
|
180
|
+
void run(
|
|
181
|
+
onReset,
|
|
182
|
+
"Branding reset to defaults.",
|
|
183
|
+
"Couldn't reset branding."
|
|
184
|
+
);
|
|
185
|
+
},
|
|
186
|
+
children: "Reset"
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] })
|
|
190
|
+
] })
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// src/management/components/AdvancedTab.tsx
|
|
197
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
198
|
+
var AdvancedTab = ({
|
|
199
|
+
packageSettings,
|
|
200
|
+
showProvider,
|
|
201
|
+
onExport,
|
|
202
|
+
onImport,
|
|
203
|
+
onReset,
|
|
204
|
+
showSnackbar
|
|
205
|
+
}) => /* @__PURE__ */ jsxs2(Stack2, { spacing: 2, children: [
|
|
206
|
+
showProvider && /* @__PURE__ */ jsx2(
|
|
207
|
+
ManagementCard,
|
|
208
|
+
{
|
|
209
|
+
title: "Model provider",
|
|
210
|
+
description: "The model service chat requests go to. Gateway is the default; OpenAI, Ollama and others are options.",
|
|
211
|
+
children: /* @__PURE__ */ jsx2(ProviderTab, {})
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
/* @__PURE__ */ jsx2(ServiceStatusCard, { packageSettings }),
|
|
215
|
+
/* @__PURE__ */ jsx2(
|
|
216
|
+
WorkspaceConfigCard,
|
|
217
|
+
{
|
|
218
|
+
onExport,
|
|
219
|
+
onImport,
|
|
220
|
+
onReset,
|
|
221
|
+
showSnackbar
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
] });
|
|
225
|
+
var AdvancedTab_default = AdvancedTab;
|
|
226
|
+
export {
|
|
227
|
+
AdvancedTab_default as default
|
|
228
|
+
};
|
|
229
|
+
//# sourceMappingURL=AdvancedTab-HZTDXFST.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/management/components/AdvancedTab.tsx","../src/management/components/WorkspaceConfigCard.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAOA,SAAS,SAAAA,cAAa;;;ACDtB,SAAgB,QAAQ,gBAAgB;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA8EC,SAGe,KAHf;AA1DD,IAAM,sBAA0D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,WA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
import "./chunk-2HFSBPOE.mjs";
|
|
6
|
+
import "./chunk-K7SQWDNF.mjs";
|
|
7
|
+
import "./chunk-S3DWWUBD.mjs";
|
|
8
|
+
import "./chunk-NI7BKLC7.mjs";
|
|
9
|
+
export {
|
|
10
|
+
CrewSection_default as default
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=CrewSection-YM26YD2N.mjs.map
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSISTANT_INSTRUCTIONS_LIMIT,
|
|
3
|
+
DEFAULT_ASSISTANT_INSTRUCTIONS,
|
|
4
|
+
useInstructionsStore
|
|
5
|
+
} from "./chunk-H2XUGGKV.mjs";
|
|
6
|
+
import {
|
|
7
|
+
ManagementCard
|
|
8
|
+
} from "./chunk-LY3O7UWA.mjs";
|
|
9
|
+
import {
|
|
10
|
+
useModelStore
|
|
11
|
+
} from "./chunk-5LXCZJLJ.mjs";
|
|
12
|
+
import "./chunk-KPT7NNNK.mjs";
|
|
13
|
+
import "./chunk-K7SQWDNF.mjs";
|
|
14
|
+
import "./chunk-NI7BKLC7.mjs";
|
|
15
|
+
|
|
16
|
+
// src/management/components/InstructionsTab.tsx
|
|
17
|
+
import { useEffect, useState } from "react";
|
|
18
|
+
import {
|
|
19
|
+
Alert,
|
|
20
|
+
Box,
|
|
21
|
+
Button,
|
|
22
|
+
Collapse,
|
|
23
|
+
Stack,
|
|
24
|
+
TextField,
|
|
25
|
+
Typography
|
|
26
|
+
} from "@mui/material";
|
|
27
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
+
var InstructionsTab = ({ showSnackbar }) => {
|
|
29
|
+
const hydrated = useInstructionsStore((state) => state.hydrated);
|
|
30
|
+
const saved = useInstructionsStore((state) => state.assistant);
|
|
31
|
+
const hydrate = useInstructionsStore((state) => state.hydrate);
|
|
32
|
+
const saveAssistantInstructions = useInstructionsStore(
|
|
33
|
+
(state) => state.saveAssistantInstructions
|
|
34
|
+
);
|
|
35
|
+
const migration = useInstructionsStore((state) => state.migration);
|
|
36
|
+
const activePersonality = useModelStore(
|
|
37
|
+
(state) => state.availableModels.find((m) => m.name === state.selectedModel)
|
|
38
|
+
);
|
|
39
|
+
const [draft, setDraft] = useState(saved);
|
|
40
|
+
const [saving, setSaving] = useState(false);
|
|
41
|
+
const [showDefault, setShowDefault] = useState(false);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!hydrated) void hydrate();
|
|
44
|
+
}, [hydrated, hydrate]);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
setDraft(saved);
|
|
47
|
+
}, [saved]);
|
|
48
|
+
const dirty = draft !== saved;
|
|
49
|
+
const over = draft.length > ASSISTANT_INSTRUCTIONS_LIMIT;
|
|
50
|
+
const legacyPrompt = activePersonality?.systemPrompt?.trim() ?? "";
|
|
51
|
+
const legacyInUse = !saved.trim() && legacyPrompt.length > 0 && legacyPrompt !== DEFAULT_ASSISTANT_INSTRUCTIONS.trim() && !migration?.from;
|
|
52
|
+
const save = async (text) => {
|
|
53
|
+
setSaving(true);
|
|
54
|
+
try {
|
|
55
|
+
const ok = await saveAssistantInstructions(text.trim());
|
|
56
|
+
showSnackbar?.(
|
|
57
|
+
ok ? text.trim() ? "Assistant instructions saved. They apply to everyone's next message." : "Assistant instructions cleared. Bandit's default voice is back." : "Couldn't save the instructions. Try again.",
|
|
58
|
+
ok ? "success" : "error"
|
|
59
|
+
);
|
|
60
|
+
} finally {
|
|
61
|
+
setSaving(false);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ jsx(Stack, { spacing: 2, sx: { maxWidth: 880 }, children: /* @__PURE__ */ jsx(
|
|
65
|
+
ManagementCard,
|
|
66
|
+
{
|
|
67
|
+
title: "Assistant instructions",
|
|
68
|
+
description: "How Bandit introduces itself and behaves for everyone here: its name, tone and standing rules. Each person's own Custom instructions are added after these.",
|
|
69
|
+
children: /* @__PURE__ */ jsxs(Stack, { spacing: 1.5, children: [
|
|
70
|
+
legacyInUse && /* @__PURE__ */ jsxs(
|
|
71
|
+
Alert,
|
|
72
|
+
{
|
|
73
|
+
severity: "info",
|
|
74
|
+
action: /* @__PURE__ */ jsx(
|
|
75
|
+
Button,
|
|
76
|
+
{
|
|
77
|
+
color: "inherit",
|
|
78
|
+
size: "small",
|
|
79
|
+
onClick: () => setDraft(legacyPrompt),
|
|
80
|
+
children: "Copy it here"
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
children: [
|
|
84
|
+
"Chats still use the prompt of the personality that was active before",
|
|
85
|
+
activePersonality?.name ? ` (${activePersonality.name})` : "",
|
|
86
|
+
". Copy it here to keep it, or write new instructions."
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
TextField,
|
|
92
|
+
{
|
|
93
|
+
label: "Instructions for everyone",
|
|
94
|
+
value: draft,
|
|
95
|
+
onChange: (e) => setDraft(e.target.value),
|
|
96
|
+
placeholder: "Leave empty to use Bandit's default voice. For example: You are the Acme assistant. Be concise and formal. Refer people to the IT desk for account problems.",
|
|
97
|
+
multiline: true,
|
|
98
|
+
minRows: 6,
|
|
99
|
+
maxRows: 24,
|
|
100
|
+
fullWidth: true,
|
|
101
|
+
disabled: !hydrated,
|
|
102
|
+
error: over,
|
|
103
|
+
inputProps: {
|
|
104
|
+
maxLength: Math.max(ASSISTANT_INSTRUCTIONS_LIMIT, draft.length)
|
|
105
|
+
},
|
|
106
|
+
helperText: over ? `Over the limit by ${(draft.length - ASSISTANT_INSTRUCTIONS_LIMIT).toLocaleString()} characters. Shorten it to keep adding.` : `${draft.length.toLocaleString()} / ${ASSISTANT_INSTRUCTIONS_LIMIT.toLocaleString()}`,
|
|
107
|
+
FormHelperTextProps: { sx: { textAlign: "right", mx: 0 } },
|
|
108
|
+
InputLabelProps: { shrink: true },
|
|
109
|
+
sx: { "& textarea": { lineHeight: 1.5 } }
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsxs(
|
|
113
|
+
Stack,
|
|
114
|
+
{
|
|
115
|
+
direction: { xs: "column-reverse", sm: "row" },
|
|
116
|
+
spacing: 1,
|
|
117
|
+
justifyContent: "space-between",
|
|
118
|
+
alignItems: { sm: "center" },
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ jsx(
|
|
121
|
+
Button,
|
|
122
|
+
{
|
|
123
|
+
variant: "text",
|
|
124
|
+
color: "inherit",
|
|
125
|
+
onClick: () => setShowDefault((v) => !v),
|
|
126
|
+
"aria-expanded": showDefault,
|
|
127
|
+
sx: { alignSelf: { xs: "flex-start", sm: "center" } },
|
|
128
|
+
children: showDefault ? "Hide Bandit's default voice" : "Show Bandit's default voice"
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsxs(Stack, { direction: { xs: "column-reverse", sm: "row" }, spacing: 1, children: [
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
Button,
|
|
134
|
+
{
|
|
135
|
+
variant: "text",
|
|
136
|
+
color: "inherit",
|
|
137
|
+
onClick: () => setDraft(saved),
|
|
138
|
+
disabled: !dirty || saving,
|
|
139
|
+
children: "Discard"
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
143
|
+
Button,
|
|
144
|
+
{
|
|
145
|
+
variant: "contained",
|
|
146
|
+
onClick: () => void save(draft),
|
|
147
|
+
disabled: !dirty || saving,
|
|
148
|
+
children: saving ? "Saving\u2026" : "Save instructions"
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
] })
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
/* @__PURE__ */ jsx(Collapse, { in: showDefault, children: /* @__PURE__ */ jsxs(
|
|
156
|
+
Box,
|
|
157
|
+
{
|
|
158
|
+
sx: (theme) => ({
|
|
159
|
+
p: 1.5,
|
|
160
|
+
borderRadius: `${Number(theme.shape.borderRadius)}px`,
|
|
161
|
+
border: `1px dashed ${theme.palette.divider}`,
|
|
162
|
+
bgcolor: theme.palette.bandit?.surface.subtle ?? "transparent"
|
|
163
|
+
}),
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", sx: { mb: 1 }, children: "What answers when this page is empty and a person has written no Custom instructions of their own." }),
|
|
166
|
+
/* @__PURE__ */ jsx(
|
|
167
|
+
Typography,
|
|
168
|
+
{
|
|
169
|
+
component: "pre",
|
|
170
|
+
variant: "body2",
|
|
171
|
+
sx: { whiteSpace: "pre-wrap", fontFamily: "inherit", m: 0, mb: 1.5 },
|
|
172
|
+
children: DEFAULT_ASSISTANT_INSTRUCTIONS
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
/* @__PURE__ */ jsx(
|
|
176
|
+
Button,
|
|
177
|
+
{
|
|
178
|
+
size: "small",
|
|
179
|
+
variant: "outlined",
|
|
180
|
+
onClick: () => setDraft(DEFAULT_ASSISTANT_INSTRUCTIONS),
|
|
181
|
+
children: "Start from the default"
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
) })
|
|
187
|
+
] })
|
|
188
|
+
}
|
|
189
|
+
) });
|
|
190
|
+
};
|
|
191
|
+
var InstructionsTab_default = InstructionsTab;
|
|
192
|
+
export {
|
|
193
|
+
InstructionsTab_default as default
|
|
194
|
+
};
|
|
195
|
+
//# sourceMappingURL=InstructionsTab-MKOGBQ5L.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/management/components/InstructionsTab.tsx"],"mappings":";;;;;;;;;;;;;;;;AAMA,SAAgB,WAAW,gBAAgB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgFK,SAGI,KAHJ;AA5DZ,IAAM,kBAAkD,CAAC,E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A,kBACL,SAAQ;AAAA,kBACR,SAAS,MAAM,SAAS,8BAA8B;AAAA,kBACvD;AAAA;AAAA,cAED;AAAA;AAAA;AAAA,QACF,GACF;AAAA,SACF;AAAA;AAAA,EACF,GACF;AAEJ;AAEA,IAAO,0BAAQ;","names":[]}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MemoryManager
|
|
3
|
+
} from "./chunk-FBLITVVY.mjs";
|
|
4
|
+
import {
|
|
5
|
+
CUSTOM_INSTRUCTIONS_LIMITS,
|
|
6
|
+
useInstructionsStore
|
|
7
|
+
} from "./chunk-H2XUGGKV.mjs";
|
|
8
|
+
import "./chunk-K4AO466X.mjs";
|
|
9
|
+
import {
|
|
10
|
+
ManagementCard
|
|
11
|
+
} from "./chunk-LY3O7UWA.mjs";
|
|
12
|
+
import "./chunk-Y272M3D5.mjs";
|
|
13
|
+
import "./chunk-LAH6UL3Q.mjs";
|
|
14
|
+
import "./chunk-5LXCZJLJ.mjs";
|
|
15
|
+
import "./chunk-KPT7NNNK.mjs";
|
|
16
|
+
import "./chunk-5URP2E5V.mjs";
|
|
17
|
+
import "./chunk-2HFSBPOE.mjs";
|
|
18
|
+
import "./chunk-K7SQWDNF.mjs";
|
|
19
|
+
import "./chunk-S3DWWUBD.mjs";
|
|
20
|
+
import "./chunk-NI7BKLC7.mjs";
|
|
21
|
+
|
|
22
|
+
// src/management/components/PersonalizationTab.tsx
|
|
23
|
+
import { useEffect, useState } from "react";
|
|
24
|
+
import { Box, Button, Stack, Switch, TextField, Typography } from "@mui/material";
|
|
25
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
26
|
+
var ABOUT_PLACEHOLDER = "Your work, your interests, the tools you use, how you like to be addressed. For example: I'm a nurse in Kansas City; I use Excel a lot; call me Mark.";
|
|
27
|
+
var STYLE_PLACEHOLDER = "Tone, length, format. For example: Keep answers short unless I ask for detail. Use bullet points for steps. No emojis.";
|
|
28
|
+
var countText = (value, limit) => `${value.length.toLocaleString()} / ${limit.toLocaleString()}`;
|
|
29
|
+
var PersonalizationTab = ({
|
|
30
|
+
preferences,
|
|
31
|
+
updatePreference,
|
|
32
|
+
showSnackbar
|
|
33
|
+
}) => {
|
|
34
|
+
const hydrated = useInstructionsStore((state) => state.hydrated);
|
|
35
|
+
const saved = useInstructionsStore((state) => state.custom);
|
|
36
|
+
const hydrate = useInstructionsStore((state) => state.hydrate);
|
|
37
|
+
const saveCustomInstructions = useInstructionsStore(
|
|
38
|
+
(state) => state.saveCustomInstructions
|
|
39
|
+
);
|
|
40
|
+
const [draft, setDraft] = useState(saved);
|
|
41
|
+
const [saving, setSaving] = useState(false);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!hydrated) void hydrate();
|
|
44
|
+
}, [hydrated, hydrate]);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
setDraft(saved);
|
|
47
|
+
}, [saved]);
|
|
48
|
+
const dirty = draft.about !== saved.about || draft.responseStyle !== saved.responseStyle;
|
|
49
|
+
const aboutOver = draft.about.length > CUSTOM_INSTRUCTIONS_LIMITS.about;
|
|
50
|
+
const styleOver = draft.responseStyle.length > CUSTOM_INSTRUCTIONS_LIMITS.responseStyle;
|
|
51
|
+
const save = async () => {
|
|
52
|
+
setSaving(true);
|
|
53
|
+
try {
|
|
54
|
+
const ok = await saveCustomInstructions({
|
|
55
|
+
about: draft.about.trim(),
|
|
56
|
+
responseStyle: draft.responseStyle.trim()
|
|
57
|
+
});
|
|
58
|
+
showSnackbar?.(
|
|
59
|
+
ok ? "Custom instructions saved. They apply to your next message." : "Couldn't save your instructions. Try again.",
|
|
60
|
+
ok ? "success" : "error"
|
|
61
|
+
);
|
|
62
|
+
} finally {
|
|
63
|
+
setSaving(false);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const fieldSx = { "& textarea": { lineHeight: 1.5 } };
|
|
67
|
+
return /* @__PURE__ */ jsxs(Stack, { spacing: 2, sx: { maxWidth: 880 }, children: [
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
ManagementCard,
|
|
70
|
+
{
|
|
71
|
+
title: "Custom instructions",
|
|
72
|
+
description: "Bandit reads these with every message you send. Keep them short and concrete; they add to whatever your workspace has set.",
|
|
73
|
+
children: /* @__PURE__ */ jsxs(Stack, { spacing: 2, children: [
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
TextField,
|
|
76
|
+
{
|
|
77
|
+
label: "What should Bandit know about you?",
|
|
78
|
+
value: draft.about,
|
|
79
|
+
onChange: (e) => setDraft({ ...draft, about: e.target.value }),
|
|
80
|
+
placeholder: ABOUT_PLACEHOLDER,
|
|
81
|
+
multiline: true,
|
|
82
|
+
minRows: 3,
|
|
83
|
+
maxRows: 10,
|
|
84
|
+
fullWidth: true,
|
|
85
|
+
disabled: !hydrated,
|
|
86
|
+
error: aboutOver,
|
|
87
|
+
inputProps: {
|
|
88
|
+
maxLength: Math.max(CUSTOM_INSTRUCTIONS_LIMITS.about, draft.about.length)
|
|
89
|
+
},
|
|
90
|
+
helperText: aboutOver ? `Over the limit by ${(draft.about.length - CUSTOM_INSTRUCTIONS_LIMITS.about).toLocaleString()} characters. Shorten it to keep adding.` : countText(draft.about, CUSTOM_INSTRUCTIONS_LIMITS.about),
|
|
91
|
+
FormHelperTextProps: { sx: { textAlign: "right", mx: 0 } },
|
|
92
|
+
InputLabelProps: { shrink: true },
|
|
93
|
+
sx: fieldSx
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ jsx(
|
|
97
|
+
TextField,
|
|
98
|
+
{
|
|
99
|
+
label: "How would you like Bandit to respond?",
|
|
100
|
+
value: draft.responseStyle,
|
|
101
|
+
onChange: (e) => setDraft({ ...draft, responseStyle: e.target.value }),
|
|
102
|
+
placeholder: STYLE_PLACEHOLDER,
|
|
103
|
+
multiline: true,
|
|
104
|
+
minRows: 3,
|
|
105
|
+
maxRows: 14,
|
|
106
|
+
fullWidth: true,
|
|
107
|
+
disabled: !hydrated,
|
|
108
|
+
error: styleOver,
|
|
109
|
+
inputProps: {
|
|
110
|
+
maxLength: Math.max(
|
|
111
|
+
CUSTOM_INSTRUCTIONS_LIMITS.responseStyle,
|
|
112
|
+
draft.responseStyle.length
|
|
113
|
+
)
|
|
114
|
+
},
|
|
115
|
+
helperText: styleOver ? `Over the limit by ${(draft.responseStyle.length - CUSTOM_INSTRUCTIONS_LIMITS.responseStyle).toLocaleString()} characters. This text was kept from your previous personality; shorten it to keep adding.` : countText(draft.responseStyle, CUSTOM_INSTRUCTIONS_LIMITS.responseStyle),
|
|
116
|
+
FormHelperTextProps: { sx: { textAlign: "right", mx: 0 } },
|
|
117
|
+
InputLabelProps: { shrink: true },
|
|
118
|
+
sx: fieldSx
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
/* @__PURE__ */ jsxs(
|
|
122
|
+
Stack,
|
|
123
|
+
{
|
|
124
|
+
direction: { xs: "column-reverse", sm: "row" },
|
|
125
|
+
spacing: 1,
|
|
126
|
+
justifyContent: "flex-end",
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsx(
|
|
129
|
+
Button,
|
|
130
|
+
{
|
|
131
|
+
variant: "text",
|
|
132
|
+
color: "inherit",
|
|
133
|
+
onClick: () => setDraft(saved),
|
|
134
|
+
disabled: !dirty || saving,
|
|
135
|
+
children: "Discard"
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ jsx(
|
|
139
|
+
Button,
|
|
140
|
+
{
|
|
141
|
+
variant: "contained",
|
|
142
|
+
onClick: () => void save(),
|
|
143
|
+
disabled: !dirty || saving,
|
|
144
|
+
children: saving ? "Saving\u2026" : "Save instructions"
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] })
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsx(
|
|
154
|
+
ManagementCard,
|
|
155
|
+
{
|
|
156
|
+
title: "Memory",
|
|
157
|
+
description: preferences.memoryEnabled ? "Bandit keeps facts you ask it to remember and notes it takes itself, and brings them into new chats when they help." : "Memory is off: Bandit won't save new memories or use the ones below. They stay here until you delete them.",
|
|
158
|
+
actions: /* @__PURE__ */ jsx(
|
|
159
|
+
Switch,
|
|
160
|
+
{
|
|
161
|
+
checked: preferences.memoryEnabled,
|
|
162
|
+
onChange: (e) => updatePreference("memoryEnabled", e.target.checked),
|
|
163
|
+
color: "primary",
|
|
164
|
+
slotProps: { input: { "aria-label": "Use memory" } }
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
children: /* @__PURE__ */ jsxs(Box, { sx: { mt: 0.5 }, children: [
|
|
168
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", sx: { fontWeight: 600, mb: 1 }, children: "What Bandit remembers" }),
|
|
169
|
+
/* @__PURE__ */ jsx(MemoryManager, { variant: "page", active: true })
|
|
170
|
+
] })
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
] });
|
|
174
|
+
};
|
|
175
|
+
var PersonalizationTab_default = PersonalizationTab;
|
|
176
|
+
export {
|
|
177
|
+
PersonalizationTab_default as default
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=PersonalizationTab-2XHFTYYW.mjs.map
|