diff --git a/changelog.d/3133-face-notices-language.fixed.md b/changelog.d/3133-face-notices-language.fixed.md new file mode 100644 index 000000000..a2ebf837e --- /dev/null +++ b/changelog.d/3133-face-notices-language.fixed.md @@ -0,0 +1 @@ +The lines the host posts into a chat or room follow the window's language as well: a Chinese window reads 已加入、已离开房间、总负责人:…、房间现已开放,号码不再有效。 for join/leave/lead/started notices, 未发送:… for a line that was not delivered, and 没有为 … 发起调用:… for a typed @ that could not call a friend's Bot, instead of the English sentences; every other language keeps the English words ([#3133](https://github.com/ThinkFlowLab/FlyBot/issues/3133)). diff --git a/docs/subsystems/social.md b/docs/subsystems/social.md index 6e87a5bc2..19eeac764 100644 --- a/docs/subsystems/social.md +++ b/docs/subsystems/social.md @@ -160,6 +160,7 @@ Creating a group opens its Session with zero turns, and the host draws no sessio - **#496:** re-accepting an invite for a Bot this home already has is a result, not an error. On `409 relationship_exists` `social/join-invite` answers `{ alreadyHave: true, status: 'active', bot, botName, ownerName, restored: [{ handle, name, owner }] }`. Bot Social's 409 names no Bot, so the plugin reads the public invite info (`GET /v1/invites/{code}`, `inviteInfo` in `mcp-client.js`, sent without a token) for the invite's Bot and owner. `restored` lists only Bots that were locally hidden or declined and are listed again after the unhide. The panel shows neutral text `You already have Chief (SelfA1233).` (Bot first, owner in parentheses, #384), or `Chief (SelfA1233) is back in your list.` when something really came back; never red. Without a home (legacy) the join still throws, with the neutral `You already have this friend's Bot.`. **#1000:** that path — and a `/join_invite` that answers `regranted: true` on a relationship that already exists — also grants the joining Bot back to the inviter's Bot (`grant_bot_to_friend`, `chat.public`), because Bot Social applies neither half of an invite again on an existing relationship: the inviter's first line to the joining Bot was held as an unknown recipient until that side shared again. It is the half only the joining home can create, so it is best effort — a server without the tool or REST route leaves the accept successful and `sharedBack` absent — and the Add friend line says `Your is shared back, so they can reach you too.` — `Your Bot` when the server names none — instead of only `You already have …`. Bot Social takes the friend by bot id, never by home (`grant_bot_to_friend` sends `friend_bot_id` / `friend_owner_id`, and the REST body keeps only those two), so when the invite info names no `bot_id` the plugin resolves it from `list_friends` (`peer.bot_id`, the field `friendsOverview` already reads): first the Bot whose handle is the one the invite named, else the only active friendship of the inviter's home. A friend running two Bots under one home is not granted at all when the invite names no Bot, and `sharedBack` stays absent, so no Bot the invite did not name is given access (#1024). It names the **joining** side because both homes can run a Bot with the same name: a bare `Chief is shared back` reads as the friend's Chief being shared twice (#1026). A name the owner already gave as `Your …` is printed as it is, so a Bot named `Your Bot` keeps its one `Your` instead of reading as `Your Your Bot` (#1037). - **#140:** Auto-send defaults off. Accepting a friend request uses that relationship's peer home for Auto-send, not the first roster entry. The owner sees Approve / Reject in the chat, not “Waiting for the owner's approval.” Composer drafts are labelled You. - A note the host writes beside a card follows the window's language (#3124): `zh`/`zh-*`, the `locale` the browser's `state` read carries (`flybot.uiLanguage()`), gets 等待主人批准 and 已拒绝。 for the two notes, the same words the card is drawn in. Every other or unknown locale, and a host no window has asked yet, keeps today's English `Waiting for the owner's approval` and `Rejected.` unchanged; the text is chosen when the note is posted and stored as it reads then. +- The lines the host posts into a room or a chat follow the window's language the same way (#3133): the face-room join/leave/lead/started notices (已加入 · 已离开房间 · 总负责人:… · 房间现已开放,号码不再有效。), the Not-sent line in the owner's chat (未发送:…), and the no-call line for a typed @ that could not ride the legacy envelope (没有为 … 发起调用:…) are Chinese in a `zh` window and English in every other or unknown one. `leaveNoticeCoveredByClose` hides the short leave behind the closed banner in either language, so the close line is never doubled (#1103). - **#136 (suffix):** Onboard retries truncate the sanitized handle body so `Name2` / `Name3` still change within the 32-character `homeHandleOf` limit. - **#666:** A friendship can be removed outside this plugin — the agent's `remove_friend` tool, or the Bot Social console — and the cached roster used to keep that Bot for up to `REMOTE_TTL_MS` (30 s). A send in that window was accepted and held, and approving it lost the line: Bot Social answered `send_as_member: no active relationship between these bots`. The send policy now asks Bot Social about the friendship itself before it asks the owner: `friendshipActive` reads `list_friends` for the home and for the sending Bot's own member identity (a per-Bot friendship, #420, is listed there), accepts only an entry whose `status` is `active` (or absent) and whose peer handle belongs to that friend's home, and caches the answer for 2 s so a burst of lines costs one call per friend, not one per line. No answer at all (an older server, a link that is down) keeps the roster's verdict: the check catches a removal, it does not invent one. When the friendship is gone the send is denied with the usual *is not a Bot a friend shared with you* reason, above the hold and Auto-send branches, and `forgetFriendHome` drops that friend from the cached roster and republishes, so the list and the picker stop offering a Bot that can no longer be reached. Room lines (`via: room` / `room-share`) skip the check. The other half is the cache: a `relationship.changed` event in either direction now invalidates the roster (`fetchedAt = 0`) **and** every cached friendship answer (`forgetFriendStatus`), so a send in the same millisecond is judged on a fresh answer rather than the two-second one — the earlier version only dropped the roster, and a send 500 ms after the event still read "still friends". Two more holes close with it (#666 review): an answer without a `friends` array is not evidence of a removal (it keeps the roster's verdict, or one server that changed shape would unfriend everyone), and releasing a held card re-asks `list_friends` with `{ fresh: true }` — bypassing the two-second answer at the moment the owner approves — so a card held before the removal fails with the *is not a Bot a friend shared with you* reason instead of being handed to a server that refuses it with `no active relationship`. The probe also carries its own `FRIEND_CALL_MS = 1.5 s` deadline through `callTool(name, args, { timeoutMs })`, because it runs on the send path and must not add the client's 30 s deadline to every line when Bot Social is down. Tests: `plugins/social/test/social.test.js` (`#666`, including the +0 ms and +500 ms cases). diff --git a/plugins/social/src/face-rooms.js b/plugins/social/src/face-rooms.js index dda0829d2..25177a279 100644 --- a/plugins/social/src/face-rooms.js +++ b/plugins/social/src/face-rooms.js @@ -12,6 +12,7 @@ import { socialFetch } from './mcp-client.js' import { lookFromServer } from './look.js' import { formatFaceRoomTitle, faceRoomCreatedAt } from './face-title.js' +import { chineseUi } from './hidden-remotes.js' export const FACE_JOIN_CODE = /^\d{6}$/ export const FACE_MAX_MEMBERS = 8 @@ -428,25 +429,31 @@ export function faceOutbound(line, { locals = [], asBots = [], who } = {}) { return undefined } -export function platformJoinText(member) { +// #3133: the notices the host posts for a room event follow the window's language, the seam #3124 +// gave the approval notes; English is the fallback. +export function platformJoinText(member, language) { const who = faceMemberLabel(member) // Server copy; we rebuild from sanitized fields so a poisoned payload cannot instruct. - if (member?.roomOnly === true || member?.published !== true) return `${who} joined; available to this room only` - return `${who} joined` + if (member?.roomOnly === true || member?.published !== true) { + return chineseUi(language) ? `${who} 已加入;仅在此房间可用` : `${who} joined; available to this room only` + } + return chineseUi(language) ? `${who} 已加入` : `${who} joined` } // A leave names the person, not their Bot (#191): "Bob left the room". -export function platformLeaveText(member) { +export function platformLeaveText(member, language) { const owner = faceOwnerName(member) - return owner ? `${owner} left the room` : `${faceMemberLabel(member)} left` + if (owner) return chineseUi(language) ? `${owner} 已离开房间` : `${owner} left the room` + return chineseUi(language) ? `${faceMemberLabel(member)} 已离开` : `${faceMemberLabel(member)} left` } // The closed status line already says who left and that the room closed (#1103): -// "Bob left the room. Room closed." The short platform leave is the same fact. +// "Bob left the room. Room closed." The short platform leave is the same fact, in either language +// (#3133), so the pattern reads both the English and the Chinese leave. // Same rule as core `leaveNoticeCoveredByClose` (`cells.js`), which hides a line already drawn. export function leaveNoticeCoveredByClose(room, text) { if (room?.origin !== 'face-to-face' || room.face?.status !== 'closed') return false - const match = String(text ?? '').trim().match(/^(.+) left(?: the room)?$/) + const match = String(text ?? '').trim().match(/^(.+) (?:left(?: the room)?|已离开(?:房间)?)$/) if (!match) return false const who = match[1] for (const participant of room.participants ?? []) { @@ -457,14 +464,17 @@ export function leaveNoticeCoveredByClose(room, text) { return false } -export function platformLeadText(member, reason) { - if (member) return `Room lead: ${faceMemberLabel(member)}` - return reason === 'lead_left' ? 'The room lead left. The default lead takes over.' : 'The room lead is back to the default.' +export function platformLeadText(member, reason, language) { + if (member) return chineseUi(language) ? `总负责人:${faceMemberLabel(member)}` : `Room lead: ${faceMemberLabel(member)}` + if (reason === 'lead_left') return chineseUi(language) ? '总负责人已离开,由默认总负责人接手。' : 'The room lead left. The default lead takes over.' + return chineseUi(language) ? '总负责人恢复为默认。' : 'The room lead is back to the default.' } -export function platformStartedText(reason) { - if (reason === 'expired') return 'Joining has ended. The room is now open. The number is no longer valid.' - return 'The room is now open. The number is no longer valid.' +export function platformStartedText(reason, language) { + if (reason === 'expired') { + return chineseUi(language) ? '加入期已结束。房间现已开放,号码不再有效。' : 'Joining has ended. The room is now open. The number is no longer valid.' + } + return chineseUi(language) ? '房间现已开放,号码不再有效。' : 'The room is now open. The number is no longer valid.' } // Peer look is optional: only pass through a stored color / avatar when the payload @@ -542,7 +552,7 @@ export function viewFaceRoom(body) { eventCursor: Number(body.event_cursor ?? body.eventCursor ?? 0) || 0, members, ...(lead ? { lead } : {}), - events: (body.events ?? []).map(viewFaceEvent).filter(Boolean), + events: (body.events ?? []).map(event => viewFaceEvent(event)).filter(Boolean), memberCount: Number(body.member_count ?? body.members?.length ?? 0) || 0, myBots: (body.my_bots ?? body.myBots ?? []).map(viewFaceMember).filter(Boolean), } @@ -580,7 +590,7 @@ function viewedFaceText(event) { return faceUntrustedText(raw ?? event.untrustedText) } -export function viewFaceEvent(event) { +export function viewFaceEvent(event, language) { if (!event || typeof event !== 'object') return undefined const raw = String(event.type || event.event_type || '') const mapped = INBOX_TYPES[raw] || raw @@ -598,7 +608,7 @@ export function viewFaceEvent(event) { trust: event.trust, member, from, - text: mapped === 'room.message' ? undefined : sanitizePlatformText(event.text, mapped, member, event.reason), + text: mapped === 'room.message' ? undefined : sanitizePlatformText(event.text, mapped, member, event.reason, language), // A viewed event (renderFaceEvent views again) already holds the plain text: keep it as is (#302). untrustedText: mapped === 'room.message' ? stripFaceMarkers(viewedFaceText(event)) : undefined, // Stamped by Bot Social (never read from the text): the owner typed this line themselves. A viewed @@ -610,13 +620,13 @@ export function viewFaceEvent(event) { } } -function sanitizePlatformText(text, type, member, reason) { +function sanitizePlatformText(text, type, member, reason, language) { // Rebuild join/leave/start from sanitized fields so a 60-char name cap cannot // truncate the sentence, and a poisoned `text` cannot instruct. - if (type === 'member.joined' && member) return platformJoinText(member) - if (type === 'member.left' && member) return platformLeaveText(member) - if (type === 'room.started') return platformStartedText(reason) - if (type === 'room.lead_changed') return platformLeadText(member, reason) + if (type === 'member.joined' && member) return platformJoinText(member, language) + if (type === 'member.left' && member) return platformLeaveText(member, language) + if (type === 'room.started') return platformStartedText(reason, language) + if (type === 'room.lead_changed') return platformLeadText(member, reason, language) const cleaned = cutCodePoints(String(text ?? '') .replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, ' ') .replace(/[[\]"<>`@]/g, '') @@ -629,8 +639,8 @@ function sanitizePlatformText(text, type, member, reason) { // it carries that stamp; the FLYBOT-FACE-HUMAN text is then never an attribution (any Bot can write // it), though its inner text is still unwrapped for display. Without it (an older server) the envelope // keeps its legacy meaning (#180). -export function renderFaceEvent(event, { attested = false } = {}) { - const viewed = viewFaceEvent(event) +export function renderFaceEvent(event, { attested = false, language } = {}) { + const viewed = viewFaceEvent(event, language) if (!viewed) return undefined if (viewed.type === 'room.message') { const from = viewed.from || {} diff --git a/plugins/social/src/hidden-remotes.js b/plugins/social/src/hidden-remotes.js index 6c2cadb88..47b2c01d5 100644 --- a/plugins/social/src/hidden-remotes.js +++ b/plugins/social/src/hidden-remotes.js @@ -130,7 +130,8 @@ export const REJECT_NOTE = 'Rejected.' // translator, so it picks the words by the interface language the last window reported // (`flybot.uiLanguage`, a language name such as `Chinese (简体中文)`) and the Chinese pair lives // here, beside its English one. An unknown language keeps English, the host's own fallback. -const chineseUi = (language) => /^(zh|chinese)/i.test(String(language ?? '')) +// #3133: the face-room notices and the social room lines pick their words through the same test. +export const chineseUi = (language) => /^(zh|chinese)/i.test(String(language ?? '')) export const waitingNote = (language) => (chineseUi(language) ? '等待主人批准' : WAITING_OTHERS) export const rejectNote = (language) => (chineseUi(language) ? '已拒绝。' : REJECT_NOTE) diff --git a/plugins/social/src/social.js b/plugins/social/src/social.js index 468540bfc..bd617c3c1 100644 --- a/plugins/social/src/social.js +++ b/plugins/social/src/social.js @@ -74,6 +74,7 @@ import { revealHiddenIfPresent, waitingNote, rejectNote, + chineseUi, } from './hidden-remotes.js' export const NS = 'social' @@ -2494,7 +2495,10 @@ export function createSocial(service, config = {}, { client: given, api: givenAp handle, home: event.to?.home_handle ? norm(event.to.home_handle) : undefined, name: cleanText(event.to?.display_name, handle), - text: `Not sent: ${friendBotTitle(handle)} was not ready to talk with you yet, so it did not get your message. Send it again.`, + // #3133: the note follows the window's language (#3124's seam); English is the fallback. + text: chineseUi(flybot.uiLanguage?.()) + ? `未发送:${friendBotTitle(handle)} 还没有准备好与你对话,因此没有收到你的消息。请重新发送。` + : `Not sent: ${friendBotTitle(handle)} was not ready to talk with you yet, so it did not get your message. Send it again.`, }) } // Tells the sender (through Bot Social) that this home could not hand their message to its Bot. A server @@ -4221,7 +4225,7 @@ export function createSocial(service, config = {}, { client: given, api: givenAp // is the last resort for a server that stamps neither an id nor a cursor (#1063). const eventKey = faceEventKey(event, position) if (eventKey && seen.includes(eventKey)) continue - const line = renderFaceEvent(event, { attested }) + const line = renderFaceEvent(event, { attested, language: flybot.uiLanguage?.() }) if (!line) continue seen = rememberEvent(seen, eventKey) if (line.system) { @@ -4263,7 +4267,7 @@ export function createSocial(service, config = {}, { client: given, api: givenAp if (handle && !localHandles.has(handle)) markRoomRemote(handle, snapshot.roomId) const key = `join:${handle}` if (!handle || previousLive.has(handle) || joinedFromEvents.has(handle) || seen.includes(key)) continue - const text = platformJoinText(member) + const text = platformJoinText(member, flybot.uiLanguage?.()) if (alreadyJoined(text)) { seen = rememberEvent(seen, key) continue @@ -4608,7 +4612,13 @@ export function createSocial(service, config = {}, { client: given, api: givenAp // itself (core `openingSpeakers`), attested or as the envelope, so its call is not lost. const seats = new Set((room.participants ?? []).filter(item => item.remote === true).map(item => norm(item.handle))) const lost = [...new Set(mentions.map(handle => (typeof handle === 'string' ? norm(handle) : '')).filter(handle => handle && seats.has(handle)))] - if (lost.length > 0) flybot.rooms.postNotice?.(room.id, `No call went out for ${lost.join(', ')}: this connector token may not attest typed lines, so the other home reads this line as a Bot's.`) + if (lost.length > 0) { + // #3133: the room line follows the window's language (#3124's seam); English is the fallback. + const lostLine = chineseUi(flybot.uiLanguage?.()) + ? `没有为 ${lost.join(', ')} 发起调用:此连接器令牌无法证明输入行,对方主机会把这一行当作 Bot 的行。` + : `No call went out for ${lost.join(', ')}: this connector token may not attest typed lines, so the other home reads this line as a Bot's.` + flybot.rooms.postNotice?.(room.id, lostLine) + } } if (sent?.status === 'pending_approval') { rememberHoldRoom(sent.approvalId, serverId) diff --git a/plugins/social/test/face-rooms.test.js b/plugins/social/test/face-rooms.test.js index 21900ce7d..c3e34769a 100644 --- a/plugins/social/test/face-rooms.test.js +++ b/plugins/social/test/face-rooms.test.js @@ -214,6 +214,42 @@ test('peer names and system copy are sanitized', () => { assert.equal(alreadyLeftFace({ code: 'nope', message: 'busy' }), false) }) +// #3133: the notices the host posts into a face room follow the window's language, the same seam +// #3124 gave the approval notes. An explicit English window, and a window that never said, keep English. +test('#3133: face-room notices follow the window\'s language', () => { + const zh = 'Chinese (简体中文)' + const reviewer = { handle: '@reviewer.flybot682b8a43.home', display_name: 'Reviewer', owner_name: 'FlyBot 682b8a43' } + assert.equal(platformJoinText({ ...reviewer, published: true }, zh), 'Reviewer (flybot682b8a43) 已加入') + assert.equal(platformJoinText({ ...reviewer, published: false }, zh), 'Reviewer (flybot682b8a43) 已加入;仅在此房间可用') + assert.equal(platformLeaveText({ display_name: 'Coder', owner_name: 'Bob' }, zh), 'Bob 已离开房间') + assert.equal(platformLeaveText({ display_name: 'Coder' }, zh), 'Coder 已离开') + assert.equal(platformLeadText(reviewer, undefined, zh), '总负责人:Reviewer (flybot682b8a43)') + assert.equal(platformLeadText(undefined, 'lead_left', zh), '总负责人已离开,由默认总负责人接手。') + assert.equal(platformLeadText(undefined, 'back', zh), '总负责人恢复为默认。') + assert.equal(platformStartedText('expired', zh), '加入期已结束。房间现已开放,号码不再有效。') + assert.equal(platformStartedText('start', zh), '房间现已开放,号码不再有效。') + // An explicit English window and a window that never said read the same English. + assert.equal(platformJoinText({ ...reviewer, published: true }, 'English'), 'Reviewer (flybot682b8a43) joined') + assert.equal(platformLeaveText({ display_name: 'Coder' }, 'English'), 'Coder left') + assert.equal(platformLeadText(reviewer, undefined, 'English'), 'Room lead: Reviewer (flybot682b8a43)') + assert.equal(platformStartedText('start', 'English'), 'The room is now open. The number is no longer valid.') + assert.equal(platformJoinText({ ...reviewer, published: true }), 'Reviewer (flybot682b8a43) joined') + // The event a room posts carries the language through to the line it draws (a viewed member + // collapses `published` into `roomOnly`, so a plain join reads the room-only shape). + assert.equal(renderFaceEvent({ event_id: 'fev_z1', type: 'face_room.joined', member: { ...reviewer, published: true } }, { language: zh }).text, 'Reviewer (flybot682b8a43) 已加入;仅在此房间可用') + assert.equal(renderFaceEvent({ event_id: 'fev_z2', type: 'face_room.left', member: { display_name: 'Coder', owner_name: 'Bob' } }, { language: zh }).text, 'Bob 已离开房间') + assert.equal(renderFaceEvent({ event_id: 'fev_z3', type: 'face_room.lead_changed', reason: 'lead_left', lead: null }, { language: zh }).text, platformLeadText(undefined, 'lead_left', zh)) + // #1103 in Chinese: the closed banner already names the leaver, so the short zh leave is not a second line. + const closed = { + origin: 'face-to-face', face: { status: 'closed' }, + participants: [{ remote: true, ownerName: 'SelfB1025', displayName: 'Coder', leftSeq: 4 }], + } + assert.equal(leaveNoticeCoveredByClose(closed, 'SelfB1025 已离开房间'), true) + assert.equal(leaveNoticeCoveredByClose(closed, 'Coder (SelfB1025) 已离开'), true) + assert.equal(leaveNoticeCoveredByClose(closed, 'Carol 已离开房间'), false) + assert.equal(leaveNoticeCoveredByClose(closed, 'SelfB1025 left the room'), true) +}) + test('#526: an owner name made up from the install id gives way to the owner username', () => { // A seat as Bot Social sends it for an owner who never set a name. const reviewer = { handle: '@reviewer.flybot682b8a43.home', display_name: 'Reviewer', owner_name: 'FlyBot 682b8a43' } diff --git a/plugins/social/test/social.test.js b/plugins/social/test/social.test.js index 74f2e4932..1f898e337 100644 --- a/plugins/social/test/social.test.js +++ b/plugins/social/test/social.test.js @@ -1782,6 +1782,47 @@ test('#3124: with no window, or a language the host does not translate, the note } }) +// #3133: the Not-sent line the host writes into the owner's chat with that Bot follows the window's +// language, the same seam #3124 gave the approval notes. The #442 test below is the English control. +test('#3133: a Chinese window gets the Not-sent line in Chinese', async (t) => { + const { ctx, call, stop } = await team() + t.after(stop) + await call('state', { locale: 'zh-CN' }) + const server = mockServer() + const log = [] + server.tools.list_inbox = (a) => { const since = a.since_cursor ?? 0; const events = log.filter(e => e.bot === a.bot_id && e.cursor > since); return { events, next_cursor: events.at(-1)?.cursor ?? since } } + const delivered = captureChatDeliveries(ctx) + const social = createSocial(ctx.flybot, { autoAccept: true, inboxPollMs: 0 }, { client: createMcpClient({ server: 'https://s', token: 'owner-token', fetch: server.fetch }), home: { id: 'h1', handle: '@danyang.home' } }) + t.after(() => social.dispose()) + await grantTeam(ctx.flybot) + await social.registerAll() + await social.remoteBots({ fresh: true }) + assert.equal(await social.sendChat({ handle: '@coder.bob.home', text: 'Hi' }), '') + const via = server.calls.filter(c => c.name === 'send_as_member').at(-1).args.from_bot_id + log.push({ bot: via, cursor: 1, event_id: 'evt_nd_zh', event_type: 'message.not_delivered', message_id: 'msg_zh', conversation_id: 'c1', to: { bot_id: 'x1', handle: '@coder.bob.home', home_handle: '@bob.home', display_name: 'Coder' }, reason: 'not_shared_yet', trust: 'platform' }) + assert.equal(await social.pollInbox(), 0, 'a notice is not a delivered message') + assert.equal(delivered.length, 1) + assert.equal(delivered[0].text, '未发送:Coder (Bob) 还没有准备好与你对话,因此没有收到你的消息。请重新发送。') + assert.equal(delivered.some(n => String(n.text).startsWith('Not sent:')), false, 'no English Not-sent line in a Chinese window') +}) + +// #3133: the one room line that names a lost call follows the window's language too. The #997 test +// above is the English control. +test('#3133: a Chinese window gets the no-call line in Chinese', async (t) => { + const typedLine = { authorKind: 'human', who: 'Danyang', text: "@Coder · Bob please look", authorId: 'owner-1' } + const refusing = attestingFaceServer({ refuse: true, features: ['typed_by_owner', 'mentions'] }) + refusing.face.peer('123456') + const notices = [] + const a = await faceFixture(t, refusing, (scoped) => { + const orig = scoped.rooms.postNotice?.bind(scoped.rooms) + scoped.rooms.postNotice = (id, text) => { notices.push(String(text)); return orig?.(id, text) } + }) + await a.call('state', { locale: 'zh-CN' }) + const before = notices.length + await a.fanout(typedLine, { mentions: ['@coder.bob.home'] }) + assert.deepEqual(notices.slice(before), ['没有为 @coder.bob.home 发起调用:此连接器令牌无法证明输入行,对方主机会把这一行当作 Bot 的行。'], `the room line follows the window, saw ${JSON.stringify(notices.slice(before))}`) +}) + const heldOutbound = { approval_id: 'apr-hold-1', kind: 'outbound_message',