Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(bots): truncate group activity before unread counts
xuzini-xzn0f9eda94e370
diff --git a/apps/desktop/scripts/fixtures/teammates-section/ui-page.mjs b/apps/desktop/scripts/fixtures/teammates-section/ui-page.mjsindex f65a33a940..8c7a85f619 100644--- a/apps/desktop/scripts/fixtures/teammates-section/ui-page.mjs+++ b/apps/desktop/scripts/fixtures/teammates-section/ui-page.mjs@@ -19,7 +19,7 @@ export default {'src/renderer/features/bots/botStore': { partial: `export const useBotProfiles=()=>${data}.profiles; export const useBotUnreadCounts=()=>({});` },'src/renderer/features/bots/useRemoteBots': `export const useRemoteBots=()=>${data}.remoteBots;`,'src/renderer/features/bots/companionCloudStore': { partial: 'const snapshot={enabled:false,actors:[],demotedBotIds:[]}; export const useCompanionCloud=()=>snapshot;' },- 'src/renderer/features/bots/botGroupStore': { partial: 'export const useBotGroupList=()=>({groups:[],loaded:true});' },+ 'src/renderer/features/bots/botGroupStore': { partial: `export const useBotGroupList=()=>({groups:${data}.groups||[],loaded:true});` },'src/renderer/features/device-link/useDeviceLinkDeviceList': 'export const useDeviceLinkDeviceList=()=>[];','src/renderer/state/agentIslandActivity': { partial: 'const activity=new Map(); export const useAgentIslandActivityMap=()=>activity;' },'src/renderer/features/bots/BotCreateMenu': 'export const BotCreateMenu=()=>null;',@@ -47,6 +47,19 @@ export default {data: { profiles: localProfiles, remoteBots, route },}];})),+ ...Object.fromEntries([11, 999].map(count => [`long-speakers-${count}`, {+ about: 'Long speaking member names ellipsize before the unread count in a narrow sidebar',+ data: { profiles: [], remoteBots: [], route: count === 11 ? '/bots' : '/bots/groups/long-speakers', groups: [{+ id: 'long-speakers', name: 'Cindy开发', replyMode: 'all', speakingMode: 'auto',+ members: ['Cindy (dash)', 'orik (kiro)', '另一个名字很长的伙伴'].map((name, index) => ({+ botId: `speaker-${index}`, name, avatar: '', avatarColor: 'violet', status: 'active',+ })),+ speakingBotIds: ['speaker-0', 'speaker-1', 'speaker-2'],+ organizerBotId: 'speaker-0', projectDir: null, lastMessage: null,+ planningBotId: null, openPlan: null, createdAt: 1, updatedAt: 1,+ serverUnread: { count, mentioned: count > 99 },+ }] },+ }])),'device-names': {about: 'Duplicate and missing computer names never expose device fingerprints in teammate rows',data: { profiles: [], route: '/bots', remoteBots: [@@ -57,6 +70,23 @@ export default {},},async check(page, ui) {+ if (ui.case.startsWith('long-speakers-')) {+ const running = page.getByTestId('bot-group-running');+ const label = running.locator('[title]');+ const badge = page.getByLabel(await ui.t('sidebar.teammateUnreadCount', { count: ui.data.groups[0].serverUnread.count }));+ const metrics = await label.evaluate(node => ({+ width: node.clientWidth, fullWidth: node.scrollWidth,+ right: node.getBoundingClientRect().right, overflow: getComputedStyle(node).overflow,+ textOverflow: getComputedStyle(node).textOverflow,+ }));+ const badgeBox = await badge.boundingBox();+ assert.ok(metrics.width > 0 && metrics.fullWidth > metrics.width, 'long names reach the text boundary');+ assert.equal(metrics.overflow, 'hidden');+ assert.equal(metrics.textOverflow, 'ellipsis');+ assert.ok(badgeBox && metrics.right < badgeBox.x, 'preview leaves space before the unread badge');+ assert.equal(await badge.innerText(), ui.data.groups[0].serverUnread.count > 99 ? '99+' : '11');+ return;+ }if (ui.case === 'device-names') {const text = await page.locator('body').innerText();assert.match(text, /Mac Studio \(1\)/);diff --git a/apps/desktop/src/renderer/features/bots/BotGroupSidebarRow.tsx b/apps/desktop/src/renderer/features/bots/BotGroupSidebarRow.tsxindex e3ceea2b0e..eeafbf85c3 100644--- a/apps/desktop/src/renderer/features/bots/BotGroupSidebarRow.tsx+++ b/apps/desktop/src/renderer/features/bots/BotGroupSidebarRow.tsx@@ -154,20 +154,18 @@ export function BotGroupSidebarRow({{planLine}</span>) : (- <>- <span className="shrink-0">{names}</span>- <span className="min-w-0 truncate">- {waiting ? (- t('bots.groupChat.sidebar.waiting')- ) : (- <BotGenerationLabel- sessionId={activity?.sessionId}- phase={activity?.workingPhase ?? 'thinking'}- startedAt={activity?.startedAtMs ?? null}- />- )}- </span>- </>+ <span className="min-w-0 flex-1 truncate" title={names}>+ {names}{' '}+ {waiting ? (+ t('bots.groupChat.sidebar.waiting')+ ) : (+ <BotGenerationLabel+ sessionId={activity?.sessionId}+ phase={activity?.workingPhase ?? 'thinking'}+ startedAt={activity?.startedAtMs ?? null}+ />+ )}+ </span>)}</span>);