A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Narrow a Bot's schedule list even for a page DSH would refuse
Fei2411e70f0122156d
diff --git a/ds-bot/src/host/schedules.js b/ds-bot/src/host/schedules.jsindex ea1dabeb..fad108c9 100644--- a/ds-bot/src/host/schedules.js+++ b/ds-bot/src/host/schedules.js@@ -216,12 +216,17 @@ export function install(rt) {const asked = exec.arguments ?? {}const limit = asked.limit ?? LIST_PAGEconst offset = asked.offset ?? 0- // An invalid page gets DSH's own input error.- if (!Number.isSafeInteger(limit) || limit < 1 || limit > LIST_READ_LIMIT || !Number.isSafeInteger(offset) || offset < 0) return next()const mine = entry => {const target = sessionOf(entry)return target !== undefined && sameOwner(own, ownerOf(target))}+ // An invalid page gets DSH's own input error; a page it accepts anyway is still narrowed.+ if (!Number.isSafeInteger(limit) || limit < 1 || limit > LIST_READ_LIMIT || !Number.isSafeInteger(offset) || offset < 0) {+ const result = await next()+ if (result.isError || !Array.isArray(result.value?.items)) return result+ const items = result.value.items.filter(mine)+ return { ...result, value: { ...result.value, items, shown: items.length } }+ }const pool = (await service.catalog()).filter(entry => asked.active === undefined || (entry.status === 'active') === asked.active)const positions = pool.flatMap((entry, at) => (mine(entry) ? [at] : []))const page = positions.slice(offset, offset + limit)diff --git a/ds-bot/test/schedules.test.js b/ds-bot/test/schedules.test.jsindex 381d6ea2..17035045 100644--- a/ds-bot/test/schedules.test.js+++ b/ds-bot/test/schedules.test.js@@ -244,6 +244,10 @@ test('on DSH 0.2.2 a Bot reads and changes only the tasks of its own chat', asynassert.deepEqual(asked.at(-1), { limit: 4, offset: 0 })assert.deepEqual(both.result.value.items.map(task => task.id), ['own', 'own2'])assert.deepEqual((await run('w2', { offset: 5 })).result.value, { items: [], shown: 0, total: 2, limit: 100, offset: 5 })+ // A page out of DSH's range goes to DSH as asked, and what comes back is still narrowed.+ const wide = await run('w2', { limit: 501 })+ assert.deepEqual(asked.at(-1), { limit: 501 })+ assert.deepEqual(wide.result.value.items.map(task => task.id), ['own', 'own2'])assert.deepEqual((await run('m1', {})).result.value.items.map(task => task.id), ['chief'])assert.equal((await run('outside', {})).result.value.items.length, 4)})