diff --git a/apps/web/tests/agent-team-panel.e2e.ts b/apps/web/tests/agent-team-panel.e2e.ts index dfbc248bba..860bd3bf97 100644 --- a/apps/web/tests/agent-team-panel.e2e.ts +++ b/apps/web/tests/agent-team-panel.e2e.ts @@ -134,6 +134,16 @@ describe('web e2e: agent teamwork panel', () => { const menu = page.getByRole('menu') const summary = menu.getByRole('menuitem', { name: 'Agent teamwork Off', exact: true }) await summary.waitFor() + const stateColor = await summary.getByText('Off', { exact: true }).evaluate(element => getComputedStyle(element).color) + const modelColor = await menu.getByRole('menuitem', { name: 'Model DeepSeek-V4-Flash', exact: true }) + .getByText('DeepSeek-V4-Flash', { exact: true }).evaluate(element => getComputedStyle(element).color) + expect(stateColor).toBe(modelColor) + const inspectArrow = (element: HTMLElement | SVGElement) => { + const { left, right, width, height } = element.getBoundingClientRect() + return { left, right, width, height, color: getComputedStyle(element).color, glyph: element.innerHTML } + } + const peerArrow = menu.getByRole('menuitem', { name: 'Model DeepSeek-V4-Flash', exact: true }).locator('svg').last() + expect(await summary.locator('svg').evaluate(inspectArrow)).toEqual(await peerArrow.evaluate(inspectArrow)) expect(await menu.getByRole('switch').count()).toBe(0) expect(await page.getByRole('button', { name: 'About agent teamwork', exact: true }).count()).toBe(0) const rootSnapshot = await captureStableAria(page, '[role="menu"]', scaffold.workspaceCwd) @@ -147,6 +157,15 @@ describe('web e2e: agent teamwork panel', () => { await menu.getByText('Coordinate work and progress across agents with a shared task board for better results on complex tasks, with correspondingly higher token costs.', { exact: true }).waitFor() expect(await page.getByRole('tooltip').count()).toBe(0) expect(await toggle.getAttribute('aria-checked')).toBe('false') + await page.mouse.move(0, 0) + await toggle.press('ArrowDown') + expect(await toggle.evaluate(element => ({ + rowBackground: getComputedStyle(element.parentElement!).backgroundColor, + focusVisible: element.matches(':focus-visible'), + outline: getComputedStyle(element).outlineStyle, + descriptionGap: element.parentElement!.nextElementSibling!.getBoundingClientRect().top + - element.parentElement!.getBoundingClientRect().bottom, + }))).toEqual({ rowBackground: 'rgba(0, 0, 0, 0)', focusVisible: true, outline: 'solid', descriptionGap: 0 }) const settingsSnapshot = await captureStableAria(page, '[role="menu"]', scaffold.workspaceCwd) await compareOrRefreshGolden(join(SNAPSHOT_DIR, 'info.expected.md'), `## Root\n\n${rootSnapshot}\n\n## Team settings\n\n${settingsSnapshot}`, MODE) @@ -208,12 +227,19 @@ describe('web e2e: agent teamwork panel', () => { && element.scrollHeight <= element.clientHeight && style.textOverflow !== 'ellipsis' })).toBe(true) } - await toggle.click() + const labelBounds = await menu.getByText('Enable agent teamwork', { exact: true }).boundingBox() + if (labelBounds === null) throw new Error('Team label is not visible') + await page.mouse.click(labelBounds.x + labelBounds.width / 2, labelBounds.y + labelBounds.height / 2) await expect.poll(() => toggle.getAttribute('aria-checked')).toBe('true') await expect.poll(() => toggle.isEnabled()).toBe(true) await toggle.press('Escape') await menu.getByRole('menuitem', { name: 'Agent teamwork On', exact: true }).click() - await toggle.click() + const gap = await toggle.evaluate((element) => { + const control = element.getBoundingClientRect() + const label = element.parentElement!.querySelector('span')!.getBoundingClientRect() + return { x: (label.right + control.left) / 2, y: control.top + control.height / 2 } + }) + await page.mouse.click(gap.x, gap.y) await expect.poll(() => toggle.getAttribute('aria-checked')).toBe('false') expect(await page.getByRole('tooltip').count()).toBe(0) expect(tripwire.pageErrors).toEqual([]) diff --git a/packages/client/ui-agent-team/README.i18n.yaml b/packages/client/ui-agent-team/README.i18n.yaml index 1f07c26005..0b307a4d15 100644 --- a/packages/client/ui-agent-team/README.i18n.yaml +++ b/packages/client/ui-agent-team/README.i18n.yaml @@ -15,8 +15,8 @@ en: d152484eb41ac6b4 zh: 09388d293f9be9cb /deepseek-ai-dsh-client-ui-agent-team/use-this-package: - en: 4b66566b2e676572 - zh: 57e6096591983a3c + en: c5fe6c80b2979db7 + zh: 6f4640b369c9d22a /deepseek-ai-dsh-client-ui-agent-team/use-this-package/inspect-the-task-board: en: 2f606827b3ab14bc zh: 7f713d10268e7498 diff --git a/packages/client/ui-agent-team/README.md b/packages/client/ui-agent-team/README.md index 115987b4b6..b5a3b9ff52 100644 --- a/packages/client/ui-agent-team/README.md +++ b/packages/client/ui-agent-team/README.md @@ -25,7 +25,7 @@ This package displays shared tasks below the Subagent tree in one header panel. ## Use this package -In the root conversation’s model and reasoning menu, select **Agent teamwork** to open its settings page, then turn on **Enable agent teamwork**. The root row shows only the saved On/Off state and opens the page without changing the selection; the settings page places the switch above the full explanation. New Sessions default to off. While enabled, open the root conversation’s Subagent control to see members above shared tasks. Child conversations keep subagent navigation without a task board or Team switch, including before their subagent address is discovered. The entry is hidden when both the subagent catalog and shared tasks are empty; catalog and task-record errors remain accessible. Section headers appear only when Team mode is enabled, at least one nondeleted shared task exists, and the task footer is available. In that case, the noncollapsible Subagents section remains above shared tasks even when its catalog is empty. Otherwise, the menu shows only subagent navigation, without section headers, a shared-task module, empty-state copy, or a divider. Turning it off retains tasks and subagents. The settings page shows the shared-task coordination, complex-task results, and token-cost explanation as ordinary text, without an information tooltip. Its entire switch row highlights on hover and toggles the selection when clicked. The switch calls `remote.agentTeams.setEnabled`, waits for the saved projection and reports failures through the menu host; the row cannot toggle while locked or saving. +In the root conversation’s model and reasoning menu, select **Agent teamwork** to open its settings page, then turn on **Enable agent teamwork**. The root row shows the saved On/Off state without changing it. The settings page shows the switch above the shared-task coordination, complex-task results, and token-cost explanation as ordinary text, without an information tooltip. New Sessions default to off. While enabled, open the root conversation’s Subagent control to see members above shared tasks. Child conversations keep subagent navigation without a task board or Team switch, including before their subagent address is discovered. The entry is hidden when both the subagent catalog and shared tasks are empty; catalog and task-record errors remain accessible. Section headers appear only when Team mode is enabled, at least one nondeleted shared task exists, and the task footer is available. In that case, the noncollapsible Subagents section remains above shared tasks even when its catalog is empty. Otherwise, the menu shows only subagent navigation, without section headers, a shared-task module, empty-state copy, or a divider. Turning it off retains tasks and subagents. The entire switch row highlights on hover and toggles the selection when clicked. The switch calls `remote.agentTeams.setEnabled`, waits for the saved projection and reports failures through the menu host; the row cannot toggle while locked or saving. Turning off the menu switch requires confirmation after the Session records a model request; a model choice alone does not require it. The switch waits while request history is unavailable. The dialog explains the tool, coordination, and possible cache effects without deleting task records. Cancel, Escape, or closing the dialog leaves Team mode unchanged. Dismissing the dialog returns focus to the model selector. Confirmation targets the originating Session, waits for the save, and keeps failures visible for retry; it does not depend on the model menu remaining open. Team mode has no slash command; menu changes create no `command/run` or `command/done` records. diff --git a/packages/client/ui-agent-team/README.zh.md b/packages/client/ui-agent-team/README.zh.md index 8af5e7e585..650a9f2b63 100644 --- a/packages/client/ui-agent-team/README.zh.md +++ b/packages/client/ui-agent-team/README.zh.md @@ -25,7 +25,7 @@ kind: "package-reference" ## 使用本包 -在根会话的模型与推理等级菜单中选择**智能体团队协作**,进入二级设置页后打开**开启智能体团队协作**。一级行只显示已保存的开启/关闭状态,点击仅进入页面,不改变选择;二级页面将开关放在完整说明文字上方。新 Session 默认关闭。开启后,通过根会话的 Subagent 入口同时查看上方的成员树和下方的共享任务。子会话保留子智能体导航,不显示任务板或 Team 开关,包括尚未发现子代理地址时。子智能体目录和共享任务都为空时隐藏入口;目录或任务记录错误仍保留查看入口。仅当 Team 模式已开启、存在至少一个未删除的共享任务且任务 footer 可用时,才显示区域标题。此时即使目录为空,共享任务上方仍保留不可折叠的“子智能体”区域。其他情况下,菜单仅显示 subagent 导航,不显示区域标题、共享任务模块、空状态文案或分隔线。关闭后保留任务和子代理。设置页以普通正文显示共享任务协调、复杂任务效果与 token 开销的说明,不使用信息 tooltip。开关所在整行在悬停时高亮,点击可切换状态。开关调用 `remote.agentTeams.setEnabled`,等待保存后的投影更新,失败由菜单宿主提示;锁定或保存中不能通过整行切换。 +在根会话的模型与推理等级菜单中选择**智能体团队协作**,进入二级设置页后打开**开启智能体团队协作**。一级行显示已保存的开启/关闭状态,不改变选择。设置页将开关放在共享任务协调、复杂任务效果与 token 开销的说明上方;说明使用普通正文,不使用信息 tooltip。新 Session 默认关闭。开启后,通过根会话的 Subagent 入口同时查看上方的成员树和下方的共享任务。子会话保留子智能体导航,不显示任务板或 Team 开关,包括尚未发现子代理地址时。子智能体目录和共享任务都为空时隐藏入口;目录或任务记录错误仍保留查看入口。仅当 Team 模式已开启、存在至少一个未删除的共享任务且任务 footer 可用时,才显示区域标题。此时即使目录为空,共享任务上方仍保留不可折叠的“子智能体”区域。其他情况下,菜单仅显示 subagent 导航,不显示区域标题、共享任务模块、空状态文案或分隔线。关闭后保留任务和子代理。开关所在整行在悬停时高亮,点击可切换状态。开关调用 `remote.agentTeams.setEnabled`,等待保存后的投影更新,失败由菜单宿主提示;锁定或保存中不能通过整行切换。 会话记录过模型请求后,从菜单开关关闭团队需要确认;仅选择模型不会触发确认。请求历史尚未加载时,开关暂不可操作。弹窗说明工具、协作与可能的缓存影响,不会删除任务记录。取消、按 Escape 或关闭弹窗都保持团队状态不变。弹窗关闭后,焦点回到模型选择按钮。确认操作绑定到最初的会话,等待保存完成,失败时保留错误供重试,不依赖模型菜单保持打开。Team 模式没有斜杠命令;菜单切换不会生成 `command/run` 或 `command/done` 记录。 diff --git a/packages/client/ui-agent-team/src/client/TeamModeToggle.module.css b/packages/client/ui-agent-team/src/client/TeamModeToggle.module.css index 5071a9c00b..b312ccfce5 100644 --- a/packages/client/ui-agent-team/src/client/TeamModeToggle.module.css +++ b/packages/client/ui-agent-team/src/client/TeamModeToggle.module.css @@ -1,11 +1,11 @@ .summary { display: flex; align-items: center; - gap: 8px; + gap: 6px; box-sizing: border-box; width: 100%; - min-height: 34px; - padding: 7px 8px; + height: 34px; + padding: 0 8px; border: 0; border-radius: var(--dsw-radius-md); background: transparent; @@ -39,13 +39,22 @@ .state, .chevron { flex: none; - color: var(--dsw-alias-label-secondary); +} + +.state { + color: var(--dsw-alias-label-tertiary); +} + +.chevron { + width: 12px; + height: 12px; + color: var(--dsw-alias-menu-icon); } .page { display: flex; flex-direction: column; - gap: 4px; + gap: 0; min-width: 0; } @@ -90,10 +99,6 @@ border-radius: var(--dsw-radius-md); } -.row:has(.toggle:focus-visible) { - background: var(--dsw-alias-interactive-bg-hover); -} - @media (hover: hover) { .summary:not(:disabled):hover, .row:has(.toggle:not(:disabled)):hover { diff --git a/packages/client/ui-agent-team/src/client/TeamModeToggle.tsx b/packages/client/ui-agent-team/src/client/TeamModeToggle.tsx index a4a9bb09b2..90cfc4ebcd 100644 --- a/packages/client/ui-agent-team/src/client/TeamModeToggle.tsx +++ b/packages/client/ui-agent-team/src/client/TeamModeToggle.tsx @@ -46,11 +46,11 @@ function RootTeamModeSummary({ useProjection, locked, openPage, t }: TeamModeTog className={css.summary} data-model-menu-page="agent-team" disabled={locked} - onClick={() => { if (!locked) openPage({ key: 'agent-team', title: t('command.title') }) }} + onClick={() => { openPage({ key: 'agent-team', title: t('command.title') }) }} > {t('command.title')} {t(mode.enabled ? 'mode.on' : 'mode.off')} -