A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Refuse the default team workspace when it holds the data itself
Fei24113f5099dad9d6
diff --git a/ds-bot/src/host/folders.js b/ds-bot/src/host/folders.jsindex 91f5e575..5c2b3c7f 100644--- a/ds-bot/src/host/folders.js+++ b/ds-bot/src/host/folders.js@@ -94,15 +94,14 @@ export function install(rt) {const text = unquote(input)const expanded = expandHome(text)if (text === '' || !isAbsolute(expanded)) throw new Error(`Give the full path of the folder, not ${text}`)- // The plugin's own default lies in DSH's data, and going back to it stays possible.+ // The plugin's own default lies in DSH's data, and going back to it stays possible, as long+ // as it holds none of the data itself (a link put in its place could).const fallback = resolve(defaultTeamFolder())const holdsData = async (path) => {+ const roots = await Promise.all([rt.dshHome, rt.home].map(real))+ if (roots.some(data => within(data, path))) return trueif (path === fallback || path === await real(fallback)) return false- for (const root of [rt.dshHome, rt.home]) {- const data = await real(root)- if (within(path, data) || within(data, path)) return true- }- return false+ return roots.some(data => within(path, data))}// A folder to be made counts where it would be made: a link above it can lead into the data.if (await holdsData(await realBeyond(resolve(expanded)))) throw new Error(`${text} holds DeepSeek Harness data, so it cannot be the team workspace`)diff --git a/ds-bot/test/work-dir.test.js b/ds-bot/test/work-dir.test.jsindex 0880e35f..b5fac2bd 100644--- a/ds-bot/test/work-dir.test.js+++ b/ds-bot/test/work-dir.test.js@@ -607,6 +607,12 @@ test('the team workspace holds no DeepSeek Harness data, apart from the plugin\'await call('team-workspace', { path: join(root, 'moved') })assert.deepEqual((await call('team-workspace', { path: join(home, 'workspace') })).value, { team })assert.equal(state().workspaceId, 'w1')+ // The default replaced by a link to the data is the data, and is refused.+ await call('team-workspace', { path: join(root, 'moved') })+ rmSync(team, { recursive: true, force: true })+ symlinkSync(home, team, process.platform === 'win32' ? 'junction' : 'dir')+ assert.match(await error(team), /holds DeepSeek Harness data/)+ assert.equal(state().workspaceId, 'w-new')})test('a team folder that was deleted is made again before DSH checks it', async (t) => {