Skip to content

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

Stop the first run when the app quits during a copy dialog

Fei24119394a40848f9
diff --git a/app/src/import.mjs b/app/src/import.mjs
index 68cb5921..deaab31d 100644
--- a/app/src/import.mjs
+++ b/app/src/import.mjs
@@ -163,7 +163,7 @@ export async function importTeam({ from, to, workspace, profile, dsh, signal })
if (found === undefined) throw new Error(`There is no Bot team in ${from}`)
const present = existsSync(join(to, 'bot', 'state.json')) ? readJson(join(to, 'bot', 'state.json')) : undefined
if (Object.keys(present?.bots ?? {}).length > 0) throw new Error(`${to} already has a Bot team`)
- for (const name of readdirSync(to).filter(entry => /^\.import-\d+$/u.test(entry))) {
+ for (const name of (existsSync(to) ? readdirSync(to) : []).filter(entry => /^\.import-\d+$/u.test(entry))) {
await rm(join(to, name), { recursive: true, force: true })
}
const stage = join(to, `.import-${String(Date.now())}`)
diff --git a/app/src/main.mjs b/app/src/main.mjs
index 612b206f..2d6dd374 100644
--- a/app/src/main.mjs
+++ b/app/src/main.mjs
@@ -166,7 +166,8 @@ async function copyTeam(where, newHost, newCheck, signal) {
if (signal.aborted) return 'stopped'
if (unreadable > 0) {
const t = text()
- const { response } = await dialog.showMessageBox({ type: 'warning', title: 'DeepSeek Bot', noLink: true, message: t.newer(unreadable), buttons: [t.quit, t.startEmpty], defaultId: 0, cancelId: 0 })
+ const { response } = await dialog.showMessageBox({ type: 'warning', title: 'DeepSeek Bot', noLink: true, message: t.newer(unreadable), buttons: [t.quit, t.startEmpty], defaultId: 0, cancelId: 0, signal })
+ if (signal.aborted) return 'stopped'
if (response === 0) return 'quit'
saveLocations(where)
return undefined
@@ -186,7 +187,8 @@ async function copyTeam(where, newHost, newCheck, signal) {
} catch (error) {
if (signal.aborted) return 'stopped'
console.error(error)
- await dialog.showMessageBox({ type: 'warning', title: 'DeepSeek Bot', message: text().failed(error instanceof Error ? error.message : String(error)) })
+ await dialog.showMessageBox({ type: 'warning', title: 'DeepSeek Bot', message: text().failed(error instanceof Error ? error.message : String(error)), signal })
+ if (signal.aborted) return 'stopped'
} finally {
signal.removeEventListener('abort', stopWarm)
mainWindow?.setProgressBar(-1)