A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Change the team workspace one request at a time
Fei241156f3574f9972
diff --git a/ds-bot/client.js b/ds-bot/client.jsindex 40846d25..70a0f3d1 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -7239,7 +7239,7 @@ var import_react15 = require("react");var import_react_dom7 = require("react-dom");var folderName = (path) => String(path).replace(/[\\/]+$/, "").split(/[\\/]/).pop() || String(path);var Tick = ({ on }) => (0, import_react15.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, on ? (0, import_react15.createElement)(CheckIcon) : null);-function FolderMenu({ value, group = false, team = false, actions, run, onPick, wide = false }) {+function FolderMenu({ value, group = false, team = false, actions, run, onPick, wide = false, disabled = false }) {const { isOpen, shownPlace, leaving, button, menu, open, close } = useAnchoredMenu();const [info, setInfo] = (0, import_react15.useState)(null);const [view, setView] = (0, import_react15.useState)("list");@@ -7355,7 +7355,8 @@ function FolderMenu({ value, group = false, team = false, actions, run, onPick,"aria-expanded": isOpen,"aria-label": team ? t("Team workspace: {folder}", { folder: value ?? "" }) : t("Working folder: {folder}", { folder: value ?? fallback }),title: value,- onClick: toggle+ onClick: toggle,+ disabled},(0, import_react15.createElement)("span",@@ -7384,6 +7385,7 @@ var FOLDER_CSS = `.bt-folder-input:focus{border-color:var(--bt-accent)}.bt-menu .bt-folder-use{justify-content:center;font-weight:500;color:var(--bt-accent)}.bt-menu .bt-folder-use:disabled{color:var(--bt-ink-3);cursor:default;background:none}+.bt-model-trigger:disabled{opacity:.6;cursor:default}.bt-folder-error{padding:4px 8px;font-size:12px;line-height:16px;color:var(--bt-danger);overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){.bt-folder-view{animation:none}}`;@@ -11569,6 +11571,7 @@ function LocationsSection({ actions, run }) {const [team, setTeam] = (0, import_react31.useState)(null);const [data, setData] = (0, import_react31.useState)(null);const [moving, setMoving] = (0, import_react31.useState)(false);+ const busy = (0, import_react31.useRef)(false);(0, import_react31.useEffect)(() => {void Promise.resolve(actions.folders()).then((info) => setTeam(info?.team ?? null)).catch(() => {});@@ -11576,11 +11579,14 @@ function LocationsSection({ actions, run }) {});}, []);const pickTeam = (path) => {+ if (busy.current) return void 0;+ busy.current = true;setMoving(true);return run(Promise.resolve(actions.setTeamWorkspace(path)).then((answer) => {setTeam(answer.team);app?.teamWorkspaceChanged(answer.team);}).finally(() => {+ busy.current = false;setMoving(false);}));};@@ -11590,12 +11596,14 @@ function LocationsSection({ actions, run }) {(0, import_react31.createElement)(SetRow,{ label: t("Team workspace"), hint: t("Where Bots without a folder of their own work.") },- team === null ? null : (0, import_react31.createElement)(FolderMenu, { value: team, team: true, actions, run, onPick: pickTeam })+ team === null ? null : (0, import_react31.createElement)(FolderMenu, { value: team, team: true, actions, run, onPick: pickTeam, disabled: moving })),data === null ? null : (0, import_react31.createElement)(SetRow,{ label: t("Data location"), hint: data.path },- data.fixed ? null : (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: moving, onClick: () => run(app.moveData(team ?? void 0)) }, t("Change…"))+ data.fixed ? null : (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: moving, onClick: () => {+ if (!busy.current) void run(app.moveData(team ?? void 0));+ } }, t("Change…"))));}diff --git a/ds-bot/src/client/folder-menu.js b/ds-bot/src/client/folder-menu.jsindex ca40ad29..c7213862 100644--- a/ds-bot/src/client/folder-menu.js+++ b/ds-bot/src/client/folder-menu.js@@ -13,7 +13,7 @@ const Tick = ({ on }) => h('span', { className: 'bt-model-tick', 'aria-hidden':// one a Bot works in the team workspace and a group member in its own folder. `onPick`// gets the chosen path, or '' for that default. `team` is the menu for the team workspace// itself, which has no default.-export function FolderMenu({ value, group = false, team = false, actions, run, onPick, wide = false }) {+export function FolderMenu({ value, group = false, team = false, actions, run, onPick, wide = false, disabled = false }) {const { isOpen, shownPlace, leaving, button, menu, open, close } = useAnchoredMenu()const [info, setInfo] = useState(null)const [view, setView] = useState('list')@@ -84,7 +84,7 @@ export function FolderMenu({ value, group = false, team = false, actions, run, oh('button', {ref: button, type: 'button', className: 'bt-model-trigger', 'data-wide': wide || undefined,'aria-haspopup': 'menu', 'aria-expanded': isOpen, 'aria-label': team ? t('Team workspace: {folder}', { folder: value ?? '' }) : t('Working folder: {folder}', { folder: value ?? fallback }),- title: value, onClick: toggle,+ title: value, onClick: toggle, disabled,},h('span', { className: 'bt-model-copy' },h('span', { className: 'bt-model-name' }, value ? folderName(value) : fallback),@@ -106,6 +106,7 @@ export const FOLDER_CSS = `.bt-folder-input:focus{border-color:var(--bt-accent)}.bt-menu .bt-folder-use{justify-content:center;font-weight:500;color:var(--bt-accent)}.bt-menu .bt-folder-use:disabled{color:var(--bt-ink-3);cursor:default;background:none}+.bt-model-trigger:disabled{opacity:.6;cursor:default}.bt-folder-error{padding:4px 8px;font-size:12px;line-height:16px;color:var(--bt-danger);overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){.bt-folder-view{animation:none}}`diff --git a/ds-bot/src/client/settings.js b/ds-bot/src/client/settings.jsindex d195db5d..4ccd8589 100644--- a/ds-bot/src/client/settings.js+++ b/ds-bot/src/client/settings.js@@ -76,24 +76,31 @@ function LocationsSection({ actions, run }) {const app = globalThis.dsBotAppconst [team, setTeam] = useState(null)const [data, setData] = useState(null)- // One change at a time: the data move checks the new folder against the team workspace.+ // One change at a time: the data move checks the new folder against the team workspace, and+ // a later team workspace must not finish before an earlier one.const [moving, setMoving] = useState(false)+ const busy = useRef(false)useEffect(() => {void Promise.resolve(actions.folders()).then(info => setTeam(info?.team ?? null)).catch(() => {})if (app !== undefined) void Promise.resolve(app.dataLocation()).then(setData).catch(() => {})}, [])const pickTeam = (path) => {+ if (busy.current) return undefined+ busy.current = truesetMoving(true)return run(Promise.resolve(actions.setTeamWorkspace(path)).then((answer) => {setTeam(answer.team)app?.teamWorkspaceChanged(answer.team)- }).finally(() => { setMoving(false) }))+ }).finally(() => {+ busy.current = false+ setMoving(false)+ }))}return h(SetSection, { title: t('Locations'), className: 'bt-set-places' },h(SetRow, { label: t('Team workspace'), hint: t('Where Bots without a folder of their own work.') },- team === null ? null : h(FolderMenu, { value: team, team: true, actions, run, onPick: pickTeam })),+ team === null ? null : h(FolderMenu, { value: team, team: true, actions, run, onPick: pickTeam, disabled: moving })),data === null ? null : h(SetRow, { label: t('Data location'), hint: data.path },- data.fixed ? null : h('button', { type: 'button', className: 'bt-soft bt-soft-sm', disabled: moving, onClick: () => run(app.moveData(team ?? undefined)) }, t('Change…'))))+ data.fixed ? null : h('button', { type: 'button', className: 'bt-soft bt-soft-sm', disabled: moving, onClick: () => { if (!busy.current) void run(app.moveData(team ?? undefined)) } }, t('Change…'))))}// The first Main Bot is the sidebar tile. Picking another Bot there hands it the role