Skip to content

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

Remove the relay limit that paused group chats

Fei2411a792ce4a2d56
diff --git a/docs/plans/2026-10-07-group-chat.md b/docs/plans/2026-10-07-group-chat.md
index 11044e2a..f3771049 100644
--- a/docs/plans/2026-10-07-group-chat.md
+++ b/docs/plans/2026-10-07-group-chat.md
@@ -22,7 +22,7 @@
- 没有管理员的群按「全员轮流」回答。
- `@名字` 只叫被点名的成员。`@all`、`@everyone`、`@所有人`、`@全体` 叫全员;成员回复里的这几个词只有管理员说才算,防止成员互相叫起一大片。
- 成员按顺序发言:上一个人发完(或跳过)下一个人才开始,每个人看到本轮之前所有人的发言和自己的位置。
-- 回复里 `@` 了别人,被点的人接着说(接力)。每人每轮、每轮总数都没有上限;用户的消息一定有人回应,发过言就从零重新计数。唯一的上限是用户上次在群里发言之后 Bot 之间的接力次数:到群的上限(默认成员数 ×3,可在群设置里改)时群暂停,还在等的叫人不丢,群里留一行说明;用户点「继续」或再发一句就接着跑。
+- 回复里 `@` 了别人,被点的人接着说(接力)。接力次数、每人每轮、每轮总数都没有上限;用户的消息一定有人回应。要停下群里的工作,用户在群详情里点「全部停止」或逐个停。
- 每个成员可以跳过(`[PASS]`),不必每轮都说话。
### 提及
@@ -43,7 +43,7 @@
- 成员在群里接到需要干活的任务时,第一次调用工具后 15 秒仍在干活,本轮就继续往下走,不再等它。
- 干活过程中,它说的第一句话和带 `@` 的话立刻发到群里;间隔不到 30 秒的几句合并成一条发。最后的结果由派活的 Bot(管理员或叫它的成员)接话。
-- 本轮结束后才完成的回复照样发进群,它叫的人计入同一条 Bot 接力计数,到上限一样暂停。
+- 本轮结束后才完成的回复照样发进群,它叫的人照样接着说。
- 回答超时只在成员的会话完全没有动静时计时(4 分钟)。没及时回应、需要审批的成员各在群里留一行淡色事件,让用户知道发生了什么。
### 审批与状态
@@ -89,3 +89,4 @@
- 2026-10-18:其他成员也能往自己所在的群发帖,只叫 `@` 点到的成员(#198)。
- 2026-10-22:去掉群里每人每轮、每轮总数和迟到 10 次的上限;Bot 之间接力到群的上限时暂停,用户点「继续」或发言后接着跑,用户的 @ 一定有人回应(#395)。
- 2026-10-29:群的停止按钮一次停掉本群的一轮和所有成员在本群的工作,放在群详情的成员列表标题旁,不放在状态胶囊旁(#592,PR #616)。
+- 2026-10-30:去掉 Bot 之间接力的上限、群设置里的这一项和「继续」按钮;以前停在上限的叫人在群的下一轮接着跑(#655)。
diff --git a/docs/plans/2026-10-16-bot-handoffs.md b/docs/plans/2026-10-16-bot-handoffs.md
index d02f569b..93d522bd 100644
--- a/docs/plans/2026-10-16-bot-handoffs.md
+++ b/docs/plans/2026-10-16-bot-handoffs.md
@@ -100,7 +100,7 @@ Bot 之间派活原来按数量拦,不看对方的状态:
### 去掉的上限
- 消息链 6 跳、对方 10 条未读、Bot 在一个群里最多发起 3 轮、用户上次发言后全团队 40 条,都去掉,不留兜底。
-- 群聊按接力暂停的规则(见群聊):用户上次发言后 Bot 之间接力到群的上限时暂停,用户点「继续」或发言后接着跑。
+- 群里 Bot 之间接力的上限也去掉了(见群聊)。
### 规则文字
diff --git a/docs/plans/2026-10-24-mobile-app.md b/docs/plans/2026-10-24-mobile-app.md
index cffd3db1..d901e061 100644
--- a/docs/plans/2026-10-24-mobile-app.md
+++ b/docs/plans/2026-10-24-mobile-app.md
@@ -44,7 +44,7 @@
| 电脑列表 | 已配对的电脑、在线状态、重新配对 |
| 团队 | Bot 和群的列表、搜索、未读;「需要你」:所有等你处理的审批、提问、卡片 |
| 私聊 | 消息、图片、更早的记录、Side chat、停止 Bot 的工作 |
-| 群聊 | 消息、进度;群暂停后让它继续 |
+| 群聊 | 消息、进度;停下群里的工作 |
| 审批、提问、卡片 | 选项和桌面一样;卡片能填、能回复 |
| Bot 和群 | 新建、编辑、复制、删除;设 Main Bot;模型、思考强度、权限预设;成员 Agent |
| 记忆 | 每个 Bot 和群的记忆:查看、问、忘记 |
diff --git a/ds-bot/client.js b/ds-bot/client.js
index cc54a653..fe7f5b4d 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -275,8 +275,6 @@ var ZH = {
"Who answers": "谁来回答",
"Choose an admin first": "先选一个管理员",
"@mentions always pick who answers.": "@提及总是指定由谁回答。",
- "Pause Bot relays after": "Bot 接力几次后暂停",
- "Counted since your last message in this group.": "从你在群里的上一条消息算起。",
Notice: "群公告",
"Shared instructions every member reads before speaking…": "每位成员发言前都会读到的共同说明…",
"Group notice": "群公告",
@@ -655,7 +653,6 @@ var ZH = {
"{name} did not answer or call anyone; call a member with @Name": "{name} 没有回答,也没有叫谁;用 @名字 叫一个成员来回答",
"The group replies could not be shown": "群里的回复显示不出来",
"Paused after {count} Bot relays. Waiting: {names}": "Bot 之间已接力 {count} 次,先停下了。还在等:{names}",
- "Continue": "继续",
"{name} paused for your approval": "{name} 停下来等你批准",
"{name} started on it": "{name} 开始做了",
"You stopped {name}'s work": "你停下了 {name} 的工作",
@@ -1689,7 +1686,6 @@ function teamActions({ call: call2, after, partFor, roster, ui: ui2, live, cards
setPrefs: (prefs) => after(call2("set-prefs", prefs)),
setMain: (id, main = true, options = {}) => after(call2("set-main", { id, main, ...options })),
updateRoom: (id, patch) => after(call2("update-room", { id, ...patch })),
- continueRoom: (roomId) => after(call2("room-continue", { roomId })),
send: (sessionId, text) => after(call2("send", { sessionId: partFor(sessionId), text })),
answerQuestion: (sessionId, questionId, answer) => after(call2("answer-question", { sessionId: partFor(sessionId), questionId, answer })),
dismissQuestion: (sessionId) => after(call2("dismiss-question", { sessionId })),
@@ -8611,8 +8607,7 @@ function GroupReplies({ sessionId, callId, done, content, roster, actions, useUi
return (0, import_react16.createElement)(
"div",
{ key: `paused-${index}`, className: "bt-event" },
- (0, import_react16.createElement)("span", null, t("Paused after {count} Bot relays. Waiting: {names}", { count: reply.count, names: (reply.names ?? []).join(t(" and ")) })),
- room2?.paused?.length > 0 ? (0, import_react16.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.continueRoom(sessionId) }, t("Continue")) : null
+ t("Paused after {count} Bot relays. Waiting: {names}", { count: reply.count, names: (reply.names ?? []).join(t(" and ")) })
);
}
if (reply.kind === "resumed") {
@@ -13489,7 +13484,6 @@ 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)}
@@ -14350,44 +14344,6 @@ function roomSubtitle(room2, roster) {
const admin = roster.byId[room2.admin];
return [t("{count} members", { count: room2.members.length }), admin ? t("Admin {name}", { name: admin.name }) : t("No admin")].join(" · ");
}
-function RelayLimitRow({ room: room2, update }) {
- const [draft, setDraft] = (0, import_react36.useState)(room2.relayLimit ?? "");
- (0, import_react36.useEffect)(() => setDraft(room2.relayLimit ?? ""), [room2.relayLimit]);
- const save = () => {
- const text = String(draft).trim();
- if (text === "") {
- if (room2.relayLimit !== void 0) update({ relayLimit: null });
- return;
- }
- const limit = Number(text);
- if (!Number.isInteger(limit) || limit < 1 || limit > 200 || limit === room2.relayLimit) {
- setDraft(room2.relayLimit ?? "");
- return;
- }
- update({ relayLimit: limit });
- };
- return (0, import_react36.createElement)(
- Row,
- { label: t("Pause Bot relays after"), hint: t("Counted since your last message in this group.") },
- (0, import_react36.createElement)("input", {
- className: "bt-bs-input bt-bs-num",
- type: "number",
- min: 1,
- max: 200,
- placeholder: String(room2.relayLimitDefault ?? ""),
- value: draft,
- "aria-label": t("Pause Bot relays after"),
- onChange: (event) => setDraft(event.target.value),
- onBlur: save,
- onKeyDown: (event) => {
- if (event.key === "Enter") {
- event.preventDefault();
- event.currentTarget.blur();
- }
- }
- })
- );
-}
function GroupPermission({ room: room2, catalog, update }) {
if (!catalog?.options?.length) return null;
const shared2 = room2.permission !== void 0;
@@ -14479,8 +14435,7 @@ function GroupSettingsForm({ room: room2, roster, actions, run: run2, onDeleted
}
}, t(label)))),
(0, import_react36.createElement)("span", { key: mode, className: "bt-set-hint bt-veil" }, `${t(modeHint)} ${t("@mentions always pick who answers.")}`)
- ),
- (0, import_react36.createElement)(RelayLimitRow, { room: room2, update })
+ )
),
(0, import_react36.createElement)(
Card2,
diff --git a/ds-bot/src/client/bot-settings.js b/ds-bot/src/client/bot-settings.js
index c8de9f87..072e4d7f 100644
--- a/ds-bot/src/client/bot-settings.js
+++ b/ds-bot/src/client/bot-settings.js
@@ -275,7 +275,6 @@ 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/cells.js b/ds-bot/src/client/cells.js
index 3555f0cf..1dc43015 100644
--- a/ds-bot/src/client/cells.js
+++ b/ds-bot/src/client/cells.js
@@ -927,10 +927,10 @@ function GroupReplies({ sessionId, callId, done, content, roster, actions, useUi
return h('div', { key: `${reply.botId}-${index}`, className: 'bt-event' },
t('{name} did not answer or call anyone; call a member with @Name', { name: bot.name }))
}
+ // LEGACY: rounds from when groups paused at a relay limit.
if (reply.kind === 'paused') {
return h('div', { key: `paused-${index}`, className: 'bt-event' },
- h('span', null, t('Paused after {count} Bot relays. Waiting: {names}', { count: reply.count, names: (reply.names ?? []).join(t(' and ')) })),
- room?.paused?.length > 0 ? h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => actions.continueRoom(sessionId) }, t('Continue')) : null)
+ t('Paused after {count} Bot relays. Waiting: {names}', { count: reply.count, names: (reply.names ?? []).join(t(' and ')) }))
}
if (reply.kind === 'resumed') {
return h('div', { key: `${reply.botId}-${index}`, className: 'bt-event' }, t('{name} was cut off by a restart and picked its work back up', { name: bot.name }))
diff --git a/ds-bot/src/client/group-settings.js b/ds-bot/src/client/group-settings.js
index e1ff07ce..8d20ac6d 100644
--- a/ds-bot/src/client/group-settings.js
+++ b/ds-bot/src/client/group-settings.js
@@ -21,33 +21,6 @@ export function roomSubtitle(room, roster) {
return [t('{count} members', { count: room.members.length }), admin ? t('Admin {name}', { name: admin.name }) : t('No admin')].join(' · ')
}
-// The one guard a group keeps: how many Bot turns may answer Bot calls since the
-// user last wrote in it, after which the group pauses until the user goes on or
-// writes. Empty means the default, three relays per member.
-function RelayLimitRow({ room, update }) {
- const [draft, setDraft] = useState(room.relayLimit ?? '')
- useEffect(() => setDraft(room.relayLimit ?? ''), [room.relayLimit])
- const save = () => {
- const text = String(draft).trim()
- if (text === '') {
- if (room.relayLimit !== undefined) update({ relayLimit: null })
- return
- }
- const limit = Number(text)
- if (!Number.isInteger(limit) || limit < 1 || limit > 200 || limit === room.relayLimit) { setDraft(room.relayLimit ?? ''); return }
- update({ relayLimit: limit })
- }
- 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 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),
- onBlur: save,
- onKeyDown: event => { if (event.key === 'Enter') { event.preventDefault(); event.currentTarget.blur() } },
- }))
-}
-
// One preset for every member in the group, or each member's own. Turning it on starts
// from DSH's default preset.
function GroupPermission({ room, catalog, update }) {
@@ -102,8 +75,7 @@ export function GroupSettingsForm({ room, roster, actions, run, onDeleted }) {
title: id === 'admin' && !admin ? t('Choose an admin first') : undefined,
onClick: () => { if (mode !== id) void update({ mode: id }) },
}, t(label)))),
- h('span', { key: mode, className: 'bt-set-hint bt-veil' }, `${t(modeHint)} ${t('@mentions always pick who answers.')}`)),
- h(RelayLimitRow, { room, update })),
+ h('span', { key: mode, className: 'bt-set-hint bt-veil' }, `${t(modeHint)} ${t('@mentions always pick who answers.')}`))),
h(Card, { title: t('Working folder') },
h('div', { className: 'bt-set-row bt-bs-row' },
h('span', { className: 'bt-set-copy' }, h('span', { className: 'bt-bs-label' }, t('Folder'))),
diff --git a/ds-bot/src/client/i18n.js b/ds-bot/src/client/i18n.js
index 06962367..405ee5c0 100644
--- a/ds-bot/src/client/i18n.js
+++ b/ds-bot/src/client/i18n.js
@@ -242,8 +242,6 @@ const ZH = {
'Who answers': '谁来回答',
'Choose an admin first': '先选一个管理员',
'@mentions always pick who answers.': '@提及总是指定由谁回答。',
- 'Pause Bot relays after': 'Bot 接力几次后暂停',
- 'Counted since your last message in this group.': '从你在群里的上一条消息算起。',
Notice: '群公告',
'Shared instructions every member reads before speaking…': '每位成员发言前都会读到的共同说明…',
'Group notice': '群公告',
@@ -601,7 +599,6 @@ const ZH = {
'{name} did not answer or call anyone; call a member with @Name': '{name} 没有回答,也没有叫谁;用 @名字 叫一个成员来回答',
'The group replies could not be shown': '群里的回复显示不出来',
'Paused after {count} Bot relays. Waiting: {names}': 'Bot 之间已接力 {count} 次,先停下了。还在等:{names}',
- 'Continue': '继续',
'{name} paused for your approval': '{name} 停下来等你批准',
'{name} started on it': '{name} 开始做了',
"You stopped {name}'s work": '你停下了 {name} 的工作',
diff --git a/ds-bot/src/client/team-actions.js b/ds-bot/src/client/team-actions.js
index 47d791d4..31ab7852 100644
--- a/ds-bot/src/client/team-actions.js
+++ b/ds-bot/src/client/team-actions.js
@@ -104,7 +104,6 @@ export function teamActions({ call, after, partFor, roster, ui, live, cards, hel
setPrefs: prefs => after(call('set-prefs', prefs)),
setMain: (id, main = true, options = {}) => after(call('set-main', { id, main, ...options })),
updateRoom: (id, patch) => after(call('update-room', { id, ...patch })),
- continueRoom: roomId => after(call('room-continue', { roomId })),
send: (sessionId, text) => after(call('send', { sessionId: partFor(sessionId), text })),
answerQuestion: (sessionId, questionId, answer) => after(call('answer-question', { sessionId: partFor(sessionId), questionId, answer })),
dismissQuestion: sessionId => after(call('dismiss-question', { sessionId })),
diff --git a/ds-bot/src/host/channel.js b/ds-bot/src/host/channel.js
index 3fc5c7c6..31a87212 100644
--- a/ds-bot/src/host/channel.js
+++ b/ds-bot/src/host/channel.js
@@ -4,7 +4,6 @@ import { createUserMessage } from '@deepseek-ai/dsh-llm'
import { install as installBtw } from './btw.js'
import { install as installSide } from './side.js'
import { handoffReply, questionReply, viewReply } from './parts.js'
-import { defaultRelayLimit } from './groups.js'
import { validateViewAnswer } from 'deep-view/core'
import { COLORS, EXTRA_COLORS, ROUTE } from './constants.js'
@@ -47,10 +46,10 @@ export function install(rt) {
...bot, sessionId: rt.chatOf(bot.id), parts: (segments ?? []).map(segment => segment.sessionId), ...(kickoff ? { waiting: true } : {}),
})),
// `parts`: the members' hidden group Sessions and their earlier segments, for usage.
- rooms: Object.values(state.rooms).map(({ log, seen, lateRounds, relays, sessions, segments, ...room }) => {
+ rooms: Object.values(state.rooms).map(({ log, seen, paused, sessions, segments, ...room }) => {
const parts = [...Object.values(sessions ?? {}), ...Object.values(segments ?? {}).flat().map(segment => segment.sessionId)]
const last = (log ?? []).filter(line => line.kind === undefined).at(-1)
- return { ...room, relayLimitDefault: defaultRelayLimit(room), parts, ...(last ? { preview: last.who === 'User' ? last.text : `${last.who}:${last.text}` } : {}) }
+ return { ...room, parts, ...(last ? { preview: last.who === 'User' ? last.text : `${last.who}:${last.text}` } : {}) }
}),
// Deleted private Bots whose folder, memory and chats stay closed to the others.
privateArchives: rt.archivesView(),
@@ -279,15 +278,9 @@ export function install(rt) {
remove: Array.isArray(body.remove) ? body.remove : undefined,
workDir: body.workDir,
permission: body.permission,
- relayLimit: body.relayLimit,
})
return ok({ room: view().rooms.find(entry => entry.id === room.id), changes })
}
- case 'room-continue': {
- await rt.load()
- await rt.continueRoom(body.roomId)
- return ok(view())
- }
case 'folders':
case 'folder-pick':
case 'folder-list':
diff --git a/ds-bot/src/host/groups.js b/ds-bot/src/host/groups.js
index c3372da2..078987e2 100644
--- a/ds-bot/src/host/groups.js
+++ b/ds-bot/src/host/groups.js
@@ -8,9 +8,8 @@
// moved on, and nobody has to count lines to know who went before. A plain message
// goes to every member in roster order, admin first, or to the admin alone in admin
// mode; "@Name" picks members. A reply that @mentions a member calls that member
-// next, and the user's own messages are always answered. Bots calling each other
-// count against the group's relay limit, at which the group pauses — nothing is
-// dropped — until the user continues it or writes here.
+// next, and the user's own messages are always answered. Bots may call each other
+// for as long as the work needs; the user stops a group from its details.
//
// Work does not hold a round up: a member that is still busy with tools a little after
// it started, or that is called while still at earlier work, lets the round go on. Its
@@ -33,12 +32,6 @@ const ROOM_FIRST_LOOK = 12
const ROOM_DELTA_MAX = 24
const ROOM_EARLIER_MAX = 8
-// The only bound on a group: how many Bot turns may answer Bot calls since the user
-// last wrote in it, after which the group pauses rather than going on alone. The
-// user sets it per group; unset, it follows the member count.
-export const defaultRelayLimit = room => 3 * (room?.members?.length ?? 0)
-const relayLimit = room => room.relayLimit ?? defaultRelayLimit(room)
-
// Logs written before rooms were versioned get sequence numbers in place.
const ensureRoomLog = (room) => {
if (typeof room.seq !== 'number') {
@@ -379,16 +372,14 @@ export function install(rt) {
}
// A called member moves up if it is still waiting, or gets one more turn if it
- // already spoke; either way it goes right after slot `index`. `origin` is who the
- // call answers to: 'user' for the user's own messages, 'bot' for a member's calls.
- // `by` is the calling member, if a member called.
- function callMembers(round, index, callees, note, by, origin) {
+ // already spoke; either way it goes right after slot `index`. `by` is the calling
+ // member, if a member called.
+ function callMembers(round, index, callees, note, by) {
let next = index + 1
for (const peer of callees) {
const waiting = round.slots.findIndex((other, at) => at > index && other.id === peer.id && other.status === 'waiting')
const called = waiting === -1 ? { id: peer.id, name: peer.name, status: 'waiting' } : round.slots.splice(waiting, 1)[0]
called.note = note
- called.origin = origin
if (by === undefined) delete called.by
else called.by = by
round.slots.splice(next, 0, called)
@@ -396,22 +387,20 @@ export function install(rt) {
}
}
- // Calls the relay limit parked wait for the user: the group paused at its limit,
- // and the user writing here or pressing Continue releases them. Each waits again
- // as a Bot call at the end of the round's slots, after the speakers the user
- // picked; one still waiting later in the round is not queued twice.
- const resumePaused = (room, round) => {
- const paused = room.paused ?? []
- if (paused.length === 0) return
- for (const entry of paused) {
+ // LEGACY: groups used to park Bot calls past a relay limit until the user went on.
+ // Calls still parked from then run in the group's next round, after its opening
+ // speakers; one already waiting in the round is not queued twice.
+ const releaseParked = (room, round) => {
+ const parked = room.paused ?? []
+ delete room.paused
+ for (const entry of parked) {
if (round.slots.some(slot => slot.id === entry.id && slot.status === 'waiting')) continue
round.slots.push({
- id: entry.id, name: entry.name, status: 'waiting', origin: 'bot',
+ id: entry.id, name: entry.name, status: 'waiting',
...(entry.note !== undefined ? { note: entry.note } : {}),
...(entry.by !== undefined ? { by: entry.by } : {}),
})
}
- room.paused = []
}
// The user's messages waiting in the group Session's inbox while a round runs, from
@@ -433,9 +422,7 @@ export function install(rt) {
// Messages the user sent while this round is running post into the log before the
// next speaker, so everyone still to speak sees them. The members the message's own
// round would open with answer it next, inside this round. Each message leaves the
- // Session's inbox, so it does not open another round when this one ends; each also
- // restarts the relay count, and calls parked at the limit resume after the members
- // the user called.
+ // Session's inbox, so it does not open another round when this one ends.
function drainRoomInbox(room, round, index, agent) {
// The greeting's prompt tells the admin the user has not written yet.
if (round.kickoff) return
@@ -447,11 +434,8 @@ export function install(rt) {
round.replies.push({ kind: 'user', text: line.text, time: Date.now() })
const { all, found } = mentionsIn(line.text, members)
const note = all || found.length > 0 ? 'the user mentioned you' : 'new message from the user'
- callMembers(round, index - 1, openingSpeakers(room, { text: line.text }), note, undefined, 'user')
+ callMembers(round, index - 1, openingSpeakers(room, { text: line.text }), note)
}
- // The user spoke in this room, so Bot relays count afresh and the paused run.
- room.relays = 0
- resumePaused(room, round)
void rt.save().catch(() => {})
}
@@ -469,25 +453,6 @@ export function install(rt) {
slot.status = 'left'
continue
}
- if (slot.origin === 'bot') {
- // The group's one guard: Bots calling each other can go on only so long
- // without the user. Past the limit the call is parked, not dropped — the
- // user releases it by writing here or pressing Continue.
- if ((room.relays ?? 0) >= relayLimit(room)) {
- slot.status = 'paused'
- const paused = (room.paused ??= [])
- if (!paused.some(entry => entry.id === slot.id)) {
- paused.push({
- id: slot.id, name: slot.name,
- ...(slot.note !== undefined ? { note: slot.note } : {}),
- ...(slot.by !== undefined ? { by: slot.by } : {}),
- })
- }
- if (!(round.parked ??= []).includes(slot.name)) round.parked.push(slot.name)
- continue
- }
- room.relays = (room.relays ?? 0) + 1
- }
slot.status = 'speaking'
round.speaking = member.id
let session
@@ -551,7 +516,7 @@ export function install(rt) {
const { all, found: named } = mentionsIn(spoken.join('\n\n'), everyone)
const found = named.filter(other => other.id !== member.id)
const callees = leads && all ? [...found, ...others.filter(other => !found.includes(other))] : found
- callMembers(round, index, callees, `${member.name} mentioned you`, member.id, 'bot')
+ callMembers(round, index, callees, `${member.name} mentioned you`, member.id)
}
// The admin was alone with the user's message and passed: the round ends with
// nothing said. The group says so once, so the user knows to call a member.
@@ -564,14 +529,6 @@ export function install(rt) {
round.replies.push({ kind: 'admin-passed', botId: round.soleAdmin.id, name: round.soleAdmin.name, color: round.soleAdmin.color, time: Date.now() })
await rt.save()
}
- // A round that ended with parked calls says so once, to the group and to the
- // user: the log's "@Name" lines are real calls that wait, not drops in silence.
- if (round.parked !== undefined) {
- const limit = relayLimit(room)
- appendRoom(room, { who: 'DS Bot', kind: 'notice', reason: 'paused', names: round.parked, limit })
- round.replies.push({ kind: 'paused', names: round.parked, count: limit, time: Date.now() })
- await rt.save()
- }
}
ctx.tools.register(defineTool({
@@ -595,7 +552,7 @@ export function install(rt) {
// late failure, its work picked up after a restart, its work the user stopped, or
// the end of work whose result it already posted is an event of the round.
const event = item => item.failed || item.resumed || item.stopped || item.done
- for (const post of posts.filter(item => !item.kickoff && !item.resume && !event(item) && item.logged === undefined)) {
+ for (const post of posts.filter(item => !item.kickoff && !event(item) && item.logged === undefined)) {
// Image readings go into the log only; `@` names are picked from what the user typed.
// A file stays with its line and reaches each member the line is shown to.
const readings = post.images === undefined ? [] : await rt.imagesForGroup(post.images, room.id)
@@ -606,11 +563,6 @@ export function install(rt) {
...(post.files === undefined ? {} : { files: post.files }),
})
}
- // The user wrote here — or pressed Continue, which opens the same round
- // without a line of its own — so Bot relays count afresh and the calls the
- // limit parked run after the speakers this message picks.
- const releases = posts.some(post => post.resume === true || (!post.botId && !post.kickoff))
- if (releases) room.relays = 0
await rt.save()
// An event post, and a member post that calls nobody, never pick the speakers
// over a message queued with them.
@@ -633,7 +585,6 @@ export function install(rt) {
...(references.length > 0 ? { references, shown: [] } : {}),
slots: speakers.map(member => ({
id: member.id, name: member.name, status: 'waiting',
- origin: opener.botId === undefined ? 'user' : 'bot',
...(opener.kickoff ? { note: 'the group was just created' } : {}),
...(named.includes(member) ? { by: opener.botId } : {}),
...(opener.done ? { note: `${opener.name ?? 'a member'} finished the work you asked for` } : {}),
@@ -660,7 +611,7 @@ export function install(rt) {
round.replies.push({ kind, botId: post.botId, name, color: bot?.color, time: Date.now() })
}
if (posts.some(post => post.resumed || post.stopped || post.done)) await rt.save()
- if (releases) resumePaused(room, round)
+ releaseParked(room, round)
rt.roomProgress.set(exec.callId, round)
try {
await runRound(room, round, exec.signal, exec.agent)
@@ -777,8 +728,6 @@ export function install(rt) {
const members = everyone.filter(bot => bot.id !== opener.botId)
const admin = members.find(bot => rt.isAdminOf(room, bot.id))
if (opener.kickoff) return admin ? [admin] : []
- // A Continue opens a round whose speakers are the calls the limit parked.
- if (opener.resume) return []
if (opener.quiet) return []
if (opener.done) return members.filter(bot => bot.id === opener.askedBy)
const { all, found: named } = mentionsIn(opener.text, everyone, opener.references)
@@ -830,8 +779,7 @@ export function install(rt) {
// A member the round moved on from (it went on working, went quiet or waited for an
// approval) posts what its turn ended with. The member that asked for it and anyone
- // it names answer, counted into the same relays to the group's pause as the calls
- // inside a round. Work whose result already went out as a step line (`shown`) and
+ // it names answer. Work whose result already went out as a step line (`shown`) and
// that ends with nothing more to say still tells the member that asked for it,
// which answers the result: where the result sits in the turn decides nothing.
async function lateRoomReply(sessionId, info, reply, { shown = false } = {}) {
@@ -857,8 +805,8 @@ export function install(rt) {
// What a member says while it works, into the group. While the member holds its place
// in a round, it joins that round. Later, it joins whatever round runs in the group, or
- // posts on its own. Only the members it calls with @ answer it, each a relay toward
- // the group's pause; the member that asked for the work answers the result.
+ // posts on its own. Only the members it calls with @ answer it; the member that asked
+ // for the work answers the result.
async function postStep(sessionId, info, text) {
const waiter = info?.role === 'room' ? rt.roomWaiters.get(info.exchangeId) : undefined
if (waiter !== undefined) return waiter.say(text)
@@ -970,23 +918,6 @@ export function install(rt) {
}
rt.greetRoom = greetRoom
- // The Continue of a group paused at its relay limit: the parked calls run in a
- // round of their own, opened by the same relay a user message opens.
- async function continueRoom(roomId) {
- const room = rt.roomOf(roomId)
- if (room === undefined) throw new Error('Unknown group chat')
- if ((room.paused ?? []).length === 0) return
- room.relays = 0
- await rt.save()
- const agent = await rt.resolveAgent(room.id)
- agent.followup(createUserMessage({
- content: [{ type: 'text', text: '[Continue]' }],
- source: { kind: SOURCE_KIND, form: 'relay', role: 'resume', exchangeId: randomUUID(), senderName: 'You', roomId: room.id },
- }))
- await ctx.sessions.flush(agent.session)
- }
- rt.continueRoom = continueRoom
-
async function reportRound(room, post, round) {
const lines = round.replies.filter(reply => reply.kind === undefined).map(reply => `${reply.name}: ${reply.text}`)
const waiting = round.replies.filter(reply => reply.kind === 'approval').map(reply => reply.name)
diff --git a/ds-bot/src/host/roster.js b/ds-bot/src/host/roster.js
index 7f6b59bd..a7b33e4e 100644
--- a/ds-bot/src/host/roster.js
+++ b/ds-bot/src/host/roster.js
@@ -492,19 +492,10 @@ export function install(rt) {
// A Bot's own permissions are the user's to set, so a group's are too.
if (patch.permission !== undefined && actorId !== undefined) throw new Error(`Only the user can set the permissions of "${room.name}"`)
const permission = patch.permission === undefined ? undefined : rt.cleanRoomPermission(patch.permission)
- // The relay limit is the user's guard against a group that never stops; it is
- // not a member's to move, whatever its role.
- if (patch.relayLimit !== undefined && actorId !== undefined) throw new Error(`Only the user can set the relay limit of "${room.name}"`)
- let relayLimit
- if (patch.relayLimit === null) relayLimit = null
- else if (patch.relayLimit !== undefined) {
- if (!Number.isInteger(patch.relayLimit) || patch.relayLimit < 1 || patch.relayLimit > 200) throw new Error('Relay limit must be a whole number from 1 to 200')
- relayLimit = patch.relayLimit
- }
// The second run is the last check before the change is written, so no other change
// can take the name in between.
const name = patch.name === undefined ? undefined : cleanRoomName(patch.name, room.id)
- return { members, admin, name, notice, permission, relayLimit }
+ return { members, admin, name, notice, permission }
}
// `actorId` is the Bot asking, or undefined for the user. Returns what changed, in words.
@@ -519,7 +510,7 @@ export function install(rt) {
// No await from here until every change is written.
const room = rt.roomOf(id)
if (room === undefined) throw new Error('Unknown group chat')
- const { members, admin, name, notice, permission, relayLimit } = planRoomChange(room, patch, actorId)
+ const { members, admin, name, notice, permission } = planRoomChange(room, patch, actorId)
const changes = []
const names = ids => ids.map(member => rt.botOf(member)?.name).filter(Boolean).join(', ')
@@ -540,11 +531,6 @@ export function install(rt) {
room.mode = patch.mode
changes.push(patch.mode === 'admin' ? 'plain messages now go to the admin first' : 'every member now replies in turn')
}
- if (relayLimit !== undefined && relayLimit !== (room.relayLimit ?? null)) {
- if (relayLimit === null) delete room.relayLimit
- else room.relayLimit = relayLimit
- changes.push(relayLimit === null ? 'Bots pause at the default relay count again' : `Bots now pause after ${relayLimit} relays`)
- }
if (notice !== undefined && notice !== (room.notice ?? '')) {
room.notice = notice
changes.push(notice ? 'updated the notice' : 'cleared the notice')
diff --git a/ds-bot/src/host/store.js b/ds-bot/src/host/store.js
index a20a0b3e..44ab52da 100644
--- a/ds-bot/src/host/store.js
+++ b/ds-bot/src/host/store.js
@@ -176,13 +176,15 @@ export function install(rt) {
delete room.botRounds
migrated = true
}
- // LEGACY: the late-round limit went with the round caps; a group counts relays to
- // its pause now.
+ // LEGACY: the late-round limit went with the round caps, and the relay limit that
+ // followed it went too. Calls it parked stay until the group's next round runs them.
for (const room of Object.values(state.rooms)) {
- if (room.lateRounds === undefined && room.quietNoticed === undefined && room.quietShown === undefined) continue
+ if (['lateRounds', 'quietNoticed', 'quietShown', 'relays', 'relayLimit'].every(key => room[key] === undefined)) continue
delete room.lateRounds
delete room.quietNoticed
delete room.quietShown
+ delete room.relays
+ delete room.relayLimit
migrated = true
}
// Groups from before group settings existed reply in turn, led by a Main Bot member.
diff --git a/ds-bot/src/host/turns.js b/ds-bot/src/host/turns.js
index a7106b52..5a1e3cc6 100644
--- a/ds-bot/src/host/turns.js
+++ b/ds-bot/src/host/turns.js
@@ -465,8 +465,6 @@ export function install(rt) {
})
} else if (source?.kind === SOURCE_KIND && source.role === 'kickoff' && rt.roomOf(id)) {
queueRoomMessage(id, { text: '', kickoff: true })
- } else if (source?.kind === SOURCE_KIND && source.role === 'resume' && rt.roomOf(id)) {
- queueRoomMessage(id, { text: '', resume: true })
} else if (source?.kind === SOURCE_KIND) {
if (entry.turn === undefined) entry.pending = source
else if (!opened) claimTrigger(id, entry, source)
diff --git a/ds-bot/test/group-work.test.js b/ds-bot/test/group-work.test.js
index d70f1a4f..b7eaf099 100644
--- a/ds-bot/test/group-work.test.js
+++ b/ds-bot/test/group-work.test.js
@@ -432,17 +432,15 @@ test('work inside a PTC program lets the round go on after the grace', async (t)
assert.deepEqual(kinds(result()), [['working', 'Writer']])
})
-test('work the user asked for is left for the user to read, and the user\'s message resets the relay count', async (t) => {
+test('work the user asked for is left for the user to read', async (t) => {
t.mock.timers.enable({ apis: ['setTimeout'] })
- const host = await start(t, { relays: 5 })
+ const host = await start(t)
const first = host.round('c1', host.say('@Writer 整理文档'))
await settle(() => host.agentOf('gb').calls.length === 1)
host.begin('gb')
host.emit('gb', 'tool/call', { callId: 'k1', name: 'write', arguments: '{}' })
t.mock.timers.tick(ROOM_WORK_GRACE_MS)
await settle(() => first() !== undefined)
- // The user's message resets the count.
- assert.equal(JSON.parse(readFileSync(join(host.home, 'state.json'), 'utf8')).rooms.r1.relays, 0)
host.finish('gb', '好了。')
await settle(() => host.agentOf('r1').calls.length === 1)
const post = host.takePost()
@@ -453,36 +451,25 @@ test('work the user asked for is left for the user to read, and the user\'s mess
assert.deepEqual([host.agentOf('ga').calls.length, host.agentOf('gc').calls.length], [0, 0])
})
-test('a late post that calls a member counts into the relays, and parks past the limit', async (t) => {
- // Three members, so the default relay limit is 9: the eighth relay still runs.
- const host = await start(t, { relays: 8 })
- host.emit('gb', 'turn/start', { turn: 1 })
- host.emit('gb', 'user/message', { content: [{ type: 'text', text: 'go' }], source: { kind: 'bot', role: 'room', exchangeId: 'x1', roomId: 'r1', askedBy: 'a' } })
- host.finish('gb', '@Tester 看看这个')
- await settle(() => host.agentOf('r1').calls.length === 1)
- const post = host.takePost()
- assert.deepEqual([post.source.late, post.source.quiet], [true, undefined])
- const first = host.round('c2', post)
- await settle(() => host.agentOf('gc').calls.length === 1)
- host.begin('gc')
- host.finish('gc', '[PASS]')
- await settle(() => first() !== undefined)
- assert.equal(JSON.parse(readFileSync(join(host.home, 'state.json'), 'utf8')).rooms.r1.relays, 9)
-
- // The next late call parks: the group pauses instead of running it, and nothing
- // is dropped — the Tester just gets no turn until the user goes on.
- host.emit('gb', 'turn/start', { turn: 2 })
- host.emit('gb', 'user/message', { content: [{ type: 'text', text: 'more' }], source: { kind: 'bot', role: 'room', exchangeId: 'x2', roomId: 'r1', askedBy: 'a' } })
- host.finish('gb', '@Tester 再看一个')
- await settle(() => host.agentOf('r1').calls.length === 1)
- const second = host.round('c3', host.takePost())
- await settle(() => second() !== undefined)
+test('a late post that calls a member reaches it every time, with no count to stop it', async (t) => {
+ const host = await start(t)
+ for (const [turn, text] of [[1, '@Tester 看看这个'], [2, '@Tester 再看一个']]) {
+ host.emit('gb', 'turn/start', { turn })
+ host.emit('gb', 'user/message', { content: [{ type: 'text', text: 'go' }], source: { kind: 'bot', role: 'room', exchangeId: `x${turn}`, roomId: 'r1', askedBy: 'a' } })
+ host.finish('gb', text)
+ await settle(() => host.agentOf('r1').calls.length === 1)
+ const post = host.takePost()
+ assert.deepEqual([post.source.late, post.source.quiet], [true, undefined])
+ const round = host.round(`c${turn}`, post)
+ await settle(() => host.agentOf('gc').calls.length === turn)
+ host.begin('gc')
+ host.finish('gc', '[PASS]')
+ await settle(() => round() !== undefined)
+ assert.equal(round().replies.filter(reply => reply.kind === 'paused').length, 0)
+ }
const saved = JSON.parse(readFileSync(join(host.home, 'state.json'), 'utf8')).rooms.r1
- assert.equal(saved.relays, 9, 'the parked call did not run')
- assert.deepEqual(saved.paused.map(entry => [entry.id, entry.name]), [['c', 'Tester']])
- assert.equal('lateRounds' in saved, false)
- assert.equal(host.agentOf('gc').calls.length, 1, 'the parked call never reached the Tester')
- assert.deepEqual(second().replies.filter(reply => reply.kind === 'paused').map(reply => [reply.names, reply.count]), [[['Tester'], 9]])
+ assert.equal(saved.relays, undefined)
+ assert.equal(saved.paused, undefined)
})
// #198: a post during a running round waited for the round's own relay before
diff --git a/ds-bot/test/roster.test.js b/ds-bot/test/roster.test.js
index e21e2af2..93ad4e64 100644
--- a/ds-bot/test/roster.test.js
+++ b/ds-bot/test/roster.test.js
@@ -905,7 +905,8 @@ test('a photo that cannot be read changes nothing, and a non-Main Bot cannot set
assert.equal((await call('state', {})).value.bots.find(bot => bot.id === writer.id).avatar.image, PNG_DATA_URL)
})
-test('a group\'s relay limit is a user setting the state view shows, and old late-round fields load away', async (t) => {
+test('old late-round and relay-limit fields of a group load away; calls it parked stay for the next round', async (t) => {
+ const parked = [{ id: 'writer', name: 'Writer', note: 'Chief mentioned you', by: 'chief' }]
const { call, stop, home } = start({
version: 1,
mainBotIds: ['chief'],
@@ -913,33 +914,19 @@ test('a group\'s relay limit is a user setting the state view shows, and old lat
rooms: {
r1: {
id: 'r1', name: 'Ops', members: ['chief', 'writer'], mode: 'admin', admin: 'chief', named: true,
- log: [], seq: 0, seen: {}, lateRounds: 7, quietNoticed: true, quietShown: true,
+ log: [], seq: 0, seen: {}, lateRounds: 7, quietNoticed: true, quietShown: true, relays: 5, relayLimit: 4, paused: parked,
},
},
})
t.after(stop)
const shown = (await call('state', {})).value.rooms.find(room => room.id === 'r1')
- // The released late-round fields load away, and the live relay count never shows.
- assert.equal('lateRounds' in shown, false)
- assert.equal('quietNoticed' in shown, false)
- assert.equal('quietShown' in shown, false)
- assert.equal('relays' in shown, false)
- assert.equal(shown.relayLimit, undefined)
- assert.equal(shown.relayLimitDefault, 6, 'the default is three relays per member')
- assert.equal('lateRounds' in JSON.parse(readFileSync(join(home, 'state.json'), 'utf8')).rooms.r1, false)
+ for (const key of ['lateRounds', 'quietNoticed', 'quietShown', 'relays', 'relayLimit', 'relayLimitDefault', 'paused']) assert.equal(key in shown, false, key)
+ const saved = JSON.parse(readFileSync(join(home, 'state.json'), 'utf8')).rooms.r1
+ for (const key of ['lateRounds', 'relays', 'relayLimit']) assert.equal(key in saved, false, key)
+ assert.deepEqual(saved.paused, parked)
+ // A limit sent by an older client changes nothing.
const set = await call('update-room', { id: 'r1', relayLimit: 4 })
assert.equal(set.ok, true)
- assert.equal(set.value.room.relayLimit, 4)
- assert.match(set.value.changes.join(' '), /Bots now pause after 4 relays/)
- const cleared = await call('update-room', { id: 'r1', relayLimit: null })
- assert.equal(cleared.ok, true)
- assert.match(cleared.value.changes.join(' '), /Bots pause at the default relay count again/)
- assert.equal((await call('state', {})).value.rooms.find(room => room.id === 'r1').relayLimit, undefined)
-
- for (const bad of [0, 2.5, 201, 'six']) {
- const result = await call('update-room', { id: 'r1', relayLimit: bad })
- assert.equal(result.ok, false, JSON.stringify(bad))
- assert.match(result.error.message, /Relay limit must be a whole number from 1 to 200/)
- }
+ assert.deepEqual(set.value.changes, [])
})
diff --git a/ds-bot/test/rounds.test.js b/ds-bot/test/rounds.test.js
index 7726311d..d8d9b5f7 100644
--- a/ds-bot/test/rounds.test.js
+++ b/ds-bot/test/rounds.test.js
@@ -628,227 +628,77 @@ test('a long post goes to the group as a file, and reaches the member with its p
assert.equal(line.length, undefined, 'the line is short; no file of its own')
})
-// #395: the per-member and per-round turn bounds dropped calls in silence — a
-// "@Name" the user sent mid-round could vanish the same way. Now a member's turns
-// are not capped and every user message is answered; the only bound is the group's
-// relay limit, at which calls the Bot-to-Bot chain would make park instead of
-// dropping, until the user continues or writes in the group.
-test('a user @ mid-round reaches a member however often it already spoke', async (t) => {
+// #395 and #655: bounds on turns and relays stopped groups mid-work — first by
+// dropping calls in silence, then by parking them until the user went on. Now
+// nothing caps how often members call each other, and every user message is
+// answered.
+test('members call each other for as long as they call, and a user @ mid-round still reaches a member', async (t) => {
const { call, emit, userMessage, compose, relay, answer, stop, sent, rt } = start()
t.after(stop)
const room = await team(call, sent)
- await call('update-room', { id: room.id, mode: 'admin', relayLimit: 20 })
+ await call('update-room', { id: room.id, mode: 'admin' })
const writer = Object.values(rt.state.bots).find(bot => bot.name === 'Writer')
await emit(room.id, userMessage('Start'))
const running = relay(room.id, 'relay')
- // The admin and the Writer trade calls ten times: nothing caps a member's turns
- // any more, so each speaks as often as the relay limit leaves room for.
+ // Twenty calls back and forth, far past the old default of three per member.
const spoken = []
let turn = await turnFor(sent)
- for (let step = 0; step < 10; step += 1) {
+ for (let step = 0; step < 20; step += 1) {
spoken.push(turn)
await answer(turn.sessionId, turn.message.source.exchangeId, `${step % 2 === 0 ? '@Writer' : '@Chief'} volley ${step + 1}`, step + 1)
turn = await turnFor(sent, ...spoken)
}
const writerSession = rt.state.rooms[room.id].sessions[writer.id]
- assert.equal(sent.filter(entry => entry.sessionId === writerSession && entry.message.source.role === 'room').length,
- 5, 'the Writer answered five calls in one round; the old cap would have dropped the fifth')
+ assert.equal(sent.filter(entry => entry.sessionId === writerSession && entry.message.source.role === 'room').length, 10)
- // While the admin answers its sixth turn the user @s the Writer. The user's own
- // calls never park: the Writer hears it right after the admin.
+ // While the admin answers its eleventh call the user @s the Writer, which hears it
+ // right after the admin.
await compose(room.id, '@Writer your take?')
- await answer(turn.sessionId, turn.message.source.exchangeId, 'Done.', 11)
+ await answer(turn.sessionId, turn.message.source.exchangeId, 'Done.', 21)
const called = await turnFor(sent, ...spoken, turn)
assert.equal(called.sessionId, writerSession)
assert.match(called.message.content[0].text, /@Writer your take\?/)
assert.match(called.message.content[0].text, /the user mentioned you/)
- await answer(called.sessionId, called.message.source.exchangeId, 'Here.', 12)
+ await answer(called.sessionId, called.message.source.exchangeId, 'Here.', 22)
const result = JSON.parse(await running)
assert.equal(result.replies.filter(reply => reply.kind === 'paused').length, 0)
-})
-
-test('calls past the relay limit park until the user goes on, and the group is told once', async (t) => {
- const { call, emit, userMessage, relay, answer, stop, sent, rt, home } = start()
- t.after(stop)
- const chief = (await call('state', {})).value.mainBotId
- const writer = (await call('create-bot', { name: 'Writer' })).value
- const editor = (await call('create-bot', { name: 'Editor' })).value
- const room = (await call('create-room', { name: 'R1', members: [chief, writer.id, editor.id] })).value
- await call('update-room', { id: room.id, mode: 'admin', relayLimit: 2 })
- sent.length = 0
-
- await emit(room.id, userMessage('Start'))
- const running = relay(room.id, 'relay')
- const first = await turnFor(sent)
- await answer(first.sessionId, first.message.source.exchangeId, '@Writer one', 1)
- const second = await turnFor(sent, first)
- await answer(second.sessionId, second.message.source.exchangeId, '@Chief back', 2)
- const third = await turnFor(sent, first, second)
- // The next calls would be the third relay, past the limit: both wait instead of
- // running, and the log does not show a hand-off that never starts.
- await answer(third.sessionId, third.message.source.exchangeId, '@Writer again, @Editor too', 3)
- const result = JSON.parse(await running)
-
const state = rt.state.rooms[room.id]
- assert.equal(sent.filter(entry => entry.message.source.role === 'room').length, 3, 'the parked calls never reached their members')
- const notices = state.log.filter(line => line.kind === 'notice')
- assert.equal(notices.length, 1, 'one notice for the pause, not one per parked call')
- assert.deepEqual({ reason: notices[0].reason, names: notices[0].names, limit: notices[0].limit },
- { reason: 'paused', names: ['Writer', 'Editor'], limit: 2 })
- assert.match(lineText(notices[0]), /Paused: Bots have called each other 2 times since the user last wrote here/)
- assert.match(lineText(notices[0]), /@Writer and @Editor wait/)
- // The round the user watched shows the same pause as one line of its replies —
- // and nothing is marked dropped.
- assert.deepEqual(result.replies.filter(reply => reply.kind === 'paused').map(reply => [reply.names, reply.count]),
- [[['Writer', 'Editor'], 2]])
- const saved = JSON.parse(readFileSync(join(home, 'state.json'), 'utf8')).rooms[room.id]
- assert.deepEqual(saved.paused.map(entry => [entry.id, entry.name, entry.note, entry.by]),
- [[writer.id, 'Writer', 'Chief mentioned you', chief], [editor.id, 'Editor', 'Chief mentioned you', chief]])
+ assert.equal(state.log.filter(line => line.kind === 'notice').length, 0, 'no pause notice')
+ assert.equal(state.paused, undefined)
+ assert.equal(state.relays, undefined, 'nothing counts the calls')
})
-test('Continue runs the parked calls in a round of their own, and a free group ignores it', async (t) => {
- const { call, emit, userMessage, relay, answer, stop, sent, rt } = start()
- t.after(stop)
- const room = await team(call, sent)
- await call('update-room', { id: room.id, mode: 'admin', relayLimit: 2 })
- const writer = Object.values(rt.state.bots).find(bot => bot.name === 'Writer')
- const state = rt.state.rooms[room.id]
-
- // Nothing parked yet: Continue is a no-op and sends no relay.
- sent.length = 0
- await call('room-continue', { roomId: room.id })
- assert.equal(sent.filter(entry => entry.message.source?.role === 'resume').length, 0)
-
- await emit(room.id, userMessage('Start'))
- const running = relay(room.id, 'relay')
- const first = await turnFor(sent)
- await answer(first.sessionId, first.message.source.exchangeId, '@Writer one', 1)
- const second = await turnFor(sent, first)
- await answer(second.sessionId, second.message.source.exchangeId, '@Chief back', 2)
- const third = await turnFor(sent, first, second)
- await answer(third.sessionId, third.message.source.exchangeId, '@Writer again', 3)
- await running
- assert.equal(state.paused.length, 1)
- assert.equal(state.paused[0].id, writer.id)
-
- // Continue: the count restarts and a resume relay runs the parked call.
- sent.length = 0
- assert.equal((await call('room-continue', { roomId: room.id })).ok, true)
- assert.equal(state.relays, 0)
- const resume = sent.find(entry => entry.sessionId === room.id && entry.message.source?.role === 'resume')
- assert.ok(resume, 'Continue sends a resume relay to the group Session')
- await emit(room.id, { type: 'user/message', data: { source: resume.message.source, content: resume.message.content } })
- const running2 = relay(room.id, 'relay-2')
- const turn = await turnFor(sent)
- assert.equal(turn.sessionId, state.sessions[writer.id], 'the parked call runs')
- await answer(turn.sessionId, turn.message.source.exchangeId, 'Back on it.', 4)
- await running2
- assert.deepEqual(state.paused, [])
-})
-
-test('a user message after a pause answers the user first, then runs the parked call', async (t) => {
- const { call, emit, userMessage, relay, answer, stop, sent, rt } = start()
+// LEGACY: calls the old relay limit parked are not dropped: the group's next round
+// runs them after its own speakers.
+test('calls parked under the old relay limit run in the group\'s next round', async (t) => {
+ const { call, emit, userMessage, relay, answer, stop, sent, rt, home } = start()
t.after(stop)
const room = await team(call, sent)
- await call('update-room', { id: room.id, mode: 'admin', relayLimit: 2 })
+ await call('update-room', { id: room.id, mode: 'admin' })
const chief = rt.state.mainBotIds[0]
const writer = Object.values(rt.state.bots).find(bot => bot.name === 'Writer')
- const state = rt.state.rooms[room.id]
-
- await emit(room.id, userMessage('Start'))
- const running = relay(room.id, 'relay')
- const first = await turnFor(sent)
- await answer(first.sessionId, first.message.source.exchangeId, '@Writer one', 1)
- const second = await turnFor(sent, first)
- await answer(second.sessionId, second.message.source.exchangeId, '@Chief back', 2)
- const third = await turnFor(sent, first, second)
- await answer(third.sessionId, third.message.source.exchangeId, '@Writer again', 3)
- await running
- assert.equal(state.paused.length, 1)
-
- sent.length = 0
- await emit(room.id, userMessage('@Chief one more question'))
- const next = relay(room.id, 'relay-2')
- const own = await turnFor(sent)
- assert.equal(own.sessionId, state.sessions[chief], 'the member the user called answers first')
- await answer(own.sessionId, own.message.source.exchangeId, 'Yes?', 4)
- const parked = await turnFor(sent, own)
- assert.equal(parked.sessionId, state.sessions[writer.id], 'the parked call runs after the user\'s speaker')
- await answer(parked.sessionId, parked.message.source.exchangeId, 'On it.', 5)
- await next
- assert.equal(state.relays, 1, 'the count restarted with the user\'s message; the parked call counts into it')
- assert.deepEqual(state.paused, [])
-})
-
-test('a user message mid-round restarts the relay count for the calls after it', async (t) => {
- const { call, emit, userMessage, compose, relay, answer, stop, sent, rt } = start()
- t.after(stop)
- const room = await team(call, sent)
- await call('update-room', { id: room.id, mode: 'admin', relayLimit: 3 })
- const state = rt.state.rooms[room.id]
-
- await emit(room.id, userMessage('Start'))
- const running = relay(room.id, 'relay')
- const first = await turnFor(sent)
- await answer(first.sessionId, first.message.source.exchangeId, '@Writer one', 1)
- const second = await turnFor(sent, first)
- await answer(second.sessionId, second.message.source.exchangeId, '@Chief back', 2)
- const third = await turnFor(sent, first, second)
-
- // Two relays spent of three. While the admin answers, the user writes; its
- // message restarts the count, so the call the Writer then makes does not park.
- await compose(room.id, '@Writer hold on')
- await answer(third.sessionId, third.message.source.exchangeId, 'Done.', 3)
- const fourth = await turnFor(sent, first, second, third)
- await answer(fourth.sessionId, fourth.message.source.exchangeId, '@Chief last', 4)
- const fifth = await turnFor(sent, first, second, third, fourth)
- assert.ok(fifth, 'the Writer\'s call runs: the count restarted at the user\'s message')
- await answer(fifth.sessionId, fifth.message.source.exchangeId, 'All done.', 5)
- const result = JSON.parse(await running)
- assert.equal(result.replies.filter(reply => reply.kind === 'paused').length, 0)
- 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')
+ const state = () => rt.state.rooms[room.id]
+ state().paused = [{ id: writer.id, name: 'Writer', note: 'Chief mentioned you', by: chief }]
+ await rt.save()
+ // The user's next message opens the round; its own speaker, the admin, goes first.
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 } })
+ await emit(room.id, userMessage('Status, please'))
+ assert.equal(state().paused.length, 1, 'still parked until a round runs')
const running = relay(room.id, 'relay')
const first = await turnFor(sent)
- await answer(first.sessionId, first.message.source.exchangeId, '@Chief back', 1)
+ assert.equal(first.sessionId, state().sessions[chief])
+ await answer(first.sessionId, first.message.source.exchangeId, 'All fine.', 1)
+ const parked = await turnFor(sent, first)
+ assert.equal(parked.sessionId, state().sessions[writer.id], 'the parked call runs after the round\'s own speaker')
+ assert.match(parked.message.content[0].text, /Chief mentioned you/)
+ await answer(parked.sessionId, parked.message.source.exchangeId, 'On it.', 2)
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'])
+ assert.equal(state().paused, undefined)
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)
- const writer = (await call('create-bot', { name: 'Writer' })).value
- const chief = rt.state.mainBotIds[0]
- const room = (await call('create-room', { name: 'R1', members: [chief, writer.id] })).value
- // The group's admin and a Main Bot may change its other settings; the limit stays
- // the user's. A plain member is refused earlier, like for any change.
- await assert.rejects(rt.updateRoom(room.id, { relayLimit: 4 }, chief), /Only the user can set the relay limit of "R1"/)
- await assert.rejects(rt.updateRoom(room.id, { relayLimit: 4 }, writer.id), /can change it/)
+ assert.equal(saved.paused, undefined)
})
test('a member the reply timeout cut short is told to the group, not left as silence', async (t) => {
@@ -1002,30 +852,3 @@ test('a member still at work is shown with the group messages it has not read ye
await second0
})
-test('a user message that opens a round restarts the relay count, as a queued one does', async (t) => {
- const { call, emit, userMessage, relay, answer, stop, sent, rt } = start()
- t.after(stop)
- const room = await team(call, sent)
- await call('update-room', { id: room.id, mode: 'admin', relayLimit: 3 })
-
- await emit(room.id, userMessage('Start'))
- const first = relay(room.id, 'relay-1')
- const turn = await turnFor(sent)
- await answer(turn.sessionId, turn.message.source.exchangeId, 'Ready.', 1)
- await first
-
- const state = rt.state.rooms[room.id]
- // The Bot chain has already spent its relays. A message the user writes between
- // rounds opens a round of its own rather than waiting in an inbox, and it has to
- // restart the count there too.
- state.relays = 3
- await emit(room.id, userMessage('carry on'))
- const second = relay(room.id, 'relay-2')
- const again = await turnFor(sent, turn)
- await answer(again.sessionId, again.message.source.exchangeId, '@Writer go', 2)
- const writer = await turnFor(sent, turn, again)
- assert.ok(writer, 'the call runs: the user\'s message restarted the count')
- await answer(writer.sessionId, writer.message.source.exchangeId, 'On it.', 3)
- await second
- assert.equal(state.relays, 1)
-})
diff --git a/ds-bot/test/tool-cells.test.js b/ds-bot/test/tool-cells.test.js
index 18780147..6fdde216 100644
--- a/ds-bot/test/tool-cells.test.js
+++ b/ds-bot/test/tool-cells.test.js
@@ -154,29 +154,14 @@ test('a user message inside a group relay shows its time', () => {
assert.deepEqual(times.map(node => node.props.title), [`Today ${clockOf(today)}`])
})
-// A group paused at its relay limit shows the wait, with a Continue button while
-// the room still parks calls — which calls room-continue with the group's id.
-test('a paused group shows the wait, and Continue releases it while calls are parked', () => {
+// LEGACY: a round from when groups paused at a relay limit still shows the pause,
+// with nothing to press.
+test('an old paused round shows the pause as a plain line', () => {
const replies = [{ kind: 'paused', names: ['Writer', 'Coder'], count: 6, time: at(0, 14, 5) }]
- const relay = call('group_relay', 'direct', { content: { replies } })
-
- // Nothing parked on the room: the line stands alone, with no button.
- const plain = show(relay, { sessionId: 'room' })
- const events = findAll(plain, node => node.props?.className === 'bt-event').map(text)
+ const out = show(call('group_relay', 'direct', { content: { replies } }), { sessionId: 'room' })
+ const events = findAll(out, node => node.props?.className === 'bt-event').map(text)
assert.deepEqual(events, ['Paused after 6 Bot relays. Waiting: Writer and Coder'])
- assert.equal(find(plain, node => node.type === 'button' && text(node) === 'Continue'), undefined)
-
- const parked = { ...room, paused: [{ id: 'writer', name: 'Writer' }] }
- const clicked = []
- const live = show(relay, {
- sessionId: 'room',
- roster: team({ rooms: [parked], roomsById: { room: parked } }),
- actions: { continueRoom: id => clicked.push(id) },
- })
- const button = find(live, node => node.type === 'button' && text(node) === 'Continue')
- assert.ok(button, 'the Continue button is drawn while the room parks calls')
- button.props.onClick()
- assert.deepEqual(clicked, ['room'])
+ assert.equal(find(out, node => node.type === 'button'), undefined)
})
// The admin was alone with the user's message and passed: the round shows the