Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Check a data move against the latest team workspace

Fei24113298e78fd7dc
diff --git a/app/src/main.mjs b/app/src/main.mjs
index f2c30147..0a084ab4 100644
--- a/app/src/main.mjs
+++ b/app/src/main.mjs
@@ -283,13 +283,19 @@ async function moveData(workspace) {
if (canceled || filePaths[0] === undefined) return false
const to = resolve(filePaths[0])
const dshHome = userDshHome()
- const problem = moveProblem({ from: places.dataDir, to, workspace, dshHome, program: app.isPackaged ? programFolder() : undefined })
- if (problem !== undefined) {
- await dialog.showMessageBox(owner, { type: 'warning', title: 'DeepSeek Bot', message: problem === 'dsh' ? t.inDsh(dshHome) : t[MOVE_PROBLEMS[problem]], buttons: ['OK'] })
+ // The team workspace can move while a dialog is open; the window tells the latest one.
+ const refused = async () => {
+ for (const current of new Set([workspace, places.workspace])) {
+ const problem = moveProblem({ from: places.dataDir, to, workspace: current, dshHome, program: app.isPackaged ? programFolder() : undefined })
+ if (problem === undefined) continue
+ await dialog.showMessageBox(owner, { type: 'warning', title: 'DeepSeek Bot', message: problem === 'dsh' ? t.inDsh(dshHome) : t[MOVE_PROBLEMS[problem]], buttons: ['OK'] })
+ return true
+ }
return false
}
+ if (await refused()) return false
const { response } = await dialog.showMessageBox(owner, { type: 'question', title: 'DeepSeek Bot', noLink: true, message: t.moveConfirm(to), detail: t.moveDetail(places.dataDir), buttons: [t.move, t.cancel], defaultId: 0, cancelId: 1 })
- if (response !== 0 || stopping) return false
+ if (response !== 0 || stopping || await refused()) return false
const signal = copyAbort.signal
copying = (async () => {
await stopHost()
@@ -304,7 +310,7 @@ async function moveData(workspace) {
try {
await copyData(places.dataDir, to, signal)
try {
- saveLocations({ dataDir: to, workspace })
+ saveLocations({ dataDir: to, workspace: places.workspace ?? workspace })
} catch (error) {
// Unused, the copy would only keep the folder from being chosen again.
await rm(to, { recursive: true, force: true, maxRetries: 5 }).catch((failure) => { console.error(failure) })
diff --git a/ds-bot/client.js b/ds-bot/client.js
index 4bfcda6b..40846d25 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -11568,16 +11568,22 @@ function LocationsSection({ actions, run }) {
const app = globalThis.dsBotApp;
const [team, setTeam] = (0, import_react31.useState)(null);
const [data, setData] = (0, import_react31.useState)(null);
+ const [moving, setMoving] = (0, import_react31.useState)(false);
(0, import_react31.useEffect)(() => {
void Promise.resolve(actions.folders()).then((info) => setTeam(info?.team ?? null)).catch(() => {
});
if (app !== void 0) void Promise.resolve(app.dataLocation()).then(setData).catch(() => {
});
}, []);
- const pickTeam = (path) => run(Promise.resolve(actions.setTeamWorkspace(path)).then((answer) => {
- setTeam(answer.team);
- app?.teamWorkspaceChanged(answer.team);
- }));
+ const pickTeam = (path) => {
+ setMoving(true);
+ return run(Promise.resolve(actions.setTeamWorkspace(path)).then((answer) => {
+ setTeam(answer.team);
+ app?.teamWorkspaceChanged(answer.team);
+ }).finally(() => {
+ setMoving(false);
+ }));
+ };
return (0, import_react31.createElement)(
SetSection,
{ title: t("Locations"), className: "bt-set-places" },
@@ -11589,7 +11595,7 @@ function LocationsSection({ actions, run }) {
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", 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: () => run(app.moveData(team ?? void 0)) }, t("Change…"))
)
);
}
diff --git a/ds-bot/src/client/settings.js b/ds-bot/src/client/settings.js
index 1cce7bd4..d195db5d 100644
--- a/ds-bot/src/client/settings.js
+++ b/ds-bot/src/client/settings.js
@@ -76,19 +76,24 @@ function LocationsSection({ actions, run }) {
const app = globalThis.dsBotApp
const [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.
+ const [moving, setMoving] = useState(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 => run(Promise.resolve(actions.setTeamWorkspace(path)).then((answer) => {
- setTeam(answer.team)
- app?.teamWorkspaceChanged(answer.team)
- }))
+ const pickTeam = (path) => {
+ setMoving(true)
+ return run(Promise.resolve(actions.setTeamWorkspace(path)).then((answer) => {
+ setTeam(answer.team)
+ app?.teamWorkspaceChanged(answer.team)
+ }).finally(() => { 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 })),
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', onClick: () => run(app.moveData(team ?? undefined)) }, t('Change…'))))
+ data.fixed ? null : h('button', { type: 'button', className: 'bt-soft bt-soft-sm', disabled: moving, onClick: () => run(app.moveData(team ?? undefined)) }, t('Change…'))))
}
// The first Main Bot is the sidebar tile. Picking another Bot there hands it the role