A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Read the saved mention list of a long group post, not only its opening
Fei2411470baa097050
diff --git a/ds-bot/client.js b/ds-bot/client.jsindex 57d20937..255db8d8 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -4332,7 +4332,7 @@ var HANDOFF_CSS = `.bt-handoff .bt-q-foot{flex-wrap:wrap}`;-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/deep-view/src/react/ui.js+// node_modules/deep-view/src/react/ui.jsvar import_react7 = require("react");var FallbackMarkdown = ({ text }) => (0, import_react7.createElement)("span", null, String(text ?? ""));var ViewUi = (0, import_react7.createContext)({ t: (key) => key, Markdown: FallbackMarkdown });@@ -4399,7 +4399,7 @@ function useOptionKeys2(count, onPick, ownRef) {return count > 0 && listening <= 1;}-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/deep-view/src/core/formula.js+// node_modules/deep-view/src/core/formula.jsvar FUNCTIONS = {min: { args: [1, Infinity], run: (...values) => Math.min(...values.map(num)) },max: { args: [1, Infinity], run: (...values) => Math.max(...values.map(num)) },@@ -4680,7 +4680,7 @@ function evaluate(tree, lookup) {}}-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/deep-view/src/core/views.js+// node_modules/deep-view/src/core/views.jsvar LAYOUT = ["stack", "row"];var DISPLAY = ["text", "metric", "table", "chart", "progress", "callout", "sources", "html"];var INPUT_TYPES = ["slider", "choice", "toggle", "number"];@@ -5300,7 +5300,7 @@ function validateForm(node, values) {return { fields };}-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/deep-view/src/react/chart.js+// node_modules/deep-view/src/react/chart.jsvar import_react8 = require("react");var PALETTE = ["var(--dv-accent)", "var(--dv-ink-tangerine)", "var(--dv-ink-green)", "var(--dv-ink-violet)", "var(--dv-ink-sky)", "var(--dv-ink-rose)", "var(--dv-ink-yellow)", "var(--dv-ink-cyan)", "var(--dv-ink-magenta)"];var colorAt = (index) => PALETTE[index % PALETTE.length];@@ -5739,7 +5739,7 @@ var CHART_CSS = `@media (prefers-reduced-motion:reduce){.dv-chart-mark,.dv-chart-dot{transition:none}.dv-chart-tip{animation:none}}`;-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/deep-view/src/react/frame.js+// node_modules/deep-view/src/react/frame.jsvar import_react9 = require("react");var THEME_VARS = [["--view-ink", "--bt-ink", "--dv-ink"],@@ -5821,7 +5821,7 @@ var HTML_CSS = `.dv-view-frame-stopped{margin:0;font-size:13px;line-height:18px;color:var(--dv-ink-2)}`;-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/deep-view/src/react/card.js+// node_modules/deep-view/src/react/card.jsvar import_react10 = require("react");var mdLabels = (ui2) => ({ code: { copyLabel: ui2.t("Copy"), copiedLabel: ui2.t("Copied") }, footnotes: ui2.t("Footnotes") });var TONES2 = ["good", "warn", "bad"];@@ -6490,7 +6490,7 @@ ${CHART_CSS}${HTML_CSS}`;-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/deep-view/src/react/styles.js+// node_modules/deep-view/src/react/styles.jsvar THEME_CSS = `body{--dv-ink:var(--dsw-alias-label-primary);@@ -6587,10 +6587,10 @@ button.dv-q-opt:active{background:var(--dv-active)}@media (prefers-reduced-motion:reduce){.dv-q,.dv-view-bare,.dv-q-submit,.dv-menu,.dv-q-check{animation:none}}`;-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/deep-view/src/react/index.js+// node_modules/deep-view/src/react/index.jsvar DEEP_VIEW_CSS = THEME_CSS + QUESTION_CSS + WIDGET_CSS;-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/deep-view/src/core/reply.js+// node_modules/deep-view/src/core/reply.jsvar REPLY_KIND = "user-question-reply";function viewCardText(args) {let card = args;diff --git a/ds-bot/office.js b/ds-bot/office.jsindex a4aab41b..ada743e1 100644--- a/ds-bot/office.js+++ b/ds-bot/office.js@@ -34,9 +34,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__gemod));-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/conventions.js+// node_modules/@xmldom/xmldom/lib/conventions.jsvar require_conventions = __commonJS({- "../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/conventions.js"(exports) {+ "node_modules/@xmldom/xmldom/lib/conventions.js"(exports) {"use strict";function find(list, predicate, ac) {if (ac === void 0) {@@ -243,9 +243,9 @@ var require_conventions = __commonJS({}});-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/errors.js+// node_modules/@xmldom/xmldom/lib/errors.jsvar require_errors = __commonJS({- "../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/errors.js"(exports) {+ "node_modules/@xmldom/xmldom/lib/errors.js"(exports) {"use strict";var conventions = require_conventions();function extendError(constructor, writableName) {@@ -402,9 +402,9 @@ var require_errors = __commonJS({}});-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/grammar.js+// node_modules/@xmldom/xmldom/lib/grammar.jsvar require_grammar = __commonJS({- "../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/grammar.js"(exports) {+ "node_modules/@xmldom/xmldom/lib/grammar.js"(exports) {"use strict";function detectUnicodeSupport(RegExpImpl) {try {@@ -609,9 +609,9 @@ var require_grammar = __commonJS({}});-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/dom.js+// node_modules/@xmldom/xmldom/lib/dom.jsvar require_dom = __commonJS({- "../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/dom.js"(exports) {+ "node_modules/@xmldom/xmldom/lib/dom.js"(exports) {"use strict";var conventions = require_conventions();var find = conventions.find;@@ -3276,9 +3276,9 @@ var require_dom = __commonJS({}});-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/entities.js+// node_modules/@xmldom/xmldom/lib/entities.jsvar require_entities = __commonJS({- "../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/entities.js"(exports) {+ "node_modules/@xmldom/xmldom/lib/entities.js"(exports) {"use strict";var freeze = require_conventions().freeze;exports.XML_ENTITIES = freeze({@@ -5419,9 +5419,9 @@ var require_entities = __commonJS({}});-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/sax.js+// node_modules/@xmldom/xmldom/lib/sax.jsvar require_sax = __commonJS({- "../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/sax.js"(exports) {+ "node_modules/@xmldom/xmldom/lib/sax.js"(exports) {"use strict";var conventions = require_conventions();var g = require_grammar();@@ -6201,9 +6201,9 @@ var require_sax = __commonJS({}});-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/dom-parser.js+// node_modules/@xmldom/xmldom/lib/dom-parser.jsvar require_dom_parser = __commonJS({- "../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/dom-parser.js"(exports) {+ "node_modules/@xmldom/xmldom/lib/dom-parser.js"(exports) {"use strict";var conventions = require_conventions();var dom = require_dom();@@ -6469,9 +6469,9 @@ var require_dom_parser = __commonJS({}});-// ../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/index.js+// node_modules/@xmldom/xmldom/lib/index.jsvar require_lib = __commonJS({- "../../../DS Bot/DeepSeek-Bot/ds-bot/node_modules/@xmldom/xmldom/lib/index.js"(exports) {+ "node_modules/@xmldom/xmldom/lib/index.js"(exports) {"use strict";var conventions = require_conventions();exports.assign = conventions.assign;diff --git a/ds-bot/src/host/groups.js b/ds-bot/src/host/groups.jsindex ab8364d8..9bdff2fa 100644--- a/ds-bot/src/host/groups.js+++ b/ds-bot/src/host/groups.js@@ -108,6 +108,24 @@ export const mentionsIn = (text, members, references = []) => {return { all, found }}+// post_to_group resolves "@" on the whole message and stores it on the post. A post+// past MESSAGE_INLINE_MAX keeps only its first LONG_HEAD characters in `text`, so+// reading "@" there would miss anyone named further on. Undefined for a user's+// message, a late reply, or a step line, which were not sent that way.+// A saved list ignores opener.references. post_to_group posts carry none today; if+// they gain references, handle them together with this list.+function mentionsOf(opener, everyone) {+ const saved = opener?.mentions+ if (saved === undefined || !Array.isArray(saved.ids)) return undefined+ const byId = new Map(everyone.map(bot => [bot.id, bot]))+ const found = []+ for (const id of saved.ids) {+ const bot = byId.get(id)+ if (bot !== undefined && !found.includes(bot)) found.push(bot)+ }+ return { all: saved.all === true, found }+}+// What the user referenced in this round, for a member that has not been shown it yet.export const referenceNote = references => (references?.length? `Conversations the user referenced in this round:\n\n${references.map(reference => reference.text).join('\n\n')}`@@ -837,8 +855,10 @@ export function install(rt) {const open = posts.filter(post => post.called !== true)const opener = open.findLast(post => !event(post) && !callsNobody(post)) ?? open.findLast(post => !event(post)) ?? open.at(-1) ?? { text: '', quiet: true }const references = posts.flatMap(post => post.references ?? [])- // A member a Bot's post calls by name works for that Bot.- const named = opener.botId === undefined ? [] : mentionsIn(opener.text ?? '', room.members.map(rt.botOf).filter(Boolean)).found+ // A member a Bot's post calls by name works for that Bot. The saved list is the+ // whole message; the text may be only its opening.+ const everyone = room.members.map(rt.botOf).filter(Boolean)+ const named = opener.botId === undefined ? [] : (mentionsOf(opener, everyone) ?? mentionsIn(opener.text ?? '', everyone)).foundconst { speakers, ordered } = openingCall(room, opener)const calledByOpener = speakers.filter(member => named.includes(member))const openingBatchKey = opener.botId !== undefined && calledByOpener.length > 0 ? registerBatch(room.id, opener.botId, calledByOpener) : undefined@@ -1014,7 +1034,7 @@ export function install(rt) {if (opener.kickoff) return at(admin ? [admin] : [])if (opener.quiet) return at([])if (opener.done) return at(members.filter(bot => bot.id === opener.askedBy))- const { all, found: named } = mentionsIn(opener.text, everyone, opener.references)+ const { all, found: named } = mentionsOf(opener, everyone) ?? mentionsIn(opener.text, everyone, opener.references)const found = named.filter(bot => bot.id !== opener.botId)if (opener.progress) return at(found)if (opener.late) {@@ -1042,7 +1062,8 @@ export function install(rt) {const post = { ...extra, botId: sender.id, name: sender.name, text }const { speakers, ordered } = openingCall(room, post)if (speakers.length === 0) return false- const named = mentionsIn(text, room.members.map(rt.botOf).filter(Boolean)).found+ const everyone = room.members.map(rt.botOf).filter(Boolean)+ const named = (mentionsOf(post, everyone) ?? mentionsIn(text, everyone)).foundconst by = speakers.filter(peer => named.includes(peer))const rest = speakers.filter(peer => !named.includes(peer))const note = extra.done ? `${sender.name} finished the work you asked for` : undefineddiff --git a/ds-bot/src/host/tools.js b/ds-bot/src/host/tools.jsindex c8a3a7e9..9ec11c48 100644--- a/ds-bot/src/host/tools.js+++ b/ds-bot/src/host/tools.js@@ -576,7 +576,14 @@ export function install(rt) {if (info?.role === 'room' && info.roomId === room.id) return `You are speaking in "${room.name}" right now. Write your message as your reply instead.`const text = absoluteLinks(String(args.message ?? '').trim(), rt.sessionFolder?.(exec.agent?.session ?? exec.agent))if (text === '') return 'Write a message to post.'- const named = mentionSpans(text, room.members.map(rt.botOf).filter(Boolean)).flatMap(span => (span.bot && span.bot.id !== self ? [span.bot.id] : []))+ // Counted on the whole message. A post past MESSAGE_INLINE_MAX keeps only its+ // first LONG_HEAD characters, and the round reads this list instead of that text.+ const spans = mentionSpans(text, room.members.map(rt.botOf).filter(Boolean))+ const named = []+ for (const span of spans) {+ if (span.bot && span.bot.id !== self && !named.includes(span.bot.id)) named.push(span.bot.id)+ }+ const mentions = { ids: named, all: spans.some(span => span.all === true) }const reportBack = args.report_back === trueif (member && reportBack && named.length === 0) {return 'Nobody would answer: your post only calls the members you name. Write "@Name" for each member who should answer, or post without report_back.'@@ -589,7 +596,7 @@ export function install(rt) {const sub = work === undefined ? undefined : randomUUID()if (sub !== undefined) rt.openWork(sub, { from: self, room: room.id, parent: work })try {- await rt.postToRoom(room, sender, long.text, { ...(reportBack ? { reportBack: true } : {}), ...(member ? { member: true } : {}), ...(sub ? { sub } : {}), ...(long.length ? { length: long.length } : {}) }, long.files)+ await rt.postToRoom(room, sender, long.text, { mentions, ...(reportBack ? { reportBack: true } : {}), ...(member ? { member: true } : {}), ...(sub ? { sub } : {}), ...(long.length ? { length: long.length } : {}) }, long.files)} catch (failure) {if (sub !== undefined) rt.dropWork(sub)return `Could not post in "${room.name}": ${failure.message}`diff --git a/ds-bot/src/host/turns.js b/ds-bot/src/host/turns.jsindex a4c375ec..1978b34b 100644--- a/ds-bot/src/host/turns.js+++ b/ds-bot/src/host/turns.js@@ -625,6 +625,8 @@ export function install(rt) {name: source.senderName,reportBack: source.reportBack === true,...(source.member ? { member: true } : {}),+ // Who the whole post called. `text` may be only its opening (attachLong).+ ...(source.mentions ? { mentions: source.mentions } : {}),...(source.sub ? { sub: source.sub } : {}),...(source.late ? { late: true } : {}),...(source.progress ? { progress: true } : {}),diff --git a/ds-bot/test/group-work.test.js b/ds-bot/test/group-work.test.jsindex 3d1c19c4..b9b2a053 100644--- a/ds-bot/test/group-work.test.js+++ b/ds-bot/test/group-work.test.js@@ -5,7 +5,7 @@ import { join } from 'node:path'import { test } from 'node:test'import { apply } from '../index.js'import { fakeAttachments, fakeContext } from './fake-ctx.js'-import { MESSAGE_INLINE_MAX, ROOM_STEP_GAP_MS, ROOM_WORK_GRACE_MS } from '../src/host/constants.js'+import { LONG_HEAD, MESSAGE_INLINE_MAX, ROOM_STEP_GAP_MS, ROOM_WORK_GRACE_MS } from '../src/host/constants.js'// Chief, the admin of group 'r1', speaks there from 'ga'; Writer from 'gb'; Tester from 'gc'.const seed = (room = {}, extraRooms = {}) => ({@@ -593,6 +593,193 @@ test('a Main Bot outside the group posts into its running round, and a long postassert.equal(logLines(host).filter(entry => entry.files?.length === 1).length, 1)})+// #198: a post past MESSAGE_INLINE_MAX keeps its first LONG_HEAD characters and a file.+// "@" past that opening is taken from the whole message, before the cut.+const filler = count => '文'.repeat(count)+const postBody = post => text(post).replace(/^\[Group post from [^\n]*\n/, '')+const fileOf = (store, post) => {+ const file = post.content.find(block => block.type === 'file')?.attachment+ return { file, whole: file === undefined ? undefined : new TextDecoder().decode(store.files.get(file.attachmentId)) }+}+const orderOf = message => text(message).match(/Members answer this message one at a time: .+\./)?.[0]+const togetherOf = message => text(message).match(/Called together with you: [^.]+\./)?.[0]++test('a long post calls a member named past the preview, and the preview stays the opening', async (t) => {+ const store = fakeAttachments()+ const host = await start(t, {}, { attachments: store })+ const message = `${filler(LONG_HEAD)}@Tester 看一下${filler(MESSAGE_INLINE_MAX)}`+ assert.equal(message.indexOf('@Tester'), LONG_HEAD)+ assert.ok(message.length > MESSAGE_INLINE_MAX)+ await host.tool('post_to_group', { group: 'Ops', message }, 'a')+ await assert.rejects(host.tool('message_bot', { to: 'Tester', message: '再看一眼' }, 'a'), /^Error: Not sent: you called Tester in "Ops" in this turn/)+ const post = host.takePost()+ assert.deepEqual(post.source.mentions, { ids: ['c'], all: false })+ assert.equal(post.source.length, message.length)+ const { file, whole } = fileOf(store, post)+ assert.equal(file?.name, 'Post from Chief.txt')+ assert.equal(whole, message)+ const shown = postBody(post)+ assert.ok(shown.length < message.length)+ assert.ok(shown.startsWith(`[A long message: ${message.length} characters.`))+ assert.ok(shown.includes(`${message.slice(0, LONG_HEAD)}…`))+ assert.equal(shown.includes('@Tester'), false)++ const round = host.round('c1', post)+ await settle(() => host.agentOf('gc').calls.length === 1)+ const turn = host.agentOf('gc').calls[0]+ assert.equal(host.begin('gc').source.askedBy, 'a')+ assert.ok(turn.content.some(block => block.type === 'file' && block.attachment?.attachmentId === file.attachmentId))+ assert.equal(text(turn).includes('@Tester'), false)+ host.finish('gc', '看过了。')+ await settle(() => round() !== undefined)+ assert.deepEqual(host.agentOf('gb').calls, [])+ assert.deepEqual(host.agentOf('ga').calls, [])+})++test('a long post still calls a member named in its opening', async (t) => {+ const store = fakeAttachments()+ const host = await start(t, {}, { attachments: store })+ const message = `@Tester ${filler(MESSAGE_INLINE_MAX)}`+ assert.ok(message.indexOf('@Tester') < LONG_HEAD)+ assert.ok(message.length > MESSAGE_INLINE_MAX)+ await host.tool('post_to_group', { group: 'Ops', message }, 'a')+ const post = host.takePost()+ assert.deepEqual(post.source.mentions, { ids: ['c'], all: false })+ assert.equal(fileOf(store, post).whole, message)+ assert.equal(postBody(post).includes('@Tester'), true)+ const round = host.round('c1', post)+ await settle(() => host.agentOf('gc').calls.length === 1)+ host.begin('gc')+ host.finish('gc', '看过了。')+ await settle(() => round() !== undefined)+ assert.deepEqual(host.agentOf('gb').calls, [])+})++test('an ordinary member\'s long post calls the member it names past the preview', async (t) => {+ const store = fakeAttachments()+ const host = await start(t, {}, { attachments: store })+ const message = `${filler(LONG_HEAD)}@Tester 看一下${filler(MESSAGE_INLINE_MAX)}`+ const posted = await host.tool('post_to_group', { group: 'Ops', message }, 'b')+ assert.match(posted, /^Posted in "Ops"\. Members reply there/)+ assert.doesNotMatch(posted, /Nobody answers/)+ const post = host.takePost()+ assert.equal(post.source.member, true)+ assert.deepEqual(post.source.mentions, { ids: ['c'], all: false })+ assert.equal(fileOf(store, post).whole, message)+ assert.equal(postBody(post).includes('@Tester'), false)+ const round = host.round('c1', post)+ await settle(() => host.agentOf('gc').calls.length === 1)+ assert.equal(host.begin('gc').source.askedBy, 'b')+ host.finish('gc', '看过了。')+ await settle(() => round() !== undefined)+ assert.deepEqual(host.agentOf('ga').calls, [])+ assert.deepEqual(host.agentOf('gb').calls, [])+})++test('an ordinary member\'s long post that names nobody still calls nobody', async (t) => {+ const host = await start(t, {}, { attachments: fakeAttachments() })+ const message = filler(MESSAGE_INLINE_MAX + 1)+ const posted = await host.tool('post_to_group', { group: 'Ops', message }, 'b')+ assert.match(posted, /Nobody answers it: your post only calls the members you name with @Name\./)+ const post = host.takePost()+ assert.deepEqual(post.source.mentions, { ids: [], all: false })+ const round = host.round('c1', post)+ await settle(() => round() !== undefined)+ assert.equal(logLines(host).some(line => line.botId === 'b' && line.files?.length === 1), true)+ assert.deepEqual(host.agentOf('ga').calls, [])+ assert.deepEqual(host.agentOf('gc').calls, [])+})++test('an ordinary member\'s long @all past the preview still calls nobody', async (t) => {+ const host = await start(t, {}, { attachments: fakeAttachments() })+ const message = `${filler(LONG_HEAD)}@all 看一下${filler(MESSAGE_INLINE_MAX)}`+ assert.ok(message.indexOf('@all') >= LONG_HEAD)+ const posted = await host.tool('post_to_group', { group: 'Ops', message }, 'b')+ assert.match(posted, /Nobody answers it/)+ const post = host.takePost()+ assert.deepEqual(post.source.mentions, { ids: [], all: true })+ const round = host.round('c1', post)+ await settle(() => round() !== undefined)+ assert.deepEqual(host.agentOf('ga').calls, [])+ assert.deepEqual(host.agentOf('gc').calls, [])+})++test('a long post does not call a name that sits in code past the preview', async (t) => {+ const host = await start(t, {}, { attachments: fakeAttachments() })+ const message = `${filler(LONG_HEAD)}\n\`@Tester\`\n${filler(MESSAGE_INLINE_MAX)}`+ assert.ok(message.indexOf('@Tester') > LONG_HEAD)+ assert.ok(message.length > MESSAGE_INLINE_MAX)+ const posted = await host.tool('post_to_group', { group: 'Ops', message }, 'b')+ assert.match(posted, /Nobody answers it/)+ const post = host.takePost()+ assert.deepEqual(post.source.mentions, { ids: [], all: false })+ const round = host.round('c1', post)+ await settle(() => round() !== undefined)+ assert.deepEqual(host.agentOf('gc').calls, [])+ assert.deepEqual(host.agentOf('ga').calls, [])+})++test('a long @all past the preview calls every other member at once', async (t) => {+ const host = await start(t, { admin: 'b' }, { attachments: fakeAttachments() })+ const message = `${filler(LONG_HEAD)}@all 看一下${filler(MESSAGE_INLINE_MAX)}`+ await host.tool('post_to_group', { group: 'Ops', message }, 'a')+ const post = host.takePost()+ assert.deepEqual(post.source.mentions, { ids: [], all: true })+ assert.equal(postBody(post).includes('@all'), false)+ const round = host.round('c1', post)+ await settle(() => host.agentOf('gb').calls.length === 1 && host.agentOf('gc').calls.length === 1)+ assert.equal(togetherOf(host.agentOf('gb').calls[0]), 'Called together with you: Tester.')+ assert.equal(togetherOf(host.agentOf('gc').calls[0]), 'Called together with you: Writer.')+ host.begin('gb')+ host.finish('gb', '收到。')+ host.begin('gc')+ host.finish('gc', '收到。')+ await settle(() => round() !== undefined)+ assert.deepEqual(host.agentOf('ga').calls, [])+})++test('a post between the preview and the file limit still calls who it names', async (t) => {+ const host = await start(t)+ const message = `${filler(3000)}@Tester @Writer 看一下`+ assert.ok(message.length > LONG_HEAD && message.length <= MESSAGE_INLINE_MAX)+ assert.ok(message.indexOf('@Tester') > LONG_HEAD)+ await host.tool('post_to_group', { group: 'Ops', message }, 'a')+ const post = host.takePost()+ assert.deepEqual(post.source.mentions, { ids: ['c', 'b'], all: false })+ assert.equal(post.source.length, undefined)+ assert.equal(post.content.some(block => block.type === 'file'), false)+ assert.equal(postBody(post), message)+ const round = host.round('c1', post)+ await settle(() => host.agentOf('gc').calls.length === 1 && host.agentOf('gb').calls.length === 1)+ assert.equal(togetherOf(host.agentOf('gc').calls[0]), 'Called together with you: Writer.')+ assert.equal(host.begin('gc').source.askedBy, 'a')+ assert.ok(text(host.agentOf('gc').calls[0]).includes('@Tester @Writer 看一下'))+ assert.equal(host.begin('gb').source.askedBy, 'a')+ host.finish('gc', '看过了。')+ host.finish('gb', '也看了。')+ await settle(() => round() !== undefined)+ assert.deepEqual(host.agentOf('ga').calls, [])+})++test('a plain post between the preview and the file limit still calls the other members in turn', async (t) => {+ const host = await start(t)+ const message = filler(1500)+ assert.ok(message.length > LONG_HEAD && message.length <= MESSAGE_INLINE_MAX)+ await host.tool('post_to_group', { group: 'Ops', message }, 'a')+ const post = host.takePost()+ assert.deepEqual(post.source.mentions, { ids: [], all: false })+ assert.equal(post.content.some(block => block.type === 'file'), false)+ const round = host.round('c1', post)+ await settle(() => host.agentOf('gb').calls.length === 1)+ assert.equal(orderOf(host.agentOf('gb').calls[0]), 'Members answer this message one at a time: Writer (you, now) → Tester.')+ host.begin('gb')+ host.finish('gb', '收到。')+ await settle(() => host.agentOf('gc').calls.length === 1)+ host.begin('gc')+ host.finish('gc', '收到。')+ await settle(() => round() !== undefined)+})+test('a post with no round running keeps the old way: queued, no logged mark', async (t) => {const host = await start(t)await host.tool('post_to_group', { group: 'Ops', message: '@Writer 看一下文档' }, 'a')