A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Keep the pause affordance a button and count a first relay
Fei2411d3c545739894
diff --git a/ds-bot/client.js b/ds-bot/client.jsindex b51099a7..d019146b 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -2982,9 +2982,10 @@ var CONVERSATION_CSS = `.bt-think-text[data-fade=both]{mask-image:linear-gradient(to bottom,transparent,#000 18px,#000 calc(100% - 18px),transparent)}.bt-event{display:flex;justify-content:center;align-items:center;gap:2px;min-height:24px;margin:2px 0;font-size:12px;line-height:16px;color:var(--bt-ink-2);flex-wrap:wrap}.bt-event>span{padding:0 2px}-.bt-event button{border:0;background:none;color:inherit;font:inherit;display:inline-flex;align-items:center;gap:4px;cursor:pointer;height:24px;padding:4px 6px 4px 4px;border-radius:999px;box-sizing:border-box;transition:background-color .12s ease}-.bt-event button:hover{background:var(--bt-hover)}-.bt-event button:active{background:var(--bt-active)}+.bt-event button:not(.bt-soft){border:0;background:none;color:inherit;font:inherit;display:inline-flex;align-items:center;gap:4px;cursor:pointer;height:24px;padding:4px 6px 4px 4px;border-radius:999px;box-sizing:border-box;transition:background-color .12s ease}+.bt-event button:not(.bt-soft):hover{background:var(--bt-hover)}+.bt-event button:not(.bt-soft):active{background:var(--bt-active)}+.bt-event .bt-soft{margin-left:6px}.bt-event button.bt-event-whole{min-width:0;max-width:100%;padding:4px 6px 4px 8px}.bt-event-whole>*{flex:none}.bt-event-whole>span:first-child{margin-right:2px}@@ -9638,6 +9639,7 @@ label.bt-bs-row{cursor:text}.bt-bs-input:hover{background:var(--bt-hover)}.bt-bs-input:focus{background:var(--bt-main);border-color:var(--bt-line-2);text-align:left}.bt-bs-input::placeholder{color:var(--bt-ink-3)}+.bt-bs-input.bt-bs-num{flex:0 0 72px;min-width:0}.bt-bs-stack{flex-direction:column;align-items:stretch;gap:8px}.bt-bs-area{flex:none;width:auto;min-height:112px;height:auto;margin:0 -6px -4px;padding:8px;line-height:19px;text-align:left;resize:vertical;background:var(--bt-hover)}.bt-bs-area:hover{background:var(--bt-active)}@@ -10509,7 +10511,7 @@ function RelayLimitRow({ room: room2, update }) {Row,{ label: t("Pause Bot relays after"), hint: t("Counted since your last message in this group.") },(0, import_react27.createElement)("input", {- className: "bt-bs-input",+ className: "bt-bs-input bt-bs-num",type: "number",min: 1,max: 200,diff --git a/ds-bot/src/client/bot-settings.js b/ds-bot/src/client/bot-settings.jsindex d7b3ed25..21d287c5 100644--- a/ds-bot/src/client/bot-settings.js+++ b/ds-bot/src/client/bot-settings.js@@ -273,6 +273,7 @@ label.bt-bs-row{cursor:text}.bt-bs-input:hover{background:var(--bt-hover)}.bt-bs-input:focus{background:var(--bt-main);border-color:var(--bt-line-2);text-align:left}.bt-bs-input::placeholder{color:var(--bt-ink-3)}+.bt-bs-input.bt-bs-num{flex:0 0 72px;min-width:0}.bt-bs-stack{flex-direction:column;align-items:stretch;gap:8px}.bt-bs-area{flex:none;width:auto;min-height:112px;height:auto;margin:0 -6px -4px;padding:8px;line-height:19px;text-align:left;resize:vertical;background:var(--bt-hover)}.bt-bs-area:hover{background:var(--bt-active)}diff --git a/ds-bot/src/client/group-settings.js b/ds-bot/src/client/group-settings.jsindex 76c78b95..e1ff07ce 100644--- a/ds-bot/src/client/group-settings.js+++ b/ds-bot/src/client/group-settings.js@@ -39,7 +39,7 @@ function RelayLimitRow({ room, update }) {}return h(Row, { label: t('Pause Bot relays after'), hint: t('Counted since your last message in this group.') },h('input', {- className: 'bt-bs-input', type: 'number', min: 1, max: 200,+ className: 'bt-bs-input bt-bs-num', type: 'number', min: 1, max: 200,placeholder: String(room.relayLimitDefault ?? ''), value: draft,'aria-label': t('Pause Bot relays after'),onChange: event => setDraft(event.target.value),diff --git a/ds-bot/src/client/styles.js b/ds-bot/src/client/styles.jsindex cc67419d..e7c5ee1a 100644--- a/ds-bot/src/client/styles.js+++ b/ds-bot/src/client/styles.js@@ -823,9 +823,10 @@ export const CONVERSATION_CSS = `.bt-think-text[data-fade=both]{mask-image:linear-gradient(to bottom,transparent,#000 18px,#000 calc(100% - 18px),transparent)}.bt-event{display:flex;justify-content:center;align-items:center;gap:2px;min-height:24px;margin:2px 0;font-size:12px;line-height:16px;color:var(--bt-ink-2);flex-wrap:wrap}.bt-event>span{padding:0 2px}-.bt-event button{border:0;background:none;color:inherit;font:inherit;display:inline-flex;align-items:center;gap:4px;cursor:pointer;height:24px;padding:4px 6px 4px 4px;border-radius:999px;box-sizing:border-box;transition:background-color .12s ease}-.bt-event button:hover{background:var(--bt-hover)}-.bt-event button:active{background:var(--bt-active)}+.bt-event button:not(.bt-soft){border:0;background:none;color:inherit;font:inherit;display:inline-flex;align-items:center;gap:4px;cursor:pointer;height:24px;padding:4px 6px 4px 4px;border-radius:999px;box-sizing:border-box;transition:background-color .12s ease}+.bt-event button:not(.bt-soft):hover{background:var(--bt-hover)}+.bt-event button:not(.bt-soft):active{background:var(--bt-active)}+.bt-event .bt-soft{margin-left:6px}.bt-event button.bt-event-whole{min-width:0;max-width:100%;padding:4px 6px 4px 8px}.bt-event-whole>*{flex:none}.bt-event-whole>span:first-child{margin-right:2px}diff --git a/ds-bot/src/host/groups.js b/ds-bot/src/host/groups.jsindex 48c4962c..223913d8 100644--- a/ds-bot/src/host/groups.js+++ b/ds-bot/src/host/groups.js@@ -478,7 +478,7 @@ export function install(rt) {if (!(round.parked ??= []).includes(slot.name)) round.parked.push(slot.name)continue}- room.relays += 1+ room.relays = (room.relays ?? 0) + 1}slot.status = 'speaking'round.speaking = member.iddiff --git a/ds-bot/test/rounds.test.js b/ds-bot/test/rounds.test.jsindex e82f542e..0b38aa40 100644--- a/ds-bot/test/rounds.test.js+++ b/ds-bot/test/rounds.test.js@@ -811,6 +811,34 @@ test('a user message mid-round restarts the relay count for the calls after it',assert.equal(state.relays, 1)})+// A group the user has not written in since the limit came in carries no count at+// all: a Bot's own post must count from zero, not from NaN, and still park.+test('a round a Bot opens counts relays from nothing, and parks past the limit', async (t) => {+ const { call, emit, relay, answer, stop, sent, rt, ctx, home } = start()+ t.after(stop)+ const room = await team(call, sent)+ await call('update-room', { id: room.id, mode: 'admin', relayLimit: 1 })+ const state = rt.state.rooms[room.id]+ const chief = rt.state.mainBotIds[0]+ assert.equal(state.relays, undefined, 'no user message ever: there is no count yet')++ sent.length = 0+ const posted = await ctx.registeredTools.get('post_to_group').execute({ group: 'R1', message: '@Writer ping' }, { agent: { id: rt.chatOf(chief) } })+ assert.match(posted, /^Posted in "R1"/)+ const post = sent.find(entry => entry.sessionId === room.id && entry.message.source.role === 'post')+ assert.ok(post, 'the Bot\'s post reached the group Session')+ await emit(room.id, { type: 'user/message', data: { source: post.message.source, content: post.message.content } })+ const running = relay(room.id, 'relay')+ const first = await turnFor(sent)+ await answer(first.sessionId, first.message.source.exchangeId, '@Chief back', 1)+ await running+ // The first call ran as relay 1; the call it made is over the limit and parked.+ assert.equal(state.relays, 1)+ assert.deepEqual(state.paused.map(entry => entry.name), ['Chief'])+ const saved = JSON.parse(readFileSync(join(home, 'state.json'), 'utf8')).rooms[room.id]+ assert.equal(saved.relays, 1, 'a whole number is saved, not NaN')+})+test('the relay limit is the user\'s to set, not a member\'s', async (t) => {const { call, stop, rt } = start()t.after(stop)