A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Stop all work in a group with one button beside its status capsule
AdamPlatin123b3cfaa64ecfa
diff --git a/docs/plans/2026-10-07-group-chat.md b/docs/plans/2026-10-07-group-chat.mdindex 80ebb72c..a3bfd5e0 100644--- a/docs/plans/2026-10-07-group-chat.md+++ b/docs/plans/2026-10-07-group-chat.md@@ -49,6 +49,7 @@### 审批与状态- 群里成员的审批请求(例如提权)由 DS Bot 接到群里:输入框上方的状态胶囊列出正在忙的成员,等审批的排在前面;点开群详情可以「允许一次」或「拒绝」。需要审批的成员立刻让出发言。+- 有成员在本群干活(含等审批)时,状态胶囊旁有一个停止按钮:一次停掉本群正在跑的一轮和每个成员在本群的工作,被停下的成员各在群里留一行「已叫停」;它们在私聊和别的群里的活照常。DSH 自己的停止只停这一轮,轮次放手后还在干活的成员停不到;群详情里仍可以逐个停。- 群的工作文件夹和统一权限是群级设置,见 [角色与权限](2026-10-07-roles-and-permissions.md)。### 群的设置@@ -87,3 +88,4 @@- 2026-10-16:去掉 Bot 在一个群里 3 轮和全团队 40 条的上限;要回报的发帖进派活树(#262)。- 2026-10-18:其他成员也能往自己所在的群发帖,只叫 `@` 点到的成员(#198)。- 2026-10-22:去掉群里每人每轮、每轮总数和迟到 10 次的上限;Bot 之间接力到群的上限时暂停,用户点「继续」或发言后接着跑,用户的 @ 一定有人回应(#395)。+- 2026-10-26:状态胶囊旁的停止按钮一次停掉本群的一轮和所有成员在本群的工作(#592)。diff --git a/ds-bot/client.js b/ds-bot/client.jsindex 00524466..af3f784b 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -644,6 +644,7 @@ var ZH = {"{first}, {second} and {count} more are waiting for your approval": "{first}、{second} 等 {total} 个等你批准","Waiting for your approval": "等你批准","in its own chat": "在自己的对话里",+ "Stop all work in this group": "停止本群的所有工作",Reject: "拒绝","Allow once": "允许一次","Couldn't message {name}": "没能给 {name} 发消息",@@ -1635,6 +1636,7 @@ function teamActions({ call: call2, after, partFor, roster, ui: ui2, live, cardsdismissView: (sessionId) => after(call2("dismiss-view", { sessionId: partFor(sessionId) })),answerApproval: (id, choice) => after(call2("approval-answer", { id, choice })),stopMemberWork: (roomId, botId) => after(call2("stop-member-work", { roomId, botId })),+ stopRoomWork: (roomId) => after(call2("stop-room-work", { roomId })),// Values go out in these requests and never come back in a response.secretSet: (payload) => after(call2("secret-set", payload)),secretAllow: (requestId) => after(call2("secret-allow", { requestId })),@@ -3757,6 +3759,9 @@ function ShareIcon() {function CloseIcon() {return (0, import_react3.createElement)("svg", { width: 16, height: 16, viewBox: "0 0 20 20", "aria-hidden": true }, (0, import_react3.createElement)("path", { d: "M5 5l10 10M15 5L5 15", stroke: "currentColor", strokeWidth: 1.6, strokeLinecap: "round" }));}+function StopIcon() {+ return (0, import_react3.createElement)("svg", { width: 16, height: 16, viewBox: "0 0 20 20", "aria-hidden": true }, (0, import_react3.createElement)("rect", { x: 4, y: 4, width: 12, height: 12, rx: 2.5, fill: "currentColor" }));+}var ChevronLeftIcon = () => (0, import_react3.createElement)("svg", { width: 16, height: 16, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.6, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }, (0, import_react3.createElement)("path", { d: "M12.5 4.5L7 10l5.5 5.5" }));var ChevronRightIcon = () => (0, import_react3.createElement)("svg", { width: 14, height: 14, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.6, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }, (0, import_react3.createElement)("path", { d: "M7.5 4.5L13 10l-5.5 5.5" }));var lineIcon = (paths) => function LineIcon() {@@ -15992,11 +15997,14 @@ function summaryText(busy) {function dockModel(sessionId, roster, work) {const room2 = roster.roomsById[sessionId];if (room2) {- const busy = dockMembers(busyMembers(room2, work, roster));+ const all = busyMembers(room2, work, roster);+ const busy = dockMembers(all);if (busy.length === 0) return null;const { waiting, doing } = summaryText(busy);return {open: { details: room2.id },+ // A member busy only elsewhere is shown here, but its work is not this group's to stop.+ ...all.some((entry) => entry.here) ? { stop: room2.id } : {},faces: busy.slice(0, FACES_MAX).map((entry) => ({ id: entry.id, ask: entry.state === "ask", state: workState(entry.doing) })),waiting,doing@@ -16028,6 +16036,15 @@ function useFitWidth(inner, key) {}, [key]);return width;}+function StopRoomWork({ roomId, actions }) {+ const [stopping, setStopping] = (0, import_react41.useState)(false);+ const stop = () => {+ setStopping(true);+ void Promise.resolve(actions.stopRoomWork(roomId)).catch((error) => actions.reportError(error, "stop")).finally(() => setStopping(false));+ };+ const label = t("Stop all work in this group");+ return (0, import_react41.createElement)("button", { type: "button", className: "bt-mw-stop", "aria-label": label, title: label, disabled: stopping, onClick: stop }, (0, import_react41.createElement)(StopIcon));+}function MemberDock({ sessionId, useRoster, useWork, actions }) {const roster = useRoster((value) => value);const work = useWork((value) => value);@@ -16044,20 +16061,25 @@ function MemberDock({ sessionId, useRoster, useWork, actions }) {"div",{ className: "bt-mw-dock", "data-leaving": leaving || void 0 },(0, import_react41.createElement)(- "button",- { type: "button", className: "bt-mw-pill", "aria-label": label, onClick: open, disabled: leaving, style: width ? { width } : void 0 },+ "span",+ { className: "bt-mw-pair" },(0, import_react41.createElement)(- "span",- { ref: inner, className: "bt-mw-pill-in" },- (0, import_react41.createElement)("span", { className: "bt-mw-faces", "aria-hidden": true }, faces.map((face) => (0, import_react41.createElement)(Face, { key: face.id, ...face }))),+ "button",+ { type: "button", className: "bt-mw-pill", "aria-label": label, onClick: open, disabled: leaving, style: width ? { width } : void 0 },(0, import_react41.createElement)("span",- { key: label, className: "bt-mw-label", "aria-hidden": true },- model.waiting ? (0, import_react41.createElement)("span", { className: "bt-mw-ask" }, model.waiting) : null,- model.waiting && model.doing ? (0, import_react41.createElement)("span", { className: "bt-mw-dot" }, "·") : null,- model.doing ? (0, import_react41.createElement)("span", { className: "bt-mw-doing" }, (0, import_react41.createElement)(Shimmer, null, model.doing)) : null+ { ref: inner, className: "bt-mw-pill-in" },+ (0, import_react41.createElement)("span", { className: "bt-mw-faces", "aria-hidden": true }, faces.map((face) => (0, import_react41.createElement)(Face, { key: face.id, ...face }))),+ (0, import_react41.createElement)(+ "span",+ { key: label, className: "bt-mw-label", "aria-hidden": true },+ model.waiting ? (0, import_react41.createElement)("span", { className: "bt-mw-ask" }, model.waiting) : null,+ model.waiting && model.doing ? (0, import_react41.createElement)("span", { className: "bt-mw-dot" }, "·") : null,+ model.doing ? (0, import_react41.createElement)("span", { className: "bt-mw-doing" }, (0, import_react41.createElement)(Shimmer, null, model.doing)) : null+ ))- )+ ),+ model.stop ? (0, import_react41.createElement)(StopRoomWork, { roomId: model.stop, actions }) : null));}@@ -16120,7 +16142,12 @@ var MEMBER_CSS = `.bt-mw-pill{pointer-events:auto;position:relative;display:inline-flex;align-items:center;flex:none;box-sizing:border-box;height:32px;max-width:100%;padding:0;border:0;border-radius:999px;overflow:hidden;background:var(--bt-main);box-shadow:0 0 0 .5px var(--bt-line-2),0 2px 8px -2px rgba(0,0,0,.12);color:var(--bt-ink-2);font:inherit;font-size:13px;line-height:18px;cursor:pointer;animation:bt-mw-in ${SPRING_SHAPE.duration}ms ${SPRING_SHAPE.easing} backwards,bt-veil-in .18s ease-out backwards;transition:background-color .12s ease,${spring(SPRING_SHAPE, "width")},${spring(SPRING_TAP, "scale")}}.bt-mw-pill:hover{background:color-mix(in srgb,var(--bt-ink) 4%,var(--bt-main))}.bt-mw-pill:active{scale:.97}-.bt-mw-dock[data-leaving] .bt-mw-pill{animation:bt-mw-out .16s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}+.bt-mw-dock[data-leaving] .bt-mw-pill,.bt-mw-dock[data-leaving] .bt-mw-stop{animation:bt-mw-out .16s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}+.bt-mw-pair{position:relative;display:inline-flex;min-width:0;max-width:100%}+.bt-mw-stop{pointer-events:auto;position:absolute;top:0;left:calc(100% + 6px);display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:50%;background:var(--bt-main);box-shadow:0 0 0 .5px var(--bt-line-2),0 2px 8px -2px rgba(0,0,0,.12);color:var(--bt-ink-2);cursor:pointer;animation:bt-mw-in ${SPRING_SHAPE.duration}ms ${SPRING_SHAPE.easing} backwards,bt-veil-in .18s ease-out backwards;transition:background-color .12s ease,color .12s ease,${spring(SPRING_TAP, "scale")}}+.bt-mw-stop:hover:not(:disabled){background:color-mix(in srgb,var(--bt-ink) 4%,var(--bt-main));color:var(--bt-ink)}+.bt-mw-stop:active:not(:disabled){scale:.9}+.bt-mw-stop:disabled{opacity:.35;cursor:default}.bt-mw-pill-in{display:inline-flex;align-items:center;gap:8px;flex:none;padding:0 13px 0 6px;white-space:nowrap}.bt-mw-faces{display:inline-flex;align-items:center;flex:none;line-height:0}.bt-mw-face{position:relative;display:inline-flex;flex:none;border-radius:50%;background:var(--bt-main);box-shadow:0 0 0 2px var(--bt-main);animation:bt-mw-seat .26s cubic-bezier(.34,1.56,.64,1) backwards}@@ -16164,7 +16191,7 @@ body[data-ds-dark-theme] .bt-member-state.bt-mw-ask{color:#f0b84a}.bt-mw-actions{display:flex;justify-content:flex-end;gap:6px;margin-top:4px}.bt-mw-actions>button{height:28px;padding:0 12px;font-size:12px}.bt-mw-actions>button:disabled{opacity:.5;cursor:default}-@media (prefers-reduced-motion:reduce){.bt-mw-pill,.bt-mw-face,.bt-mw-label,.bt-member,.bt-mw-card{animation:none}.bt-mw-pill{transition:background-color .12s ease}}+@media (prefers-reduced-motion:reduce){.bt-mw-pill,.bt-mw-stop,.bt-mw-face,.bt-mw-label,.bt-member,.bt-mw-card{animation:none}.bt-mw-pill{transition:background-color .12s ease}.bt-mw-stop{transition:background-color .12s ease,color .12s ease}}`;// src/client/details-drawer.js@@ -16571,7 +16598,7 @@ var GlobeIcon2 = icon(["M10 3a7 7 0 1 0 0 14 7 7 0 0 0 0-14z", "M3 10h14", "M10var BackIcon = icon(["M12.5 4.5L7 10l5.5 5.5"]);var ForwardIcon = icon(["M7.5 4.5L13 10l-5.5 5.5"]);var ReloadIcon = icon(["M15.5 10a5.5 5.5 0 1 1-1.6-3.9", "M15.5 3.5v3.5H12"]);-var StopIcon = icon(["M5.5 5.5l9 9M14.5 5.5l-9 9"]);+var StopIcon2 = icon(["M5.5 5.5l9 9M14.5 5.5l-9 9"]);var CloseIcon2 = icon(["M5.5 5.5l9 9M14.5 5.5l-9 9"]);var PlusTabIcon = icon(["M10 5v10M5 10h10"]);var LockIcon2 = icon(["M6.5 9V7a3.5 3.5 0 0 1 7 0v2", "M5.5 9h9v7h-9z"]);@@ -17009,7 +17036,7 @@ function BrowserView({ bot, tabId, leaving, landed, actions, useBrowserPages, ho"aria-label": page.loading ? t("Stop") : t("Reload"),title: page.loading ? t("Stop") : t("Reload"),onClick: () => actions.browserCommand(tabId, page.loading ? "stop" : "reload")- }, (0, import_react43.createElement)(page.loading ? StopIcon : ReloadIcon)),+ }, (0, import_react43.createElement)(page.loading ? StopIcon2 : ReloadIcon)),(0, import_react43.createElement)("form",{ className: "bt-browser-address", onSubmit: go, "data-editing": editing || void 0 },diff --git a/ds-bot/src/client/i18n.js b/ds-bot/src/client/i18n.jsindex d5e99a8b..e1f7102e 100644--- a/ds-bot/src/client/i18n.js+++ b/ds-bot/src/client/i18n.js@@ -589,6 +589,7 @@ const ZH = {'{first}, {second} and {count} more are waiting for your approval': '{first}、{second} 等 {total} 个等你批准','Waiting for your approval': '等你批准','in its own chat': '在自己的对话里',+ 'Stop all work in this group': '停止本群的所有工作',Reject: '拒绝','Allow once': '允许一次',"Couldn't message {name}": '没能给 {name} 发消息',diff --git a/ds-bot/src/client/icons.js b/ds-bot/src/client/icons.jsindex eee56758..09400e0a 100644--- a/ds-bot/src/client/icons.js+++ b/ds-bot/src/client/icons.js@@ -36,6 +36,9 @@ export function ShareIcon() {export function CloseIcon() {return h('svg', { width: 16, height: 16, viewBox: '0 0 20 20', 'aria-hidden': true }, h('path', { d: 'M5 5l10 10M15 5L5 15', stroke: 'currentColor', strokeWidth: 1.6, strokeLinecap: 'round' }))}+export function StopIcon() {+ return h('svg', { width: 16, height: 16, viewBox: '0 0 20 20', 'aria-hidden': true }, h('rect', { x: 4, y: 4, width: 12, height: 12, rx: 2.5, fill: 'currentColor' }))+}export const ChevronLeftIcon = () => h('svg', { width: 16, height: 16, viewBox: '0 0 20 20', fill: 'none', stroke: 'currentColor', strokeWidth: 1.6, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true }, h('path', { d: 'M12.5 4.5L7 10l5.5 5.5' }))export const ChevronRightIcon = () => h('svg', { width: 14, height: 14, viewBox: '0 0 20 20', fill: 'none', stroke: 'currentColor', strokeWidth: 1.6, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true }, h('path', { d: 'M7.5 4.5L13 10l-5.5 5.5' }))diff --git a/ds-bot/src/client/member-status.js b/ds-bot/src/client/member-status.jsindex c3d74e9a..b99a281c 100644--- a/ds-bot/src/client/member-status.js+++ b/ds-bot/src/client/member-status.js@@ -1,6 +1,7 @@import { createElement as h, useLayoutEffect, useRef, useState } from 'react'import { BotMark, toolState } from './mark.js'import { Elapsed, Shimmer, workPhrase } from './cells.js'+import { StopIcon } from './icons.js'import { SPRING_SHAPE, SPRING_TAP, spring, useLinger } from './motion.js'import { t } from './i18n.js'@@ -63,11 +64,14 @@ export function summaryText(busy) {function dockModel(sessionId, roster, work) {const room = roster.roomsById[sessionId]if (room) {- const busy = dockMembers(busyMembers(room, work, roster))+ const all = busyMembers(room, work, roster)+ const busy = dockMembers(all)if (busy.length === 0) return nullconst { waiting, doing } = summaryText(busy)return {open: { details: room.id },+ // A member busy only elsewhere is shown here, but its work is not this group's to stop.+ ...(all.some(entry => entry.here) ? { stop: room.id } : {}),faces: busy.slice(0, FACES_MAX).map(entry => ({ id: entry.id, ask: entry.state === 'ask', state: workState(entry.doing) })),waiting, doing,}@@ -99,6 +103,20 @@ function useFitWidth(inner, key) {return width}+// Beside a group's capsule, one press stops everything at work in the group: DSH's own+// stop reaches only the round, and a member the round moved on from keeps working.+function StopRoomWork({ roomId, actions }) {+ const [stopping, setStopping] = useState(false)+ const stop = () => {+ setStopping(true)+ void Promise.resolve(actions.stopRoomWork(roomId))+ .catch(error => actions.reportError(error, 'stop'))+ .finally(() => setStopping(false))+ }+ const label = t('Stop all work in this group')+ return h('button', { type: 'button', className: 'bt-mw-stop', 'aria-label': label, title: label, disabled: stopping, onClick: stop }, h(StopIcon))+}+// Above the composer, one capsule for everything at work: it opens the group's details,// or from a Bot's own chat the group it is at work in.export function MemberDock({ sessionId, useRoster, useWork, actions }) {@@ -113,14 +131,17 @@ export function MemberDock({ sessionId, useRoster, useWork, actions }) {const faces = model.faces.map(face => ({ ...face, bot: roster.byId[face.id] })).filter(face => face.bot)const label = [model.waiting, model.doing].filter(Boolean).join(' · ')const open = () => (model.open.details ? actions.showDetails(model.open.details) : actions.openSession(model.open.session))+ // The stop button hangs off the capsule's side, so the capsule stays centred.return h('div', { className: 'bt-mw-dock', 'data-leaving': leaving || undefined },- h('button', { type: 'button', className: 'bt-mw-pill', 'aria-label': label, onClick: open, disabled: leaving, style: width ? { width } : undefined },- h('span', { ref: inner, className: 'bt-mw-pill-in' },- h('span', { className: 'bt-mw-faces', 'aria-hidden': true }, faces.map(face => h(Face, { key: face.id, ...face }))),- h('span', { key: label, className: 'bt-mw-label', 'aria-hidden': true },- model.waiting ? h('span', { className: 'bt-mw-ask' }, model.waiting) : null,- model.waiting && model.doing ? h('span', { className: 'bt-mw-dot' }, '·') : null,- model.doing ? h('span', { className: 'bt-mw-doing' }, h(Shimmer, null, model.doing)) : null))))+ h('span', { className: 'bt-mw-pair' },+ h('button', { type: 'button', className: 'bt-mw-pill', 'aria-label': label, onClick: open, disabled: leaving, style: width ? { width } : undefined },+ h('span', { ref: inner, className: 'bt-mw-pill-in' },+ h('span', { className: 'bt-mw-faces', 'aria-hidden': true }, faces.map(face => h(Face, { key: face.id, ...face }))),+ h('span', { key: label, className: 'bt-mw-label', 'aria-hidden': true },+ model.waiting ? h('span', { className: 'bt-mw-ask' }, model.waiting) : null,+ model.waiting && model.doing ? h('span', { className: 'bt-mw-dot' }, '·') : null,+ model.doing ? h('span', { className: 'bt-mw-doing' }, h(Shimmer, null, model.doing)) : null))),+ model.stop ? h(StopRoomWork, { roomId: model.stop, actions }) : null))}// The clock stays whole at the end; only what comes before it is cut.@@ -188,7 +209,12 @@ export const MEMBER_CSS = `.bt-mw-pill{pointer-events:auto;position:relative;display:inline-flex;align-items:center;flex:none;box-sizing:border-box;height:32px;max-width:100%;padding:0;border:0;border-radius:999px;overflow:hidden;background:var(--bt-main);box-shadow:0 0 0 .5px var(--bt-line-2),0 2px 8px -2px rgba(0,0,0,.12);color:var(--bt-ink-2);font:inherit;font-size:13px;line-height:18px;cursor:pointer;animation:bt-mw-in ${SPRING_SHAPE.duration}ms ${SPRING_SHAPE.easing} backwards,bt-veil-in .18s ease-out backwards;transition:background-color .12s ease,${spring(SPRING_SHAPE, 'width')},${spring(SPRING_TAP, 'scale')}}.bt-mw-pill:hover{background:color-mix(in srgb,var(--bt-ink) 4%,var(--bt-main))}.bt-mw-pill:active{scale:.97}-.bt-mw-dock[data-leaving] .bt-mw-pill{animation:bt-mw-out .16s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}+.bt-mw-dock[data-leaving] .bt-mw-pill,.bt-mw-dock[data-leaving] .bt-mw-stop{animation:bt-mw-out .16s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}+.bt-mw-pair{position:relative;display:inline-flex;min-width:0;max-width:100%}+.bt-mw-stop{pointer-events:auto;position:absolute;top:0;left:calc(100% + 6px);display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:50%;background:var(--bt-main);box-shadow:0 0 0 .5px var(--bt-line-2),0 2px 8px -2px rgba(0,0,0,.12);color:var(--bt-ink-2);cursor:pointer;animation:bt-mw-in ${SPRING_SHAPE.duration}ms ${SPRING_SHAPE.easing} backwards,bt-veil-in .18s ease-out backwards;transition:background-color .12s ease,color .12s ease,${spring(SPRING_TAP, 'scale')}}+.bt-mw-stop:hover:not(:disabled){background:color-mix(in srgb,var(--bt-ink) 4%,var(--bt-main));color:var(--bt-ink)}+.bt-mw-stop:active:not(:disabled){scale:.9}+.bt-mw-stop:disabled{opacity:.35;cursor:default}.bt-mw-pill-in{display:inline-flex;align-items:center;gap:8px;flex:none;padding:0 13px 0 6px;white-space:nowrap}.bt-mw-faces{display:inline-flex;align-items:center;flex:none;line-height:0}.bt-mw-face{position:relative;display:inline-flex;flex:none;border-radius:50%;background:var(--bt-main);box-shadow:0 0 0 2px var(--bt-main);animation:bt-mw-seat .26s cubic-bezier(.34,1.56,.64,1) backwards}@@ -232,5 +258,5 @@ body[data-ds-dark-theme] .bt-member-state.bt-mw-ask{color:#f0b84a}.bt-mw-actions{display:flex;justify-content:flex-end;gap:6px;margin-top:4px}.bt-mw-actions>button{height:28px;padding:0 12px;font-size:12px}.bt-mw-actions>button:disabled{opacity:.5;cursor:default}-@media (prefers-reduced-motion:reduce){.bt-mw-pill,.bt-mw-face,.bt-mw-label,.bt-member,.bt-mw-card{animation:none}.bt-mw-pill{transition:background-color .12s ease}}+@media (prefers-reduced-motion:reduce){.bt-mw-pill,.bt-mw-stop,.bt-mw-face,.bt-mw-label,.bt-member,.bt-mw-card{animation:none}.bt-mw-pill{transition:background-color .12s ease}.bt-mw-stop{transition:background-color .12s ease,color .12s ease}}`diff --git a/ds-bot/src/client/team-actions.js b/ds-bot/src/client/team-actions.jsindex d8ada868..5d1b83b8 100644--- a/ds-bot/src/client/team-actions.js+++ b/ds-bot/src/client/team-actions.js@@ -99,6 +99,7 @@ export function teamActions({ call, after, partFor, roster, ui, live, cards, heldismissView: sessionId => after(call('dismiss-view', { sessionId: partFor(sessionId) })),answerApproval: (id, choice) => after(call('approval-answer', { id, choice })),stopMemberWork: (roomId, botId) => after(call('stop-member-work', { roomId, botId })),+ stopRoomWork: roomId => after(call('stop-room-work', { roomId })),// Values go out in these requests and never come back in a response.secretSet: payload => after(call('secret-set', payload)),secretAllow: requestId => after(call('secret-allow', { requestId })),diff --git a/ds-bot/src/host/channel.js b/ds-bot/src/host/channel.jsindex 4723051a..45de699f 100644--- a/ds-bot/src/host/channel.js+++ b/ds-bot/src/host/channel.js@@ -311,6 +311,8 @@ export function install(rt) {return ok(true)case 'stop-member-work':return ok(await rt.stopMemberWork(String(body.roomId ?? ''), String(body.botId ?? '')))+ case 'stop-room-work':+ return ok(await rt.stopRoomWork(String(body.roomId ?? '')))case 'dismiss-question':await rt.load()if (rt.own(state.questions, body.sessionId) !== undefined) {diff --git a/ds-bot/src/host/groups.js b/ds-bot/src/host/groups.jsindex 223913d8..8b6f061c 100644--- a/ds-bot/src/host/groups.js+++ b/ds-bot/src/host/groups.js@@ -900,6 +900,22 @@ export function install(rt) {}rt.stopMemberWork = stopMemberWork+ // The user stops everything at work in this group at once: the round the group's own+ // Session runs, which takes the member turns it started with it, then each member's+ // turn here. The round goes first, so it calls no one else meanwhile. Work the same+ // Bots do in their own chats or other groups goes on.+ async function stopRoomWork(roomId) {+ await rt.load()+ const room = rt.roomOf(roomId)+ if (room === undefined) return false+ const round = rt.roomBusy(room.id)+ if (round) (await rt.resolveAgent(room.id)).cancel({ kind: 'user' })+ let stopped = false+ for (const botId of room.members) stopped = (await stopMemberWork(room.id, botId)) || stopped+ return round || stopped+ }+ rt.stopRoomWork = stopRoomWork+// The round said such a member posts when done; a failed model call is how it ended.// Nobody answers it.async function lateRoomFailure(sessionId, info, failure) {diff --git a/ds-bot/test/group-work.test.js b/ds-bot/test/group-work.test.jsindex eea9c588..6c00427c 100644--- a/ds-bot/test/group-work.test.js+++ b/ds-bot/test/group-work.test.js@@ -725,6 +725,27 @@ test('the user stops a member\'s work in a group, and the group shows it', asyncassert.deepEqual(log.map(line => [line.who, line.kind]), [['Writer', 'stopped']])})+// #592: DSH's own stop reaches only the round; a member the round moved on from kept working.+test('one press stops the group\'s round and every member at work there, and nothing elsewhere', async (t) => {+ const host = await start(t)+ assert.equal((await host.call('stop-room-work', { roomId: 'r1' })).value, false)+ // Writer still works on what an earlier round asked; Chief speaks in the round that runs.+ host.emit('gb', 'turn/start', { turn: 1 })+ const first = host.round('c1', host.say('@Chief 看看进度'))+ await settle(() => host.agentOf('ga').calls.length === 1)+ host.begin('ga')+ // Tester works in its own chat.+ host.emit('c', 'turn/start', { turn: 1 })+ const stopped = await host.call('stop-room-work', { roomId: 'r1' })+ assert.deepEqual([stopped.ok, stopped.value], [true, true])+ for (const id of ['r1', 'ga', 'gb']) assert.deepEqual(host.agentOf(id).cancelled, [{ kind: 'user' }], id)+ for (const id of ['c', 'gc']) assert.deepEqual(host.agentOf(id).cancelled, [], id)+ assert.deepEqual(logLines(host).map(line => [line.who, line.kind]), [['User', undefined], ['Chief', 'stopped'], ['Writer', 'stopped']])+ host.emit('ga', 'turn/end', { turn: 1, reason: { kind: 'aborted' } })+ await settle(() => first() !== undefined)+ assert.deepEqual(kinds(first()).filter(([kind]) => kind === 'stopped'), [['stopped', 'Chief'], ['stopped', 'Writer']])+})+test('members still at work show in the team view and in the prompts of the others', async (t) => {const host = await start(t)host.emit('gb', 'turn/start', { turn: 1 })diff --git a/ds-bot/test/member-status.test.js b/ds-bot/test/member-status.test.jsindex e3252422..aef235f7 100644--- a/ds-bot/test/member-status.test.js+++ b/ds-bot/test/member-status.test.js@@ -114,6 +114,47 @@ test('one capsule names who waits and who works, without the round\'s speaker, aassert.equal(dock('r1', { bots: {}, rooms: { r1: [{ botId: 'd', since: 1, speaking: true }] }, approvals: [] }), null)})+// The stop button beside the capsule, rendered.+const stopOf = (sessionId, work, actions = {}) => {+ const find = (node) => {+ if (node === null || typeof node !== 'object') return null+ if (node.type?.name === 'StopRoomWork') return node.type(node.props)+ for (const child of node.children) {+ const found = find(child)+ if (found) return found+ }+ return null+ }+ return find(MemberDock({ sessionId, useRoster: pick => pick(team), useWork: pick => pick(work), actions }))+}++// #592: DSH's own stop reaches only the round; a member the round moved on from kept working.+test('a stop button beside a group\'s capsule stops all work there, and only there', async () => {+ const stopped = []+ const button = stopOf('r1', { bots: {}, rooms: { r1: [{ botId: 'a', since: 1, tool: 'pwsh' }] }, approvals: [] }, { stopRoomWork: id => stopped.push(id) })+ assert.equal(button.props['aria-label'], 'Stop all work in this group')+ button.props.onClick()+ await Promise.resolve()+ assert.deepEqual(stopped, ['r1'])+ // Members busy only in their own chats or other groups show in the capsule, with nothing here to stop.+ const elsewhere = { bots: { a: { since: 1, tool: 'pwsh' }, b: { since: 1, roomId: 'r2' } }, rooms: { r2: [{ botId: 'b', since: 1 }] }, approvals: [] }+ assert.ok(dock('r1', elsewhere))+ assert.equal(stopOf('r1', elsewhere), null)+ // A Bot's own chat shows its group work, but stopping it belongs to the group.+ assert.equal(stopOf('a', { bots: { a: { since: 1, roomId: 'r1' } }, rooms: { r1: [{ botId: 'a', since: 1 }] }, approvals: [] }), null)+})++test('a failed stop of a group\'s work is reported', async () => {+ const reported = []+ const button = stopOf('r1', { bots: {}, rooms: { r1: [{ botId: 'a', since: 1 }] }, approvals: [{ botId: 'a', roomId: 'r1', at: 1 }] }, {+ stopRoomWork: () => Promise.reject(new Error('connection lost')),+ reportError: (error, action) => reported.push([error.message, action]),+ })+ button.props.onClick()+ await new Promise(resolve => setImmediate(resolve))+ assert.deepEqual(reported, [['connection lost', 'stop']])+})+test('a Bot\'s own chat shows the groups it is at work in, unless its own chat runs', () => {const away = { bots: { a: { since: 1, roomId: 'r1', tool: 'pwsh' } }, rooms: { r1: [{ botId: 'a', since: 1, tool: 'pwsh' }], r2: [{ botId: 'a', since: 1 }] }, approvals: [] }assert.deepEqual(plain(dock('a', away)), { label: 'in Ops · Running shell commands… +1', calls: [['session', 'r1']] })diff --git a/ds-bot/test/own-keys.test.js b/ds-bot/test/own-keys.test.jsindex 37733a69..0684434c 100644--- a/ds-bot/test/own-keys.test.js+++ b/ds-bot/test/own-keys.test.js@@ -91,6 +91,7 @@ const ENDPOINTS = [['delete-room', id => ({ id })],['stop-member-work', id => ({ roomId: id, botId: 'b2' })],['stop-member-work', id => ({ roomId: 'r1', botId: id })],+ ['stop-room-work', id => ({ roomId: id })],['schedule-create', id => ({ target: id, title: 't', prompt: 'p', when: { kind: 'every', minutes: 5 } })],['dismiss-question', id => ({ sessionId: id })],['answer-question', id => ({ sessionId: id, questionId: 'q1', answer: 'yes' })],