Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
Merge remote-tracking branch 'upstream/main' into bot-group-single-speaker
zqchris9c7becc7c3c8
diff --cc apps/desktop/scripts/fixtures/group-control/group-control-fixture.tsxindex 8d514c76a4,00c4817669..8e36ca1c6e--- a/apps/desktop/scripts/fixtures/group-control/group-control-fixture.tsx+++ b/apps/desktop/scripts/fixtures/group-control/group-control-fixture.tsx@@@ -15,12 -11,10 +15,14 @@@ interface GroupData/** A server group with teammates' bubbles: quote, reactions, thread entry and a task card. */bubbles?: boolean;wrappedReactions?: boolean;+ /** A single-speaker server group: nobody was named, so everyone answers in turn (bot-group-chat.md §4.0/§7.0). */+ arrangement?: Queue;+ /** Open the group settings drawer as its owner. */+ settings?: boolean;/** Server read state: unread thread entries and the in-chat 话题 hint. */threadUnread?: boolean;+ /** The Thread panel answers reads and keeps the reader's follow switch. */+ threadPanel?: boolean;}const T0 = 1700000000000;@@@ -112,51 -106,15 +114,55 @@@ function bubbleMessages(wrappedReaction];}+type Queue = 'running' | 'done' | 'long';+const QUEUE_ANSWERS = [+ '我倾向于改:群里会安静很多,也更省。',+ '同意。测试上要覆盖 @ 多位时按顺序回答,以及老群升级后只留一次说明。',+ '手机端也要跟上,不然两边看到的不一样。',+ '队列卡别太长,折起来就行。',+ '我没什么补充,按这个做。',+];+/** Who a queue lines up: the two-teammate group, or seven teammates for a long queue. */+const QUEUE_CROWD = ['Aster', 'Nova', 'Mira', 'Orin', 'Pax', 'Quill', 'Rhea'].map((name, i) => ({ botId: 'abcdefg'[i]!, name }));+const queueMembers = (state: Queue) => QUEUE_CROWD.slice(0, state === 'long' ? 7 : 2);+/** How many turns have answered: Nova still speaking, everyone, or the five that run by themselves. */+const queueAnswered = (state: Queue) => (state === 'running' ? 1 : state === 'done' ? 2 : 5);++/** Nobody named: the queue card, then each teammate's own answer in turn. */+function arrangementMessages(state: Queue) {+ const ask = '群聊改成每条只有一位回答,大家讨论下?';+ return [+ message({ id: 'q1', sequence: 1, isSelf: true, content: ask, createdAt: T0 }),+ message({ id: 'p1-card', sequence: 2, kind: 'plan', planId: 'p1', isSelf: true, content: '', createdAt: T0 }),+ ...queueMembers(state).slice(0, queueAnswered(state)).map((member, i) => message({+ id: `${member.botId}1`, sequence: 3 + i, authorKind: 'bot', authorBotId: member.botId, authorName: member.name, planId: 'p1',+ createdAt: T0 + (i + 1) * MINUTE, content: QUEUE_ANSWERS[i] })),+ ];+}+function arrangementPlan(state: Queue) {+ const answered = queueAnswered(state);+ const members = queueMembers(state);+ return {+ id: 'p1', status: state === 'done' ? 'done' : state === 'long' ? 'waiting' : 'running', organizerBotId: 'a', organizerName: 'Aster',+ currentStep: state === 'long' ? answered - 1 : state === 'done' ? 1 : answered,+ // A running turn is timed from the plan's last change: keep it recent so the clock reads sensibly.+ kind: 'talk', canManage: true, workDir: null, branch: null, createdAt: T0, updatedAt: state === 'running' ? Date.now() - 30_000 : T0 + answered * MINUTE,+ steps: members.map((member, position) => ({+ position, botId: member.botId, botName: member.name, task: '',+ status: position < answered ? 'done' : position === answered && state === 'running' ? 'running' : 'pending',+ resultMessageId: position < answered ? `${member.botId}1` : null,+ })),+ };+}- /** Two Threads name the reader, one is merely unread, one is read (bot-group-chat.md §10「话题未读与提示」). */+ /**+ * Two Threads name the reader, one they follow is unread without naming them, one is read+ * (bot-group-chat.md §10「话题未读与提示」).+ */const UNREAD = { a1: { count: 2, mentioned: true }, q3: { count: 1, mentioned: true }, q2: { count: 1, mentioned: false } } as Record<string, { count: number; mentioned: boolean }>;+ const FOLLOWED = new Set(['q2']);function threadSummaries() {const summary = (rootId: string, rootText: string, rootAuthorName: string, rootAuthorBotId: string | null, replyCount: number, last: [string, string, number]) => ({- rootId, rootText, rootAuthorName, rootAuthorBotId, replyCount, unread: UNREAD[rootId] ?? { count: 0, mentioned: false },+ rootId, rootText, rootAuthorName, rootAuthorBotId, replyCount, unread: UNREAD[rootId] ?? { count: 0, mentioned: false }, following: FOLLOWED.has(rootId),lastReply: { authorName: last[0], text: last[1], createdAt: T0 + last[2] * MINUTE },});return [@@@ -222,10 -172,24 +228,24 @@@ function groupFrom(data: GroupData)void mountPage({route: '/bots/groups/fixture-group',host: (ctx) => {- const group = groupFrom(ctx.data as unknown as GroupData);+ const data = ctx.data as unknown as GroupData;+ const group = groupFrom(data);+ let following = false;+ const followThread = async (input: { following: boolean }) => {+ following = input.following;+ return { ok: true, following };+ };+ const thread = async (input: { rootId: string }) => {+ const root = group.messages.find(m => m.id === input.rootId);+ const replies = ((root?.threadPreview as { replies?: Array<Record<string, unknown>> } | undefined)?.replies ?? []).map((reply, index) => message({+ id: reply.id, sequence: 100 + index, threadRootId: input.rootId, authorKind: reply.authorKind, authorBotId: reply.authorBotId,+ authorName: reply.authorName, isSelf: reply.isSelf, content: reply.text, createdAt: reply.createdAt,+ }));+ return { ok: true, root, replies, hasMore: false, following };+ };return {maker: {- listBotGroups: async () => ({ ok: true, groups: [] }),+ listBotGroups: async () => ({ ok: true, groups: (ctx.data as unknown as GroupData).settings ? [group] : [] }),getBotGroup: async () => ({ ok: true, group }),onBotGroupChanged: subscription('botGroupChanged'),sendBotGroupMessage: forbid('maker.sendBotGroupMessage'),@@@ -233,10 -197,8 +253,11 @@@chatServer: {reactors: async () => ({ ok: true, reactors: [{ actorId: 'me', isSelf: true, name: 'You', formerMember: false }] }),react: forbid('maker.chatServer.react'),+ ownedBots: async () => ({ ok: true, bots: [] }),+ manage: forbid('maker.chatServer.manage'),+ ...(data.threadPanel ? { thread, followThread } : {}),},+ updateBotGroup: forbid('maker.updateBotGroup'),},deviceLink: {getState: async () => ({ controlledBy: [] }),