Skip to content

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

Count only a Bot's own tasks in a wide schedule page

Fei2411069864445b40
diff --git a/ds-bot/src/host/schedules.js b/ds-bot/src/host/schedules.js
index fad108c9..9c3aaec6 100644
--- a/ds-bot/src/host/schedules.js
+++ b/ds-bot/src/host/schedules.js
@@ -225,7 +225,8 @@ export function install(rt) {
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 total = (await service.catalog()).filter(entry => mine(entry) && (asked.active === undefined || (entry.status === 'active') === asked.active)).length
+ return { ...result, value: { ...result.value, items, shown: items.length, total } }
}
const pool = (await service.catalog()).filter(entry => asked.active === undefined || (entry.status === 'active') === asked.active)
const positions = pool.flatMap((entry, at) => (mine(entry) ? [at] : []))
diff --git a/ds-bot/test/schedules.test.js b/ds-bot/test/schedules.test.js
index 17035045..4680ca5b 100644
--- a/ds-bot/test/schedules.test.js
+++ b/ds-bot/test/schedules.test.js
@@ -248,6 +248,7 @@ test('on DSH 0.2.2 a Bot reads and changes only the tasks of its own chat', asyn
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.equal(wide.result.value.total, 2)
assert.deepEqual((await run('m1', {})).result.value.items.map(task => task.id), ['chief'])
assert.equal((await run('outside', {})).result.value.items.length, 4)
})