diff --git a/docs/subsystems/slots.md b/docs/subsystems/slots.md index d5be535fef..27ee80591b 100644 --- a/docs/subsystems/slots.md +++ b/docs/subsystems/slots.md @@ -163,10 +163,8 @@ Factory: conversation.content [ConversationContent] │ │ ├─ conversation.chat.markdown.fence [hoc, keyed by fence language] │ │ ├─ conversation.chat.aside [SessionPanel] │ │ │ ├─ conversation.session.panel.section [list] -│ │ │ │ ├─ id=environment [EnvironmentSection] -│ │ │ │ │ └─ conversation.session.panel.environment.row [list] -│ │ │ │ └─ id=subagents [SubagentsSection] -│ │ │ │ └─ conversation.session.panel.subagents.footer [list] +│ │ │ │ └─ id=environment [EnvironmentSection] +│ │ │ │ └─ conversation.session.panel.environment.row [list] │ │ │ └─ conversation.session.panel.section.actions [keyed] │ │ └─ conversation.chat.flow [ChatFlow] │ │ └─ conversation.chat.node [ChatNodeSeat dispatch] diff --git a/docs/subsystems/slots.zh.md b/docs/subsystems/slots.zh.md index 7d34dc1b67..9c9694f303 100644 --- a/docs/subsystems/slots.zh.md +++ b/docs/subsystems/slots.zh.md @@ -165,10 +165,8 @@ Factory: conversation.content [ConversationContent] │ │ ├─ conversation.chat.markdown.fence [hoc, keyed by fence language] │ │ ├─ conversation.chat.aside [SessionPanel] │ │ │ ├─ conversation.session.panel.section [list] -│ │ │ │ ├─ id=environment [EnvironmentSection] -│ │ │ │ │ └─ conversation.session.panel.environment.row [list] -│ │ │ │ └─ id=subagents [SubagentsSection] -│ │ │ │ └─ conversation.session.panel.subagents.footer [list] +│ │ │ │ └─ id=environment [EnvironmentSection] +│ │ │ │ └─ conversation.session.panel.environment.row [list] │ │ │ └─ conversation.session.panel.section.actions [keyed] │ │ └─ conversation.chat.flow [ChatFlow] │ │ └─ conversation.chat.node [ChatNodeSeat dispatch] diff --git a/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.i18n.yaml b/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.i18n.yaml index 045d5b9f53..61fa93f12f 100644 --- a/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.i18n.yaml +++ b/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.i18n.yaml @@ -3,14 +3,14 @@ # After editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.md /: - en: 750652b888b84c3f - zh: 0e587900bb187ff2 + en: 9036df7633bfa9a8 + zh: 6509cb0a0a1d1d01 /session-header-entries-move-into-the-session-panel: en: 734e00590192932a zh: 09ac76ce818f1436 /session-header-entries-move-into-the-session-panel/change: - en: 8784237e870b427b - zh: c636eb3cb9ef1cc5 + en: 90f16e14597e9a71 + zh: e81e9ad526238465 /session-header-entries-move-into-the-session-panel/migration: - en: 4a83e0877cc47f10 - zh: aefacb01489018e5 + en: e1d76738e07b2b28 + zh: 700f2931859ec17c diff --git a/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.md b/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.md index b2d818ec3b..6d01913666 100644 --- a/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.md +++ b/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.md @@ -1,6 +1,6 @@ --- kind: upgrade-guide -description: "Background jobs, subagents, and forge change requests move from the Session header and right sidebar into the Session panel, which renames the subagent footer slot and retires the forge tab type." +description: "Background jobs, subagents, and forge change requests move from the Session header and right sidebar into the Session panel, which removes the subagent footer slot and retires the forge tab type." --- # Session header entries move into the Session panel @@ -11,7 +11,7 @@ English | [中文](guide.zh.md) The Web and Desktop Session header used to show a background-jobs button, a subagents button whose menu ended with the `conversation.session.header.actions.subagent.footer` slot, and, with the forge bundle, a change requests button that opened the `forge-panel` right-sidebar tab. These entries now live in the [Session panel](../../../../packages/client/ui-session-panel/README.md) that the header toggle opens: -- [`dsh-client-ui-jobs`](../../../../packages/client/ui-jobs/README.md) and [`dsh-client-ui-subagent`](../../../../packages/client/ui-subagent/README.md) register Background jobs and Subagents sections; the subagent footer slot is now `conversation.session.panel.subagents.footer`. +- [`dsh-client-ui-jobs`](../../../../packages/client/ui-jobs/README.md) and [`dsh-client-ui-subagent`](../../../../packages/client/ui-subagent/README.md) register Background jobs and Subagents sections; the subagent footer slot is removed, and the shared task board that filled it is now its own Shared tasks section. - [`dsh-experimental-client-ui-forge`](../../../../packages/experimental/client-ui-forge/README.md) registers a Change requests section, checkout and local changes rows in the Environment section, and an attention mark on the toggle. It no longer registers the `forge-panel` tab type, its tab title, or a `conversation.session.header.utilities` entry; the changes view keeps its `forge-changes` tab type. - Type exports follow the components: `JobsSection*` replaces `JobListAction*`/`JobListInjected`, `SubagentsSection*` replaces `SubagentCatalogAction*`, and the forge `ChangeRequestsSection*`, `ChangeRequestsActions*`, `CheckoutRow*`, `LocalChangesRow*`, and `AttentionIndicator*` types replace `ForgeTab*`, `HeaderButton*`, and `LocalChangesCardProps`. @@ -19,7 +19,7 @@ Client plugins and runtime extensions that register into the old footer slot, op ## Migration -1. In Client plugins and runtime extensions, replace every `conversation.session.header.actions.subagent.footer` registration and child declaration with `conversation.session.panel.subagents.footer`. +1. In Client plugins and runtime extensions, replace every `conversation.session.header.actions.subagent.footer` registration with a `conversation.session.panel.section` registration that has its own `id`, `order`, and `label`, and remove child declarations of the old slot. 2. Replace calls such as `ctx.sidebarRight.openTab('forge-panel')` by asking the user to open the Session panel; to place content beside the change requests, register a `conversation.session.panel.section` entry, as the [Session panel README](../../../../packages/client/ui-session-panel/README.md) describes. 3. Update type imports to the names listed under Change. -4. Confirm the migration by running `pnpm run typecheck`, then opening a Session in Web, clicking the Session panel toggle in the header, and finding the footer content under the Subagents section. +4. Confirm the migration by running `pnpm run typecheck`, then opening a Session in Web, clicking the Session panel toggle in the header, and finding the content in its own section. diff --git a/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.zh.md b/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.zh.md index 0e115ef838..ad2f6963eb 100644 --- a/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.zh.md +++ b/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.zh.md @@ -1,6 +1,6 @@ --- kind: upgrade-guide -description: "后台任务、子智能体与 forge 变更请求从会话标题栏和右侧边栏移入会话面板,子智能体页脚 slot 随之改名,forge 标签页类型退役。" +description: "后台任务、子智能体与 forge 变更请求从会话标题栏和右侧边栏移入会话面板,子智能体页脚 slot 随之移除,forge 标签页类型退役。" --- # 会话标题栏入口移入会话面板 @@ -11,7 +11,7 @@ description: "后台任务、子智能体与 forge 变更请求从会话标题 Web 与 Desktop 的会话标题栏此前显示后台任务按钮、子智能体按钮(其菜单末尾是 `conversation.session.header.actions.subagent.footer` slot),以及启用 forge 套件时打开 `forge-panel` 右侧边栏标签页的变更请求按钮。这些入口现在位于由标题栏开关打开的[会话面板](../../../../packages/client/ui-session-panel/README.zh.md)中: -- [`dsh-client-ui-jobs`](../../../../packages/client/ui-jobs/README.zh.md) 与 [`dsh-client-ui-subagent`](../../../../packages/client/ui-subagent/README.zh.md) 注册“后台任务”与“子智能体”分栏;子智能体页脚 slot 改为 `conversation.session.panel.subagents.footer`。 +- [`dsh-client-ui-jobs`](../../../../packages/client/ui-jobs/README.zh.md) 与 [`dsh-client-ui-subagent`](../../../../packages/client/ui-subagent/README.zh.md) 注册“后台任务”与“子智能体”分栏;子智能体页脚 slot 已移除,原来填充它的共享任务板现在是独立的“共享任务”分栏。 - [`dsh-experimental-client-ui-forge`](../../../../packages/experimental/client-ui-forge/README.zh.md) 注册“变更请求”分栏、“环境”分栏中的检出行与本地变更行,以及开关上的提醒标记。它不再注册 `forge-panel` 标签页类型及其标题,也不再注册 `conversation.session.header.utilities` 条目;变更视图仍使用 `forge-changes` 标签页类型。 - 类型导出随组件改名:`JobsSection*` 取代 `JobListAction*`/`JobListInjected`,`SubagentsSection*` 取代 `SubagentCatalogAction*`,forge 的 `ChangeRequestsSection*`、`ChangeRequestsActions*`、`CheckoutRow*`、`LocalChangesRow*` 与 `AttentionIndicator*` 类型取代 `ForgeTab*`、`HeaderButton*` 与 `LocalChangesCardProps`。 @@ -19,7 +19,7 @@ Web 与 Desktop 的会话标题栏此前显示后台任务按钮、子智能体 ## 迁移 -1. 在 Client 插件与运行时扩展中,把对 `conversation.session.header.actions.subagent.footer` 的注册与子 slot 声明全部改为 `conversation.session.panel.subagents.footer`。 +1. 在 Client 插件与运行时扩展中,把对 `conversation.session.header.actions.subagent.footer` 的注册改为带自己的 `id`、`order` 和 `label` 的 `conversation.session.panel.section` 注册,并移除旧 slot 的子 slot 声明。 2. 把 `ctx.sidebarRight.openTab('forge-panel')` 之类的调用改为提示用户打开会话面板;如需在变更请求旁放置内容,按[会话面板 README](../../../../packages/client/ui-session-panel/README.zh.md) 的说明注册 `conversation.session.panel.section` 条目。 3. 按“变更”中列出的名称更新类型导入。 -4. 运行 `pnpm run typecheck`,然后在 Web 中打开一个 Session,点击标题栏中的会话面板开关,在“子智能体”分栏下找到页脚内容,即确认迁移完成。 +4. 运行 `pnpm run typecheck`,然后在 Web 中打开一个 Session,点击标题栏中的会话面板开关,在其独立分栏中找到这些内容,即确认迁移完成。 diff --git a/packages/client/ui-agent-team/README.i18n.yaml b/packages/client/ui-agent-team/README.i18n.yaml index 091f66d174..e368b00657 100644 --- a/packages/client/ui-agent-team/README.i18n.yaml +++ b/packages/client/ui-agent-team/README.i18n.yaml @@ -3,29 +3,29 @@ # After editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-agent-team/README.md /: - en: 356f94d30f140ff8 - zh: 0bca4d344825321c + en: 7dc6eba0f4471f92 + zh: 9fdf11a94995a75d /deepseek-ai-dsh-client-ui-agent-team: en: 39c47e6e926425bf zh: 0fd155c454355e3a /deepseek-ai-dsh-client-ui-agent-team/summary: - en: 8e14c24476cf235c - zh: ab0e5e6a431893ec + en: f856eb1b0b6645d1 + zh: 91fa3b344ec21e66 /deepseek-ai-dsh-client-ui-agent-team/table-of-contents: en: d152484eb41ac6b4 zh: 09388d293f9be9cb /deepseek-ai-dsh-client-ui-agent-team/use-this-package: - en: 1d0c7d73cd3de38b - zh: 6e9d323c228b70d3 + en: d198b75bb9d239ec + zh: 7a40a8a125948dfa /deepseek-ai-dsh-client-ui-agent-team/use-this-package/inspect-the-task-board: - en: f597ca74be6cb613 - zh: 8bfda029a0f3e40a + en: 0a5f4d064e4e9863 + zh: 22801b884e8508b2 /deepseek-ai-dsh-client-ui-agent-team/understand-the-implementation: - en: 4fd1c83aa652c25d - zh: 60ab94db9ecb6faf + en: 44618947bf773a42 + zh: b336de11f525ce07 /deepseek-ai-dsh-client-ui-agent-team/further-exploration: - en: 4b7e17ead1b44084 - zh: 58a98e07c52ad193 + en: 5bc48efe19557367 + zh: c00e5e1a75d0afa8 /deepseek-ai-dsh-client-ui-agent-team/model-experience: en: 47ebeba07d72759d zh: 8fe8133f6dd845a9 diff --git a/packages/client/ui-agent-team/README.md b/packages/client/ui-agent-team/README.md index acd4a17aae..a35e984699 100644 --- a/packages/client/ui-agent-team/README.md +++ b/packages/client/ui-agent-team/README.md @@ -1,5 +1,5 @@ --- -description: "Inspect the shared task board in the Web Session panel's Subagents section." +description: "Inspect the shared task board in the Web Session panel's Shared tasks section." kind: "package-reference" --- @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -This package displays shared tasks below the subagent tree in the Session panel's Subagents section. Host projection frames keep task state current without a refresh control. Ordinary subagent navigation owns the member list and teammate conversations. The Web bundle loads this package; it adds no model-facing input. +This package adds the Shared tasks section to the Session panel, between Subagents and Background jobs. Host projection frames keep task state current without a refresh control. Ordinary subagent navigation owns the member list and teammate conversations. The Web bundle loads this package; it adds no model-facing input. ## Table of Contents @@ -25,7 +25,7 @@ This package displays shared tasks below the subagent tree in the Session panel' ## Use this package -In the root conversation’s model and reasoning menu, turn on **Enable agent teamwork**. New Sessions default to off. While enabled, open the root conversation’s Session panel to see members in the Subagents section above shared tasks. Child conversations keep subagent navigation without a Team switch, including before their subagent address is discovered. The board reads the current Session’s `agentTeam` projection, so it appears only in a Session whose own projection is enabled. The Subagents section is hidden when both the subagent catalog and shared tasks are empty; catalog and task-record errors remain visible. When the catalog loaded empty, a section shown for shared tasks or a task-record error shows “No subagents” above them. Without shared tasks or a task-record error, the section shows only subagent navigation, without a shared-task module or empty-state copy. Turning it off retains tasks and subagents. The entire Team row highlights on hover and toggles the selection when clicked, except for its independent information button. 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. The adjacent information button explains shared-task coordination and additional token use on hover, keyboard focus, or click/tap without changing the selection. Escape or an outside press dismisses the explanation. +In the root conversation’s model and reasoning menu, turn on **Enable agent teamwork**. New Sessions default to off. While enabled, open the root conversation’s Session panel to see members in the Subagents section and tasks in the Shared tasks section below it. Child conversations keep subagent navigation without a Team switch, including before their subagent address is discovered. The board reads the current Session’s `agentTeam` projection, so it appears only in a Session whose own projection is enabled. The Shared tasks section is hidden while the Session has no shared tasks and no task-record error, independently of the Subagents section. Turning it off retains tasks and subagents. The entire Team row highlights on hover and toggles the selection when clicked, except for its independent information button. 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. The adjacent information button explains shared-task coordination and additional token use on hover, keyboard focus, or click/tap without changing the selection. Escape or an outside press dismisses the explanation. 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. @@ -37,7 +37,7 @@ The [Web bundle](../../bundle/web-app/README.md) loads this package by default. Ready pending tasks use idle, blocked pending tasks use warning, in-progress tasks use ongoing, and completed tasks use done. -The noncollapsible Shared tasks header uses a Checklist icon and completed, in-progress, and pending counts, with zero counts omitted and wording and separators matching the input task list. Compact read-only rows show the subject, status, and a chevron, with 13px primary titles and hover geometry aligned to subagent rows; expanded details use 12px text. Task rows use 7px vertical padding, 6px horizontal padding, and 7px gaps to align their clickable content with subagent rows. All task details start closed; opening one closes the previous task. Details show only the full description when present, followed by a single-line owner label and owner name in the same color with a 4px gap. Long owner names are ellipsized and reveal their full text in a tooltip only when clipped. Task-text and owner tooltips appear after 500ms of hover. Owners display the task's saved `ownerName`, such as `lead` or `reviewer/checker`, independently of loaded subagent catalogs. A task without `ownerName` displays its `ownerId`; a task without either field displays the localized unowned label. Below a nonempty subagent tree, the board has a 4px top margin rather than a divider. The Shared tasks header keeps a 7px icon/title gap and an additional 4px before its counts. The Session panel scrolls the board; task lists and details have no nested scrolling. Agents mutate tasks through tools; the panel provides no mutation controls. A projection failure appears separately above any retained tasks and remains visible when no tasks exist. +The panel draws the section title, and the title control (`conversation.session.panel.section.actions`, key `shared-tasks`) shows completed, in-progress, and pending counts, with zero counts omitted and wording and separators matching the input task list. Compact read-only rows show the subject, status, and a chevron, with 13px primary titles; expanded details use 12px text and start at the title's edge. Task rows follow the panel's columns, like subagent rows: the status glyph's center 14px from the row start, titles at 30px, and the chevron's center 14px from the row end. All task details start closed; opening one closes the previous task. Details show only the full description when present, followed by a single-line owner label and owner name in the same color with a 4px gap. Long owner names are ellipsized and reveal their full text in a tooltip only when clipped. Task-text and owner tooltips appear after 500ms of hover. Owners display the task's saved `ownerName`, such as `lead` or `reviewer/checker`, independently of loaded subagent catalogs. A task without `ownerName` displays its `ownerId`; a task without either field displays the localized unowned label. The Session panel scrolls the board; task lists and details have no nested scrolling. Agents mutate tasks through tools; the panel provides no mutation controls. A projection failure appears separately above any retained tasks and remains visible when no tasks exist. ----- @@ -47,15 +47,15 @@ The noncollapsible Shared tasks header uses a Checklist icon and completed, in-p
Implementation internals — click to expand -The Client export registers its locale dictionaries, its Subagents section footer, and its model-menu slots through Cordis effects; it mounts no Remote namespace. Disposing the plugin fiber removes its registrations. +The Client export registers its locale dictionaries, its Session panel section with the title control, and its model-menu slots through Cordis effects; it mounts no Remote namespace. Disposing the plugin fiber removes its registrations. -The Session panel owns showing, scrolling, and dismissing the Subagents section, and `dsh-client-ui-subagent` owns its tree. This package contributes the task board to the section’s `conversation.session.panel.subagents.footer` slot below the tree. The board reads the current Session’s mode and tasks through `useProjection('agentTeam')`. An available, enabled projection supplies the task section only when it contains nondeleted tasks; a projection failure can render independently without a task section. Task IDs, dependencies, readiness, write scopes, and write scope warnings remain in task data but are not displayed as detail fields; blocked pending tasks still use the warning glyph. +The Session panel owns showing, scrolling, and dismissing the section, which registers as `shared-tasks` at `order: 250`. The board reads the current Session’s mode and tasks through `useProjection('agentTeam')`. An available, enabled projection supplies the task section only when it contains nondeleted tasks; a projection failure can render independently without a task section. Task IDs, dependencies, readiness, write scopes, and write scope warnings remain in task data but are not displayed as detail fields; blocked pending tasks still use the warning glyph. The [Chat visibility policy](../ui-chat/src/client/contract/chat-visibility.ts) hides only historical commands named `team` whose trimmed recorded arguments are exactly `on` or `off` and whose outcome is pending or successful. The remaining receipts use a localized running summary or preserve raw successful output, with a localized completed fallback when that text is empty. Rendering neither reads the current Team projection nor parses English outcome text. Filtering and localization affect only Chat presentation: command records, logs, trajectory, and raw errors remain unchanged. | File | Role | |---|---| -| [`src/client/mount.ts`](src/client/mount.ts) | Locale, Subagents section footer, and model-menu registrations | +| [`src/client/mount.ts`](src/client/mount.ts) | Locale, Session panel section, and model-menu registrations | | [`src/client/TeamBoard.tsx`](src/client/TeamBoard.tsx) | Projection-derived task section | | [`src/client/locales.ts`](src/client/locales.ts) | Panel and command copy in eight languages | | [`src/index.ts`](src/index.ts) | Inert Host entry | @@ -69,7 +69,7 @@ The [Chat visibility policy](../ui-chat/src/client/contract/chat-visibility.ts) - [Web bundle](../../bundle/web-app/README.md) — mounts the Client plugin by default. - [Agent Teams service](../../team/agent-team/README.md) — authoritative task and projection behavior. -- [Subagent UI](../ui-subagent/README.md) — the Session panel’s Subagents section, whose footer slot hosts the task board. +- [Session panel](../ui-session-panel/README.md) — hosts the Shared tasks section and draws its title. ----- diff --git a/packages/client/ui-agent-team/README.zh.md b/packages/client/ui-agent-team/README.zh.md index 2c6d541f78..6dff7196b3 100644 --- a/packages/client/ui-agent-team/README.zh.md +++ b/packages/client/ui-agent-team/README.zh.md @@ -1,5 +1,5 @@ --- -description: "在 Web 会话面板的「子智能体」分栏中查看共享任务板。" +description: "在 Web 会话面板的「共享任务」分栏中查看共享任务板。" kind: "package-reference" --- @@ -9,7 +9,7 @@ kind: "package-reference" ## 概述 -此包在会话面板的「子智能体」分栏中,将共享任务显示在 subagent 树下方。Host 投影帧持续更新任务状态,无需刷新控件。普通 subagent(子智能体)导航负责成员列表和队友对话。Web bundle 默认加载此包;它不添加模型可见输入。 +此包为会话面板添加「共享任务」分栏,位于「子智能体」与「后台任务」之间。Host 投影帧持续更新任务状态,无需刷新控件。普通 subagent(子智能体)导航负责成员列表和队友对话。Web bundle 默认加载此包;它不添加模型可见输入。 ## 目录 @@ -25,7 +25,7 @@ kind: "package-reference" ## 使用本包 -在根会话的模型与推理等级菜单中打开**启用智能体团队协作**。新 Session 默认关闭。开启后,打开根会话的会话面板,即可在「子智能体」分栏中同时查看上方的成员树和下方的共享任务。子会话保留子智能体导航,不显示 Team 开关,包括尚未发现子代理地址时。任务板读取当前 Session 的 `agentTeam` 投影,因此只在自身投影已开启的 Session 中显示。子智能体目录和共享任务都为空时隐藏「子智能体」分栏;目录或任务记录错误仍保持可见。目录加载为空、分栏因共享任务或任务记录错误而显示时,在其上方显示“暂无子智能体”。没有共享任务或任务记录错误时,分栏仅显示 subagent 导航,不显示共享任务模块或空状态文案。关闭后保留任务和子代理。团队设置整行在悬停时高亮,点击可切换状态,但独立的信息按钮除外。开关调用 `remote.agentTeams.setEnabled`,等待保存后的投影更新,失败由菜单宿主提示;锁定或保存中不能通过整行切换。旁边的信息按钮可通过悬停、键盘聚焦或点击/轻触查看共享任务协作与额外 token 消耗的说明,不改变开关状态。按 Escape 或点击外部可关闭说明。 +在根会话的模型与推理等级菜单中打开**启用智能体团队协作**。新 Session 默认关闭。开启后,打开根会话的会话面板,即可在「子智能体」分栏查看成员,并在其下方的「共享任务」分栏查看任务。子会话保留子智能体导航,不显示 Team 开关,包括尚未发现子代理地址时。任务板读取当前 Session 的 `agentTeam` 投影,因此只在自身投影已开启的 Session 中显示。会话没有共享任务且没有任务记录错误时,隐藏「共享任务」分栏,与「子智能体」分栏互不影响。关闭后保留任务和子代理。团队设置整行在悬停时高亮,点击可切换状态,但独立的信息按钮除外。开关调用 `remote.agentTeams.setEnabled`,等待保存后的投影更新,失败由菜单宿主提示;锁定或保存中不能通过整行切换。旁边的信息按钮可通过悬停、键盘聚焦或点击/轻触查看共享任务协作与额外 token 消耗的说明,不改变开关状态。按 Escape 或点击外部可关闭说明。 会话记录过模型请求后,从菜单开关停用团队需要确认;仅选择模型不会触发确认。请求历史尚未加载时,开关暂不可操作。弹窗说明工具、协作与可能的缓存影响,不会删除任务记录。取消、按 Escape 或关闭弹窗都保持团队状态不变。弹窗关闭后,焦点回到模型选择按钮。确认操作绑定到最初的会话,等待保存完成,失败时保留错误供重试,不依赖模型菜单保持打开。Team 模式没有斜杠命令;菜单切换不会生成 `command/run` 或 `command/done` 记录。 @@ -37,7 +37,7 @@ Chat 隐藏历史 `/team on` 和 `/team off` 记录中尚未完成或执行成 可开始的 pending 任务使用 idle 灰点,被依赖阻塞的 pending 任务使用 warning 橙点,in-progress 任务使用 ongoing loading,completed 任务使用 done 绿点。 -不可折叠的“共享任务”标题使用 Checklist 图标,并显示已完成、进行中和待处理数量;省略零值,文案和分隔符与输入区任务列表一致。紧凑只读行显示主题、状态和展开箭头,13px 主标题与悬停区域对齐子智能体行;展开详情使用 12px 文字。任务行使用 7px 垂直内边距、6px 水平内边距和 7px 间距,使可点击内容与 subagent 行对齐。所有任务详情初始关闭,打开一项会关闭上一项。详情仅显示完整描述(如有),下方以单行显示负责人标签和负责人名称,两者使用相同颜色,间距为 4px。过长的负责人名称以省略号截断,仅在被截断时通过工具提示显示完整内容。任务文字和负责人的工具提示在悬停 500ms 后显示。负责人显示任务保存的 `ownerName`,例如 `lead` 或 `reviewer/checker`,不依赖已加载的 subagent 目录。缺少 `ownerName` 时显示 `ownerId`;两个字段都没有时显示本地化的无负责人标签。位于非空 subagent 树下方时,任务板上方保留 4px 外边距,不显示分隔线。“共享任务”标题保留 7px 图标与文字间距,并在统计数量前额外留出 4px。会话面板负责任务板滚动,任务列表与详情不单独滚动。Agent 通过工具修改任务;面板不提供修改控件。投影失败以独立警告显示在保留的任务上方,即使没有任务也保持可见。 +分栏标题由面板绘制,标题控件(`conversation.session.panel.section.actions`,键为 `shared-tasks`)显示已完成、进行中和待处理数量;省略零值,文案和分隔符与输入区任务列表一致。紧凑只读行显示主题、状态和展开箭头,主标题 13px;展开详情使用 12px 文字,并从标题边缘开始。任务行与子智能体行一样遵循面板的列:状态图标中心距行起始 14px,标题从 30px 开始,箭头中心距行末端 14px。所有任务详情初始关闭,打开一项会关闭上一项。详情仅显示完整描述(如有),下方以单行显示负责人标签和负责人名称,两者使用相同颜色,间距为 4px。过长的负责人名称以省略号截断,仅在被截断时通过工具提示显示完整内容。任务文字和负责人的工具提示在悬停 500ms 后显示。负责人显示任务保存的 `ownerName`,例如 `lead` 或 `reviewer/checker`,不依赖已加载的 subagent 目录。缺少 `ownerName` 时显示 `ownerId`;两个字段都没有时显示本地化的无负责人标签。会话面板负责任务板滚动,任务列表与详情不单独滚动。Agent 通过工具修改任务;面板不提供修改控件。投影失败以独立警告显示在保留的任务上方,即使没有任务也保持可见。 ----- @@ -47,15 +47,15 @@ Chat 隐藏历史 `/team on` 和 `/team off` 记录中尚未完成或执行成
实现细节——点击展开 -Client export 通过 Cordis effect 注册语言字典、「子智能体」分栏 footer 与模型菜单 slot;它不挂载 Remote namespace。销毁插件 fiber 会移除这些注册。 +Client export 通过 Cordis effect 注册语言字典、带标题控件的会话面板分栏与模型菜单 slot;它不挂载 Remote namespace。销毁插件 fiber 会移除这些注册。 -会话面板负责「子智能体」分栏的显示、滚动和关闭,`dsh-client-ui-subagent` 负责其中的目录树。本包把任务板注册到分栏在目录树下方的 `conversation.session.panel.subagents.footer` slot。任务板通过 `useProjection('agentTeam')` 读取当前 Session 的模式与任务;仅当投影可用、已开启且含有未删除的任务时才显示任务区;投影错误可独立显示,不需要任务区。任务 ID、依赖、准备状态、写入范围及其提示仍保留在任务数据中,但不作为详情字段显示;被依赖阻塞的 pending 任务仍使用 warning 图标。 +会话面板负责分栏的显示、滚动和关闭;分栏注册为 `shared-tasks`,`order: 250`。任务板通过 `useProjection('agentTeam')` 读取当前 Session 的模式与任务;仅当投影可用、已开启且含有未删除的任务时才显示任务区;投影错误可独立显示,不需要任务区。任务 ID、依赖、准备状态、写入范围及其提示仍保留在任务数据中,但不作为详情字段显示;被依赖阻塞的 pending 任务仍使用 warning 图标。 [Chat 可见性策略](../ui-chat/src/client/contract/chat-visibility.ts) 仅隐藏名称为 `team`、已记录参数去除首尾空白后恰为 `on` 或 `off`,且尚未完成或执行成功的历史命令。其余回执在执行中显示本地化摘要,成功时保留原始结果文本,文本为空则使用本地化的完成提示。渲染既不读取当前 Team 投影,也不解析英文结果文案。过滤与本地化仅影响 Chat 展示:命令记录、日志、轨迹和原始错误均保持不变。 | 文件 | 职责 | |---|---| -| [`src/client/mount.ts`](src/client/mount.ts) | 语言字典、「子智能体」分栏 footer 和模型菜单注册 | +| [`src/client/mount.ts`](src/client/mount.ts) | 语言字典、会话面板分栏和模型菜单注册 | | [`src/client/TeamBoard.tsx`](src/client/TeamBoard.tsx) | 从投影派生的任务区 | | [`src/client/locales.ts`](src/client/locales.ts) | 八种语言的面板与命令文案 | | [`src/index.ts`](src/index.ts) | 不执行行为的 Host entry | @@ -69,7 +69,7 @@ Client export 通过 Cordis effect 注册语言字典、「子智能体」分栏 - [Web bundle](../../bundle/web-app/README.zh.md)——默认挂载本 Client plugin。 - [Agent Teams 服务](../../team/agent-team/README.zh.md) — 任务和投影行为的权威来源。 -- [Subagent UI](../ui-subagent/README.zh.md)——会话面板的「子智能体」分栏,其 footer slot 承载任务板。 +- [会话面板](../ui-session-panel/README.zh.md)——承载「共享任务」分栏并绘制其标题。 ----- diff --git a/packages/client/ui-agent-team/package.json b/packages/client/ui-agent-team/package.json index 32fb78c0ec..36de3a0248 100644 --- a/packages/client/ui-agent-team/package.json +++ b/packages/client/ui-agent-team/package.json @@ -34,7 +34,8 @@ "@deepseek-ai/dsh-client-ui-conversation", "@deepseek-ai/dsh-client-ui-chat", "@deepseek-ai/dsh-client-ui-layout", - "@deepseek-ai/dsh-client-ui-primitives" + "@deepseek-ai/dsh-client-ui-primitives", + "@deepseek-ai/dsh-client-ui-session-panel" ], "platform": "web" } @@ -68,7 +69,7 @@ "@deepseek-ai/dsh-client-ui-model-selection": "workspace:*", "@deepseek-ai/dsh-client-ui-layout": "workspace:*", "@deepseek-ai/dsh-api-remotes": "workspace:*", - "@deepseek-ai/dsh-client-ui-subagent": "workspace:*", + "@deepseek-ai/dsh-client-ui-session-panel": "workspace:*", "@deepseek-ai/dsh-agent": "workspace:*" }, "files": [ diff --git a/packages/client/ui-agent-team/src/client/TeamBoard.module.css b/packages/client/ui-agent-team/src/client/TeamBoard.module.css index 3d10436a16..a40ddffc16 100644 --- a/packages/client/ui-agent-team/src/client/TeamBoard.module.css +++ b/packages/client/ui-agent-team/src/client/TeamBoard.module.css @@ -1,46 +1,18 @@ +/* Rows share the Session panel's columns: the glyph's center 14px from the row + start, text at 30px, and the chevron's center 14px from the row end. */ .board { min-width: 0; - padding: 8px 7px; -} - -.board[data-with-members='true'] { - margin-top: 4px; -} - -.header { - display: flex; - align-items: center; - flex-wrap: wrap; - gap: 4px 7px; - margin: 0 0 4px; - padding: 0; -} - -.lead, -.glyph, -.chevron { - display: grid; - flex: none; - place-items: center; - color: var(--dsw-alias-label-tertiary); -} - -.title { - flex: none; - color: var(--dsw-alias-label-primary); - font-size: 13px; - font-weight: 500; - line-height: 24px; } +/* Beside the section title, one line that clips before the title does. */ .progress { - margin-inline-start: 4px; + min-width: 0; + overflow: hidden; color: var(--dsw-alias-label-tertiary); - font-size: 13px; - font-weight: 400; + font: var(--dsw-font-xxs-12); font-variant-numeric: tabular-nums; - line-height: 20px; - overflow-wrap: anywhere; + text-overflow: ellipsis; + white-space: nowrap; } .tasks { @@ -59,18 +31,15 @@ box-sizing: border-box; display: flex; align-items: center; - gap: 7px; - width: calc(100% + 12px); + gap: 8px; + width: 100%; min-width: 0; - margin: 0 -6px; - padding: 7px 6px; + padding: 5px 6px; border: 0; - border-radius: var(--dsw-radius-md); + border-radius: var(--dsw-radius-sm); background: transparent; color: var(--dsw-alias-label-primary); - font: inherit; - font-size: 13px; - line-height: 17px; + font: var(--dsw-font-xs-13); text-align: left; cursor: pointer; } @@ -86,9 +55,14 @@ } } -.glyph { - width: 14px; - height: 17px; +.glyph, +.chevron { + display: grid; + flex: none; + place-items: center; + width: 16px; + height: 20px; + color: var(--dsw-alias-label-tertiary); } .subject { @@ -113,13 +87,8 @@ transform: rotate(180deg); } -.chevron { - width: 28px; - height: 17px; -} - .details { - padding: 0 0 8px 21px; + padding: 0 6px 8px 30px; color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 18px; @@ -156,8 +125,8 @@ .error { display: flex; align-items: flex-start; - gap: 7px; - padding: 8px 0; + gap: 8px; + padding: 5px 6px; color: var(--dsw-alias-state-error-primary); font-size: 12px; line-height: 18px; diff --git a/packages/client/ui-agent-team/src/client/TeamBoard.tsx b/packages/client/ui-agent-team/src/client/TeamBoard.tsx index 42d687d854..dcb2e92f84 100644 --- a/packages/client/ui-agent-team/src/client/TeamBoard.tsx +++ b/packages/client/ui-agent-team/src/client/TeamBoard.tsx @@ -1,20 +1,25 @@ +/** Shared tasks section of the Session panel: the task rows and the progress beside the section title. */ import { useState } from 'react' import type { SessionId } from '@deepseek-ai/dsh-session/types' -import type { TeamTaskView, TeamTaskId } from '@deepseek-ai/dsh-agent-team/client' +import type { TeamProjection, TeamTaskView, TeamTaskId } from '@deepseek-ai/dsh-agent-team/client' import type {} from '@deepseek-ai/dsh-api-session-controller/client' import { - IconChecklistOutlineRegular, IconChevronDownOutlineRegular, + IconChevronDownOutlineRegular, StateDot, Tooltip, type StateDotState, } from '@deepseek-ai/dsh-client-ui-primitives' import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots' -import type {} from '@deepseek-ai/dsh-client-ui-subagent/client' +import type {} from '@deepseek-ai/dsh-client-ui-session-panel/client' import type {} from '@deepseek-ai/dsh-client-ui-conversation/client' import { NS, type TeamKey } from './locales.ts' import css from './TeamBoard.module.css' -/** Full props of the task board below the shared subagent catalog. */ +/** Full props of the shared tasks section body. */ export type TeamBoardProps = - PropsRuntime<'conversation.session.panel.subagents.footer'> & PropsLocale + PropsRuntime<'conversation.session.panel.section'> & PropsLocale + +/** Full props of the progress beside the section title. */ +export type TeamProgressProps = + PropsRuntime<'conversation.session.panel.section.actions'> & PropsLocale type VisibleTask = TeamTaskView & { status: Exclude } @@ -26,6 +31,10 @@ const dotStates = { pending: 'idle', in_progress: 'ongoing', completed: 'done', } satisfies Record +function visibleTasks(team: TeamProjection): VisibleTask[] { + return team.tasks.filter((task): task is VisibleTask => task.status !== 'deleted') +} + function progressLabel(tasks: readonly VisibleTask[], t: TeamBoardProps['t']): string { const completed = tasks.filter(task => task.status === 'completed').length const active = tasks.filter(task => task.status === 'in_progress').length @@ -78,35 +87,48 @@ function TaskRow({ task, rootId, expanded, onToggle, t }: Pick (state.projectionsBySession[sessionId]?.values.subagentCatalog?.length ?? 0) > 0) const [expandedTaskId, setExpandedTaskId] = useState(null) if (!team?.enabled) return null - const tasks = team.tasks.filter((task): task is VisibleTask => task.status !== 'deleted') - const failure = team.failure === undefined ? null : ( -
{t('failure', { message: team.failure })}
- ) - if (tasks.length === 0) return failure === null ? null :
{failure}
+ const tasks = visibleTasks(team) + if (tasks.length === 0 && team.failure === undefined) return null return ( -
-

- - {t('tasks')} - {progressLabel(tasks, t)} -

- {failure} -
    - {tasks.map(task => ( - { setExpandedTaskId(current => current === task.id ? null : task.id) }} - t={t} - /> - ))} -
-
+
+ {team.failure !== undefined && ( +
{t('failure', { message: team.failure })}
+ )} + {tasks.length > 0 && ( +
    + {tasks.map(task => ( + { setExpandedTaskId(current => current === task.id ? null : task.id) }} + t={t} + /> + ))} +
+ )} +
) } + +/** + * Render the tasks' progress beside the section title, one line that clips. + * @param props - the `agentTeam` projection and copy. + * @returns the progress phrase, or null without visible tasks. + */ +export function TeamProgress({ useProjection, t }: TeamProgressProps) { + const team = useProjection('agentTeam') + if (!team?.enabled) return null + const progress = progressLabel(visibleTasks(team), t) + if (progress === '') return null + return {progress} +} diff --git a/packages/client/ui-agent-team/src/client/index.ts b/packages/client/ui-agent-team/src/client/index.ts index 23de9e7ee5..08484146ff 100644 --- a/packages/client/ui-agent-team/src/client/index.ts +++ b/packages/client/ui-agent-team/src/client/index.ts @@ -4,7 +4,7 @@ import type { Context as ClientContext } from '@deepseek-ai/cordis' import { registerAgentTeamUi } from './mount.ts' export { inject } from './mount.ts' -export type { TeamBoardProps } from './TeamBoard.tsx' +export type { TeamBoardProps, TeamProgressProps } from './TeamBoard.tsx' export type { TeamKey } from './locales.ts' /** diff --git a/packages/client/ui-agent-team/src/client/locales.ts b/packages/client/ui-agent-team/src/client/locales.ts index 0c5b29a4fb..04718b046b 100644 --- a/packages/client/ui-agent-team/src/client/locales.ts +++ b/packages/client/ui-agent-team/src/client/locales.ts @@ -13,7 +13,6 @@ export const zh = { 'command.done': '已完成', 'command.failed': '执行失败', 'command.failedReason': '执行失败:{reason}', - trigger: '任务板', 'mode.label': '启用智能体团队协作', 'mode.infoLabel': '关于智能体团队协作', 'mode.description': '通过共享任务板协调多个智能体的分工与进度,复杂任务表现更佳,token 开销也相应更高。', @@ -50,7 +49,6 @@ export const en = { 'command.done': 'Completed', 'command.failed': 'Failed', 'command.failedReason': 'Failed: {reason}', - trigger: 'Task board', 'mode.label': 'Enable agent teamwork', 'mode.infoLabel': 'About agent teamwork', 'mode.description': 'Coordinate work and progress across agents with a shared task board for better results on complex tasks, with correspondingly higher token costs.', @@ -94,7 +92,6 @@ export const ja = { 'disable.cancel': 'キャンセル', 'disable.confirm': '無効にする', 'disable.close': '閉じる', - 'trigger': 'タスクボード', 'loading': 'タスクボードを読み込み中…', 'unavailable': 'タスクボードは利用できません', 'failure': '保存されたタスクレコードが無効です: {message}', @@ -128,7 +125,6 @@ export const es = { 'disable.cancel': 'Cancelar', 'disable.confirm': 'Confirmar desactivación', 'disable.close': 'Cerrar', - trigger: 'Tablero de tareas', loading: 'Cargando tablero de tareas…', unavailable: 'El tablero de tareas no está disponible', failure: 'Registro de tarea persistente no válido: {message}', @@ -162,7 +158,6 @@ export const fr = { 'disable.cancel': 'Annuler', 'disable.confirm': 'Confirmer la désactivation', 'disable.close': 'Fermer', - trigger: 'Tableau des tâches', loading: 'Chargement du tableau des tâches…', unavailable: 'Le tableau des tâches n’est pas disponible', failure: 'Enregistrement de tâche persistant non valide : {message}', @@ -196,7 +191,6 @@ export const de = { 'disable.cancel': 'Abbrechen', 'disable.confirm': 'Deaktivierung bestätigen', 'disable.close': 'Schließen', - trigger: 'Aufgabenübersicht', loading: 'Aufgabenübersicht wird geladen…', unavailable: 'Aufgabenübersicht ist nicht verfügbar', failure: 'Ungültiger gespeicherter Aufgabeneintrag: {message}', @@ -230,7 +224,6 @@ export const ru = { 'disable.cancel': 'Отмена', 'disable.confirm': 'Подтвердить отключение', 'disable.close': 'Закрыть', - trigger: 'Доска задач', loading: 'Загрузка доски задач…', unavailable: 'Доска задач недоступна', failure: 'Недопустимая сохранённая запись задачи: {message}', @@ -264,7 +257,6 @@ export const pt = { 'disable.cancel': 'Cancelar', 'disable.confirm': 'Confirmar desativação', 'disable.close': 'Fechar', - trigger: 'Quadro de tarefas', loading: 'Carregando quadro de tarefas…', unavailable: 'O quadro de tarefas não está disponível', failure: 'Registro de tarefa persistente inválido: {message}', diff --git a/packages/client/ui-agent-team/src/client/mount.ts b/packages/client/ui-agent-team/src/client/mount.ts index 6a899617ec..1017861441 100644 --- a/packages/client/ui-agent-team/src/client/mount.ts +++ b/packages/client/ui-agent-team/src/client/mount.ts @@ -2,7 +2,7 @@ import type { Context as ClientContext } from '@deepseek-ai/cordis' import type {} from '@deepseek-ai/dsh-api-session-controller/client' -import type {} from '@deepseek-ai/dsh-client-ui-subagent/client' +import type {} from '@deepseek-ai/dsh-client-ui-session-panel/client' import type {} from '@deepseek-ai/dsh-client-ui-conversation/client' import type {} from '@deepseek-ai/dsh-client-locale/client' import type {} from '@deepseek-ai/dsh-client-ui-renderer/client' @@ -12,7 +12,7 @@ import { createSnapshotStore } from '@deepseek-ai/dsh-client-store' import type { SessionId } from '@deepseek-ai/dsh-session/types' import { TeamDisableConfirmation, type TeamDisableConfirmationInjected, type TeamDisableRequest } from './TeamDisableConfirmation.tsx' import { TeamModeToggle, type TeamModeToggleInjected } from './TeamModeToggle.tsx' -import { TeamBoard } from './TeamBoard.tsx' +import { TeamBoard, TeamProgress } from './TeamBoard.tsx' import { TeamCommandRow } from './TeamCommandRow.tsx' import { en, ja, es, fr, de, ru, pt, NS, zh, type TeamKey } from './locales.ts' @@ -27,12 +27,13 @@ declare module '@deepseek-ai/dsh-client-ui-slots' { export const inject = ['slots', 'locale'] /** - * Register the task-board dictionaries and subagent catalog sections. - * The panel reads the root Session’s `agentTeam` projection through standard Session hooks. + * Register the task-board dictionaries and the Session panel's shared tasks section. + * The section reads the root Session’s `agentTeam` projection through standard Session hooks. * @param ctx - Client Context carrying the injected locale and slot services. */ export function registerAgentTeamUi(ctx: ClientContext): void { ctx.effect(() => ctx.locale.register(NS, { zh, en, ja, es, fr, de, ru, pt }), 'client-ui-agent-team: dictionaries') + const t = ctx.locale.bind(NS) ctx.slots.inject('conversation.chat.commandview', () => ctx.slots.register({ name: 'conversation.chat.commandview', key: 'team', locale: NS, }, TeamCommandRow)) @@ -65,7 +66,19 @@ export function registerAgentTeamUi(ctx: ClientContext): void { }, TeamModeToggle)) }) }) - ctx.slots.inject('conversation.session.panel.subagents.footer', () => ctx.slots.register({ - name: 'conversation.session.panel.subagents.footer', id: 'agent-team', locale: NS, - }, TeamBoard)) + ctx.slots.inject('conversation.session.panel.section', function* () { + yield ctx.slots.register({ + name: 'conversation.session.panel.section', + id: 'shared-tasks', + // After subagents (200), before background jobs (300). + order: 250, + label: () => t('tasks'), + locale: NS, + }, TeamBoard) + yield ctx.slots.register({ + name: 'conversation.session.panel.section.actions', + key: 'shared-tasks', + locale: NS, + }, TeamProgress) + }) } diff --git a/packages/client/ui-agent-team/tests/browser-plugin.client.spec.ts b/packages/client/ui-agent-team/tests/browser-plugin.client.spec.ts index 688ef0ebcc..dfb18db0c4 100644 --- a/packages/client/ui-agent-team/tests/browser-plugin.client.spec.ts +++ b/packages/client/ui-agent-team/tests/browser-plugin.client.spec.ts @@ -5,9 +5,10 @@ import { RemoteError, TestRemote } from '@deepseek-ai/dsh-client-test-runtime' import { TeamModeToggle, type TeamModeToggleInjected } from '../src/client/TeamModeToggle.tsx' import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client' import { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client' -import { TeamBoard } from '../src/client/TeamBoard.tsx' +import { TeamBoard, TeamProgress } from '../src/client/TeamBoard.tsx' import { TeamCommandRow } from '../src/client/TeamCommandRow.tsx' import { TeamDisableConfirmation, type TeamDisableConfirmationInjected } from '../src/client/TeamDisableConfirmation.tsx' +import { resolveSlotLabel } from '@deepseek-ai/dsh-client-ui-slots' import { apply, inject } from '../src/client/index.ts' import { apply as nodeApply } from '../src/index.ts' @@ -19,43 +20,52 @@ async function bench() { const collapseHeader = ctx.slots.register({ name: 'root', children: { - 'conversation.session.panel.subagents.footer': { kind: 'list', scope: 'session' }, + 'conversation.session.panel.section': { kind: 'list', scope: 'session' }, + 'conversation.session.panel.section.actions': { kind: 'keyed', scope: 'session' }, 'conversation.input.model': { kind: 'single', scope: 'session' }, 'shell.overlay': { kind: 'list', scope: 'root' }, }, } as never, () => null) const fiber = ctx.plugin({ inject: [...inject], apply }) await fiber.await() - const entry = () => ctx.slots.entries('conversation.session.panel.subagents.footer') + const entry = () => ctx.slots.entries('conversation.session.panel.section') .find(candidate => candidate.component === TeamBoard) - return { ctx, fiber, entry, collapseHeader } + const progress = () => ctx.slots.entries('conversation.session.panel.section.actions') + .find(candidate => candidate.component === TeamProgress) + return { ctx, fiber, entry, progress, collapseHeader } } describe('task-board browser plugin', () => { - it('registers a disposable root task-board section without navigation or Team Remote services', async () => { + it('registers a disposable shared tasks section with its progress, without navigation or Team Remote services', async () => { const b = await bench() expect(inject).toEqual(['slots', 'locale']) expect(b.entry()).toMatchObject({ - options: { id: 'agent-team' }, + options: { id: 'shared-tasks', order: 250 }, locale: 'agent-team', }) expect(b.entry()!.inject).toBeUndefined() + expect(resolveSlotLabel(b.entry()!.options.label)).toBe('Shared tasks') + expect(b.progress()).toMatchObject({ options: { key: 'shared-tasks' }, locale: 'agent-team' }) expect(b.ctx.slots.entries('conversation.session.header.actions')).toHaveLength(0) const t = b.ctx.locale.bind('agent-team') - expect(t('trigger')).toBe('Task board') + expect(t('tasks')).toBe('Shared tasks') await b.fiber.dispose() expect(b.entry()).toBeUndefined() + expect(b.progress()).toBeUndefined() expect(t('empty')).toBe('empty') }) - it('re-registers when the conversation header slot is declared again', async () => { + it('re-registers when the section slot is declared again', async () => { const b = await bench() expect(b.entry()).toBeDefined() b.collapseHeader() expect(b.entry()).toBeUndefined() b.ctx.slots.register({ name: 'root', - children: { 'conversation.session.panel.subagents.footer': { kind: 'list', scope: 'session' } }, + children: { + 'conversation.session.panel.section': { kind: 'list', scope: 'session' }, + 'conversation.session.panel.section.actions': { kind: 'keyed', scope: 'session' }, + }, } as never, () => null) await Promise.resolve() expect(b.entry()).toBeDefined() diff --git a/packages/client/ui-agent-team/tests/team-board.client.spec.tsx b/packages/client/ui-agent-team/tests/team-board.client.spec.tsx index f60eb99e4a..112a404d0b 100644 --- a/packages/client/ui-agent-team/tests/team-board.client.spec.tsx +++ b/packages/client/ui-agent-team/tests/team-board.client.spec.tsx @@ -8,7 +8,7 @@ import type { SessionListState, SessionSummary } from '@deepseek-ai/dsh-api-sess import { createSnapshotStore } from '@deepseek-ai/dsh-client-store' import { bindSnapshotSelector, makeTranslate } from '@deepseek-ai/dsh-client-test-runtime' import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts' -import { TeamBoard, type TeamBoardProps } from '../src/client/TeamBoard.tsx' +import { TeamBoard, TeamProgress, type TeamBoardProps, type TeamProgressProps } from '../src/client/TeamBoard.tsx' import { en, zh } from '../src/client/locales.ts' afterEach(() => { @@ -108,14 +108,19 @@ function enableTooltips(): void { vi.stubGlobal('matchMedia', vi.fn(() => ({ matches: true }))) } +/** The text the progress beside the section title renders for these props. */ +function progressText(props: TeamBoardProps): string { + const view = render() + const text = view.container.textContent + view.unmount() + return text +} + describe('TeamBoard', () => { - it('shows a nonclickable Checklist header and compact initially closed rows', () => { + it('leaves the title to the panel and shows compact initially closed rows', () => { const b = bench() render() - const heading = screen.getByRole('heading') - expect(heading.textContent).toBe(`${zh.tasks}${b.props.t('progress.active', { count: 1 })}`) - expect(heading.querySelector('button')).toBeNull() - expect(heading.querySelector('[data-icon="dsw-icon-checklist-outline-regular"]')).toBeTruthy() + expect(screen.queryByRole('heading')).toBeNull() expect(screen.getAllByRole('button')).toEqual([row()]) expect(row().getAttribute('aria-expanded')).toBe('false') expect(row().textContent).toBe(task.subject) @@ -172,9 +177,9 @@ describe('TeamBoard', () => { ] } }) render() expect(screen.getAllByRole('button').map(button => button.textContent)).toEqual(['Pending first', 'Completed second', 'Active third']) - expect(screen.getByRole('heading').textContent).toBe(`${zh.tasks}${[ + expect(progressText(b.props)).toBe([ b.props.t('progress.completed', { count: 1 }), b.props.t('progress.active', { count: 1 }), b.props.t('progress.pending', { count: 1 }), - ].join('\u2002·\u2002')}`) + ].join('\u2002·\u2002')) expect(screen.queryByText('Deleted task')).toBeNull() expect(row('Pending first').querySelector('[data-state="idle"]')).toBeTruthy() expect(row('Completed second').querySelector('[data-state="done"]')).toBeTruthy() @@ -244,6 +249,7 @@ describe('TeamBoard', () => { const b = bench() render() setProjection(b.sessions, SESSION, { ...team, enabled: false }) + expect(progressText(b.props)).toBe('') expect(screen.queryByRole('region')).toBeNull() expect(screen.queryByText(task.subject)).toBeNull() setProjection(b.sessions, SESSION, team) @@ -283,7 +289,6 @@ describe('TeamBoard', () => { const view = render() expect(screen.getByRole('alert').textContent).toBe('任务记录无效:revision is not contiguous') expect(row()).toBeTruthy() - expect(screen.getByRole('heading')).toBeTruthy() for (const tasks of [[], [{ ...task, status: 'deleted' as const }]]) { setProjectionSnapshot(b.sessions, SESSION, { state: 'ready', error: null, values: { agentTeam: { enabled: true, tasks, failure: 'invalid task' }, @@ -293,11 +298,8 @@ describe('TeamBoard', () => { expect(alert.textContent).toBe('任务记录无效:invalid task') expect(screen.getAllByRole('alert')).toHaveLength(1) expect(view.container.textContent).toBe(alert.textContent) - expect(view.container.querySelector('[data-with-members="true"]')).toBeNull() - expect(screen.queryByRole('heading')).toBeNull() - expect(screen.queryByRole('region')).toBeNull() expect(screen.queryByText(zh.empty)).toBeNull() - expect(document.querySelector('[data-team-panel]')).toBeNull() + expect(progressText(b.props)).toBe('') } setProjection(b.sessions, SESSION, { enabled: false, tasks: [], failure: 'invalid task' }) expect(view.container.childElementCount).toBe(0) @@ -334,7 +336,7 @@ describe('TeamBoard', () => { it('uses translated English progress and details without Show more or Show less controls', () => { const b = bench() render() - expect(screen.getByRole('heading').textContent).toBe(`${en.tasks}${makeTranslate(en)('progress.active', { count: 1 })}`) + expect(progressText({ ...b.props, t: makeTranslate(en) })).toBe(makeTranslate(en)('progress.active', { count: 1 })) fireEvent.click(row()) expect(ownerValue()).toBe('lead') expect(document.querySelector('[data-team-task-owner]')?.textContent).toBe(`${en.owner}: lead`) diff --git a/packages/client/ui-agent-team/tsconfig.json b/packages/client/ui-agent-team/tsconfig.json index 429b9adac3..b5d6224ca9 100644 --- a/packages/client/ui-agent-team/tsconfig.json +++ b/packages/client/ui-agent-team/tsconfig.json @@ -13,7 +13,7 @@ { "path": "../ui-model-selection" }, { "path": "../ui-layout" }, { "path": "../../core/agent" }, - { "path": "../ui-subagent" }, + { "path": "../ui-session-panel" }, { "path": "../locale/tsconfig.client.json" }, { "path": "../store" }, { "path": "../ui-conversation/tsconfig.client.json" }, diff --git a/packages/client/ui-session-panel/README.i18n.yaml b/packages/client/ui-session-panel/README.i18n.yaml index 682b49360a..3317ae1577 100644 --- a/packages/client/ui-session-panel/README.i18n.yaml +++ b/packages/client/ui-session-panel/README.i18n.yaml @@ -21,8 +21,8 @@ en: 4c263b3fe6afc10a zh: c5844b6c0a269a31 /deepseek-ai-dsh-client-ui-session-panel/use-this-package/contribute-a-section: - en: 14a7636d69aeca03 - zh: e5d920fa00ade157 + en: d8b9dbb9465a65c7 + zh: 9adbc0c190d1852d /deepseek-ai-dsh-client-ui-session-panel/understand-the-implementation: en: f996b40c78ce18ba zh: d66ed6289f8eed50 diff --git a/packages/client/ui-session-panel/README.md b/packages/client/ui-session-panel/README.md index e0c6a74a77..1fbb7c6401 100644 --- a/packages/client/ui-session-panel/README.md +++ b/packages/client/ui-session-panel/README.md @@ -38,7 +38,7 @@ Other Views, such as the trajectory View, show no panel. While no Chat View show ### Contribute a section -A section is one `conversation.session.panel.section` list registration: `id` addresses it, `order` sorts it ascending, and the required `label` is its title, which the panel draws in the active locale. The section component receives `presentation` (`docked` or `overlay`) and `dismissOverlay()` as owner props; it renders its body and renders nothing when it has nothing to show, which hides its title too. Register trailing title controls, such as a count or a refresh button, in the keyed `conversation.session.panel.section.actions` slot under the section's `id`. A section without a label is reported to the console and not shown. The shipped sections are Environment (`order: 0`), Change requests from the [forge bundle](../../experimental/client-ui-forge/README.md) (`100`), [Subagents](../ui-subagent/README.md) (`200`), and [Background jobs](../ui-jobs/README.md) (`300`). +A section is one `conversation.session.panel.section` list registration: `id` addresses it, `order` sorts it ascending, and the required `label` is its title, which the panel draws in the active locale. The section component receives `presentation` (`docked` or `overlay`) and `dismissOverlay()` as owner props; it renders its body and renders nothing when it has nothing to show, which hides its title too. Register trailing title controls, such as a count or a refresh button, in the keyed `conversation.session.panel.section.actions` slot under the section's `id`. A section without a label is reported to the console and not shown. The shipped sections are Environment (`order: 0`), Change requests from the [forge bundle](../../experimental/client-ui-forge/README.md) (`100`), [Subagents](../ui-subagent/README.md) (`200`), [Shared tasks](../ui-agent-team/README.md) (`250`), and [Background jobs](../ui-jobs/README.md) (`300`). Plugins share a title by registering rows in a section owner's row slot. The built-in Environment section (`id: 'environment'`, `order: 0`) declares `conversation.session.panel.environment.row`, whose rows receive the same owner props as a section; its `project` row (`order: 0`) shows the Session's working folder: the current directory from the `workingDirectory` projection, or, before the projection arrives or when it records none, the directory the Session was created in, then the directory of the Workspace that lists the Session. The row shows the folder name followed by its parent folder in tertiary ink, which clips with an ellipsis; its tooltip names the working folder and gives the full path. Both abbreviate the Host home to `~`. Right-clicking the row or pressing its More button opens the shared `directory` context menu. The forge bundle adds its checkout and local changes rows at orders 20 and 30. A plugin that owns a shared section declares its own row slot the same way. diff --git a/packages/client/ui-session-panel/README.zh.md b/packages/client/ui-session-panel/README.zh.md index 7cf960b0c5..f6e0520272 100644 --- a/packages/client/ui-session-panel/README.zh.md +++ b/packages/client/ui-session-panel/README.zh.md @@ -38,7 +38,7 @@ kind: "package-reference" ### 贡献分栏 -一个分栏是 `conversation.session.panel.section` 列表里的一次注册:`id` 用于寻址,`order` 升序排列,必填的 `label` 是标题,面板按当前语言绘制。分栏组件通过 owner props 收到 `presentation`(`docked` 或 `overlay`)和 `dismissOverlay()`;它负责渲染正文,没有内容时什么都不渲染,标题随之隐藏。标题尾部的控件(例如计数或刷新按钮)注册到以分栏 `id` 为键的 keyed slot `conversation.session.panel.section.actions`。缺少 label 的分栏会报告到控制台,并且不显示。内置的分栏依次是「环境」(`order: 0`)、[forge 套件](../../experimental/client-ui-forge/README.zh.md)的「变更请求」(`100`)、[「子智能体」](../ui-subagent/README.zh.md)(`200`)和[「后台任务」](../ui-jobs/README.zh.md)(`300`)。 +一个分栏是 `conversation.session.panel.section` 列表里的一次注册:`id` 用于寻址,`order` 升序排列,必填的 `label` 是标题,面板按当前语言绘制。分栏组件通过 owner props 收到 `presentation`(`docked` 或 `overlay`)和 `dismissOverlay()`;它负责渲染正文,没有内容时什么都不渲染,标题随之隐藏。标题尾部的控件(例如计数或刷新按钮)注册到以分栏 `id` 为键的 keyed slot `conversation.session.panel.section.actions`。缺少 label 的分栏会报告到控制台,并且不显示。内置的分栏依次是「环境」(`order: 0`)、[forge 套件](../../experimental/client-ui-forge/README.zh.md)的「变更请求」(`100`)、[「子智能体」](../ui-subagent/README.zh.md)(`200`)、[「共享任务」](../ui-agent-team/README.zh.md)(`250`)和[「后台任务」](../ui-jobs/README.zh.md)(`300`)。 多个插件共用一个标题时,把行注册到分栏拥有者的行 slot 中。内置「环境」分栏(`id: 'environment'`,`order: 0`)声明 `conversation.session.panel.environment.row`,其中的行与分栏收到相同的 owner props;其 `project` 行(`order: 0`)显示会话的工作目录:`workingDirectory` 投影记录的当前目录;投影尚未送达或没有记录时,依次取会话创建时所在的目录、列出本会话的工作区目录。该行先显示目录名,再以三级文字色显示父目录,放不下时以省略号截断;悬停提示写明工作目录并给出完整路径。两处都把宿主家目录缩写为 `~`。右键该行或点其「更多」按钮会打开共享的 `directory` 上下文菜单。forge 套件在 order 20 与 30 处添加检出行与本地变更行。拥有共享分栏的插件用同样方式声明自己的行 slot。 diff --git a/packages/client/ui-subagent/README.i18n.yaml b/packages/client/ui-subagent/README.i18n.yaml index 3f10b5b14e..dbecbd9848 100644 --- a/packages/client/ui-subagent/README.i18n.yaml +++ b/packages/client/ui-subagent/README.i18n.yaml @@ -15,11 +15,11 @@ en: d152484eb41ac6b4 zh: 09388d293f9be9cb /deepseek-ai-dsh-client-ui-subagent/use-this-package: - en: 23c3b7926b784539 - zh: 80ace7b0e8a3c386 + en: e968b21e49a247ee + zh: e61e080c89246272 /deepseek-ai-dsh-client-ui-subagent/use-this-package/browsing-the-tree: - en: 51a6de80b9c0ed57 - zh: c27b19edf4dd0801 + en: c4f947ba61688c68 + zh: c7dcc9896f5e2746 /deepseek-ai-dsh-client-ui-subagent/use-this-package/continuing-a-conversation: en: e4ec261d3b122eb5 zh: 320bb2efc93dccdc @@ -30,8 +30,8 @@ en: c158f12dcaed87b7 zh: e5d315e7b1fb4fa9 /deepseek-ai-dsh-client-ui-subagent/understand-the-implementation/catalog-derivation: - en: 39be5aa2fc67d7cb - zh: c4f4d9b671463fff + en: e67da33e71e8db21 + zh: 8316c70dfaaf30d9 /deepseek-ai-dsh-client-ui-subagent/understand-the-implementation/duration-completion-and-tokens: en: 88ac879a43f1a8d7 zh: f62c7b02e3658507 diff --git a/packages/client/ui-subagent/README.md b/packages/client/ui-subagent/README.md index 7f66b20121..3bcffda41a 100644 --- a/packages/client/ui-subagent/README.md +++ b/packages/client/ui-subagent/README.md @@ -29,9 +29,9 @@ The session header uses the session title for ordinary breadcrumbs. Subagent bre This package registers the `dsh-resource://subagentchat/session/?parent=&mode=` resource and builtin Sidebar tab type. The resource retains the child `SessionReference` directly from its address without refreshing the parent catalog, and releases the reference when the tab record closes. The tab renders the shared `conversation.content` Factory through `sidebar.chat.conversation`, fixes the local View to Chat, and omits the main Conversation header and width controls. -The section's title control (`conversation.session.panel.section.actions`, key `subagents`) shows direct-member progress: completed, in progress, not running, and external counts in that order, with zero counts omitted and the separator matching the input task list. External tasks never count as running or completed. When the catalog loaded empty, a section shown for shared tasks or a task-record error shows “No subagents” above them; before the Session list holds the catalog, it shows “Loading subagents…”. The Session panel scrolls the section; the tree has no nested scrolling. The breadcrumb switcher menu is 360px wide with 6px outer padding, constrained to fit the layout viewport, and only the menu scrolls. In WebKit-compatible browsers, its native 5px scrollbar sits in the right 6px inset with inset track ends and a stable gutter, preserving content width when scrolling becomes necessary. Other browsers retain their standard native scrollbar. +The section's title control (`conversation.session.panel.section.actions`, key `subagents`) shows direct-member progress: completed, in progress, not running, and external counts in that order, with zero counts omitted and the separator matching the input task list. External tasks never count as running or completed. The section hides with its title while the Session has no subagents and no failed catalog read. The Session panel scrolls the section; the tree has no nested scrolling. The breadcrumb switcher menu is 360px wide with 6px outer padding, constrained to fit the layout viewport, and only the menu scrolls. In WebKit-compatible browsers, its native 5px scrollbar sits in the right 6px inset with inset track ends and a stable gutter, preserving content width when scrolling becomes necessary. Other browsers retain their standard native scrollbar. -The Subagents section exposes the `conversation.session.panel.subagents.footer` list slot below its tree for shared tasks and renders it only while the slot has a registration. Breadcrumb switcher menus show navigation only. +Breadcrumb switcher menus show navigation only. The switcher title is at most 244px wide, ellipsizes, and is followed by an up-down chevron icon. The current Session's title uses primary ink at weight 500; an ancestor's title uses tertiary ink at regular weight. @@ -39,7 +39,7 @@ The switcher title is at most 244px wide, ellipsizes, and is followed by an up-d The sidebar-action tooltip appears after 500ms of hover. Hovering a switcher with a non-touch pointer opens its menu after 150ms; leaving both the switcher and its menu closes it after 120ms. Clicking the current Session's title opens and pins the menu and moves focus into it, and a pinned menu ignores pointer leave; clicking an ancestor's title navigates to that ancestor instead. ArrowDown on a switcher opens its menu and focuses the first row. An outside press or Escape closes the menu, and Escape returns focus to the switcher when focus was inside the menu. -Rows show the creation description, or an available Session title, above the agent name, which is unique among its siblings. Entries recorded without a name show the Session id in its place. Without either description, the row shows only the name or Session id. Navigation, row identity, and Sidebar addresses always use the Session id. Local rows use compact 4px vertical padding; their clickable content uses 6px horizontal padding and 7px gaps, aligned with shared-task rows while retaining the tree's left offset. A decorative trailing check marks the current conversation and is not an action; other local rows retain the sidebar arrow. Primary titles use 13px text and secondary names use 12px. All rows wrap descriptions and names in full, including on touch screens. Running uses the shared ongoing loader, an inactive child whose latest closed turn completed normally uses the shared success dot, and other inactive children use the shared idle dot. Every row reserves the same 14px status column, centering smaller dots so titles align with the loader state. The trailing column stacks total durable provider usage above active-turn duration. In the tree, Enter or Space opens the focused row, ArrowRight/ArrowLeft expand and collapse branches, and ArrowUp/ArrowDown, Home, and End move between rows. An unlabeled one-shot row falls back to its session id. A row is a known leaf only after its own catalog loads empty. +Rows show the creation description, or an available Session title, above the agent name, which is unique among its siblings. Entries recorded without a name show the Session id in its place. Without either description, the row shows only the name or Session id. Navigation, row identity, and Sidebar addresses always use the Session id. Local rows use compact 4px vertical padding. In the Session panel they follow the panel's columns: the status glyph's center 14px from the row start, titles at 30px, and the sidebar arrow's center 14px from the row end, whose glyph darkens on hover without a fill. In switcher menus, their clickable content uses 6px horizontal padding and 7px gaps while retaining the tree's left offset. A decorative trailing check marks the current conversation and is not an action; other local rows retain the sidebar arrow. Primary titles use 13px text and secondary names use 12px. All rows wrap descriptions and names in full, including on touch screens. Running uses the shared ongoing loader, an inactive child whose latest closed turn completed normally uses the shared success dot, and other inactive children use the shared idle dot. Every row reserves the same status column, 16px in the panel and 14px in switcher menus, centering smaller dots so titles align with the loader state. The trailing column stacks total durable provider usage above active-turn duration. In the tree, Enter or Space opens the focused row, ArrowRight/ArrowLeft expand and collapse branches, and ArrowUp/ArrowDown, Home, and End move between rows. An unlabeled one-shot row falls back to its session id. A row is a known leaf only after its own catalog loads empty. ### Continuing a conversation @@ -63,7 +63,7 @@ The [subagent runtime](../../subagent/subagent/README.md) owns continuation and The Subagents section, its progress control, and the breadcrumb switcher read `projectionsBySession` through the standard `useSessions` hook and select `subagentCatalog` from each Session’s shared values for membership, disclosure, and counts. Activity prefers the unified UI status and falls back to Session summaries; summaries supply titles and usage. Expanding a row reads its target's projections, including ordinary cold history. A list row with `formatStatus: migration-required` displays “Migration required” before expansion and keeps its history-opening actions without descendant expansion or changing its subagent mode; a projection read requiring migration without a catalog supplies the same notice. Opening the Session supplies its catalog through history and control projections. Otherwise, an available catalog remains usable, including an explicit empty catalog. Live projection frames update every loaded level without per-tree subscriptions or repeated membership queries. Other rows remain expandable while their catalogs are absent, loading, or failed, and become known leaves after ready empty catalogs. External rows are always leaves and do not load child Sessions. -The section registration declares the footer slot below its tree. Optional UI contributes there and scrolls with the Session panel, which owns showing and dismissing the section. The switcher menu is a body-mounted `MenuSurface`; CSS anchors keep it attached to its title within layout-viewport size limits. Browser zoom and panning move it with the page, so it may extend beyond the visual viewport. Internal scrolling, hover behavior, pinned opening, and focus restoration remain independent. +The Session panel owns showing, scrolling, and dismissing the section. The switcher menu is a body-mounted `MenuSurface`; CSS anchors keep it attached to its title within layout-viewport size limits. Browser zoom and panning move it with the page, so it may extend beyond the visual viewport. Internal scrolling, hover behavior, pinned opening, and focus restoration remain independent. Showing the section or opening a switcher menu does not request the root catalog. Child-catalog expansion and failed-read retries call `refreshProjection`; shared projection-value changes update the display automatically. diff --git a/packages/client/ui-subagent/README.zh.md b/packages/client/ui-subagent/README.zh.md index fe08322261..87925b7da6 100644 --- a/packages/client/ui-subagent/README.zh.md +++ b/packages/client/ui-subagent/README.zh.md @@ -29,9 +29,9 @@ kind: "package-reference" 本包注册 `dsh-resource://subagentchat/session/?parent=&mode=` 资源与 builtin Sidebar tab 类型。资源直接根据地址保留 child 的 `SessionReference`,不刷新 parent 目录,并在 tab 记录关闭时释放 reference。tab 通过 `sidebar.chat.conversation` 渲染共享 `conversation.content` Factory,把局部 View 固定为 Chat,并省略主 Conversation 的 Header 与宽度控制。 -分栏的标题控件(`conversation.session.panel.section.actions`,键为 `subagents`)显示直接成员进度:依次为已完成、进行中、未运行和外部任务数量;省略零值,分隔符与输入区任务列表一致。外部任务不计入运行中或已完成数量。目录加载为空、分栏因共享任务或任务记录错误而显示时,在其上方显示“暂无子智能体”;Session 列表尚未持有目录时,显示“正在加载子智能体…”。会话面板负责分栏滚动,目录树不单独滚动。面包屑切换器菜单宽度为 360px,外层内边距为 6px,并受布局视口可用宽度约束,仅菜单本身滚动。在兼容 WebKit 的浏览器中,其原生 5px 滚动条位于右侧 6px 内边距内,轨道两端内缩,并保留稳定的滚动条空间,使内容在需要滚动时保持原有宽度。其他浏览器保留标准原生滚动条。 +分栏的标题控件(`conversation.session.panel.section.actions`,键为 `subagents`)显示直接成员进度:依次为已完成、进行中、未运行和外部任务数量;省略零值,分隔符与输入区任务列表一致。外部任务不计入运行中或已完成数量。会话没有子智能体且目录读取未失败时,分栏连同标题一起隐藏。会话面板负责分栏滚动,目录树不单独滚动。面包屑切换器菜单宽度为 360px,外层内边距为 6px,并受布局视口可用宽度约束,仅菜单本身滚动。在兼容 WebKit 的浏览器中,其原生 5px 滚动条位于右侧 6px 内边距内,轨道两端内缩,并保留稳定的滚动条空间,使内容在需要滚动时保持原有宽度。其他浏览器保留标准原生滚动条。 -「子智能体」分栏在目录树下方提供 `conversation.session.panel.subagents.footer` 列表插槽,用于共享任务,并且仅在该插槽有注册时渲染它。面包屑切换器菜单只显示导航。 +面包屑切换器菜单只显示导航。 切换器标题最宽 244px,超出时以省略号截断,后接上下双向箭头图标。当前 Session 的标题使用主前景色、字重 500;祖先标题使用三级前景色、常规字重。 @@ -39,7 +39,7 @@ kind: "package-reference" 侧边栏操作的工具提示在悬停 500ms 后显示。非触摸指针悬停切换器 150ms 后打开其菜单;指针离开切换器和菜单后,经过 120ms 关闭。点击当前 Session 的标题会打开并固定菜单,并将焦点移入菜单,已固定的菜单不因指针离开而关闭;点击祖先标题则导航至该祖先。在切换器上按 ArrowDown 会打开菜单,并将焦点移至首行。点击外部或按 Escape 可关闭菜单;焦点原本位于菜单内时,Escape 将焦点送回切换器。 -目录行在智能体名称上方显示创建描述,缺少创建描述时使用可用的 Session title;名称在同级子智能体中唯一。没有名称的历史目录项在相同位置显示 Session id。两者均缺少时,该行仅显示名称或 Session id。导航、行身份与 Sidebar 地址始终使用 Session id。本地行使用紧凑的 4px 垂直内边距;可点击内容使用 6px 水平内边距和 7px 间距,与共享任务行对齐,同时保留树的左侧偏移。当前对话在行尾显示装饰性对勾,该对勾不是操作控件;其他本地行保留侧边栏箭头。主标题使用 13px 文字,次级名称使用 12px。所有行均将描述与名称换行完整展示,包括在触屏上。running 使用共享 ongoing loading,最近一个已结束轮次正常完成的 inactive child 使用共享 success 绿点,其他 inactive child 使用共享 idle 灰点。每行都为状态图标预留相同的 14px 列宽,并将较小的圆点居中,使 title 与 loading 状态对齐。尾随列在上行显示提供方的持久化 token 用量总计,在下行显示活跃轮次耗时。在目录树中,Enter 或 Space 打开获得焦点的行,ArrowRight/ArrowLeft 展开和折叠分支,ArrowUp/ArrowDown、Home 与 End 在行间移动。没有 label 的 one-shot 行回退到其会话 id。只有一行自身的目录加载为空后,它才是已知叶子。 +目录行在智能体名称上方显示创建描述,缺少创建描述时使用可用的 Session title;名称在同级子智能体中唯一。没有名称的历史目录项在相同位置显示 Session id。两者均缺少时,该行仅显示名称或 Session id。导航、行身份与 Sidebar 地址始终使用 Session id。本地行使用紧凑的 4px 垂直内边距。在会话面板中,它们遵循面板的列:状态图标中心距行起始 14px,标题从 30px 开始,侧边栏箭头中心距行末端 14px,悬停时箭头变深、没有底色。在切换器菜单中,可点击内容使用 6px 水平内边距和 7px 间距,同时保留树的左侧偏移。当前对话在行尾显示装饰性对勾,该对勾不是操作控件;其他本地行保留侧边栏箭头。主标题使用 13px 文字,次级名称使用 12px。所有行均将描述与名称换行完整展示,包括在触屏上。running 使用共享 ongoing loading,最近一个已结束轮次正常完成的 inactive child 使用共享 success 绿点,其他 inactive child 使用共享 idle 灰点。每行都为状态图标预留相同的列宽(面板中 16px,切换器菜单中 14px),并将较小的圆点居中,使 title 与 loading 状态对齐。尾随列在上行显示提供方的持久化 token 用量总计,在下行显示活跃轮次耗时。在目录树中,Enter 或 Space 打开获得焦点的行,ArrowRight/ArrowLeft 展开和折叠分支,ArrowUp/ArrowDown、Home 与 End 在行间移动。没有 label 的 one-shot 行回退到其会话 id。只有一行自身的目录加载为空后,它才是已知叶子。 ### 续接对话 @@ -63,7 +63,7 @@ kind: "package-reference" 「子智能体」分栏、其进度控件与面包屑切换器通过标准 `useSessions` 钩子读取 `projectionsBySession`,并从每个 Session 的共享值中选择 `subagentCatalog`,用于成员关系、展开控件与数量。活动状态优先使用统一 UI status,缺少时使用 Session 摘要;摘要提供标题与用量。展开行读取目标投影,包括普通冷历史。列表行的 `formatStatus` 为 `migration-required` 时,行在展开前即显示“需要迁移”,保留打开历史的操作,但不能展开下级,也不改变子会话的 mode;投影读取需要迁移且缺少目录时,也显示同一提示。打开会话后,历史与 control 投影提供其目录。其他情况下,已有目录仍可使用,包括显式空目录。实时 projection 帧更新所有已加载层级,无需逐树订阅或重复成员查询。其他行在目录缺席、加载中或失败时保持可展开,并在目录就绪且为空后成为已知叶子。外部行始终为叶子,不加载子 Session。 -分栏注册在目录树下方声明 footer 插槽。可选 UI 通过该插槽加入,并随会话面板滚动;会话面板负责显示和关闭分栏。切换器菜单是挂载到 body 的 `MenuSurface`;CSS 锚点让菜单跟随其标题,并按布局视口限制尺寸。浏览器缩放和平移时菜单随页面移动,因此可以超出视觉视口。内部滚动、悬停行为、点击固定展开和焦点恢复保持独立。 +会话面板负责分栏的显示、滚动和关闭。切换器菜单是挂载到 body 的 `MenuSurface`;CSS 锚点让菜单跟随其标题,并按布局视口限制尺寸。浏览器缩放和平移时菜单随页面移动,因此可以超出视觉视口。内部滚动、悬停行为、点击固定展开和焦点恢复保持独立。 显示分栏或打开切换器菜单不会请求根目录。展开子节点目录或重试失败读取时调用 `refreshProjection`;共享投影值的变化会自动更新显示。 diff --git a/packages/client/ui-subagent/package.json b/packages/client/ui-subagent/package.json index 614e462dc8..eade033227 100644 --- a/packages/client/ui-subagent/package.json +++ b/packages/client/ui-subagent/package.json @@ -53,7 +53,6 @@ }, "devDependencies": { "@deepseek-ai/cordis": "workspace:~", - "@deepseek-ai/dsh-agent-team": "workspace:*", "@deepseek-ai/dsh-api-session-controller": "workspace:*", "@deepseek-ai/dsh-client-connection": "workspace:*", "@deepseek-ai/dsh-client-locale": "workspace:*", diff --git a/packages/client/ui-subagent/src/client/SubagentCatalog.module.css b/packages/client/ui-subagent/src/client/SubagentCatalog.module.css index b1713aff5b..af2083627d 100644 --- a/packages/client/ui-subagent/src/client/SubagentCatalog.module.css +++ b/packages/client/ui-subagent/src/client/SubagentCatalog.module.css @@ -120,35 +120,83 @@ } } -/* Progress beside the Session panel section title, one line. */ +/* Progress beside the Session panel section title, one line that clips before the title does. */ .sectionProgress { + min-width: 0; overflow: hidden; color: var(--dsw-alias-label-tertiary); font: var(--dsw-font-xxs-12); + font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; } -/* The Session panel section supplies the inset and scrolling. */ +/* The Session panel section supplies the inset and scrolling. Rows share the + panel's columns: the status glyph's center 14px from the row start, text at + 30px, and the chevron's center 14px from the row end. */ .sectionBody { display: flex; flex-direction: column; min-width: 0; } -.sectionEmpty { - margin: 0; - padding: 0 7px 8px 28px; - color: var(--dsw-alias-label-tertiary); - font-size: 12px; +.sectionBody .row { + gap: 8px; + padding: 4px 6px; +} + +.sectionBody .clickarea { + gap: 8px; + border-radius: var(--dsw-radius-sm); +} + +.sectionBody .rowActivitySlot { + width: 16px; + height: 18px; +} + +.sectionBody .label { + line-height: 18px; +} + +.sectionBody .metrics { + grid-template-rows: 18px 17px; +} + +.sectionBody .metricToken { + line-height: 18px; +} + +.sectionBody .metricDuration { + line-height: 17px; +} + +/* The chevron shares the row's highlight: its glyph darkens without a fill. */ +.sectionBody .sidebarButton, +.sectionBody .sidebarSpace { + align-self: center; + width: 24px; + height: 24px; + margin: 0 -4px; + padding: 0; + border-radius: var(--dsw-radius-xs); +} + +.sectionBody .sidebarButton:focus-visible { + background: transparent; +} + +@media (hover: hover) { + .sectionBody .sidebarButton:hover { + background: transparent; + } } .node { position: relative; min-width: 0; } -.menuBody > [role="tree"] > .node, -.sectionBody > [role="tree"] > .node { +.menuBody > [role="tree"] > .node { margin-left: -2px; } diff --git a/packages/client/ui-subagent/src/client/SubagentsSection.tsx b/packages/client/ui-subagent/src/client/SubagentsSection.tsx index 4c8eced002..a618b3def1 100644 --- a/packages/client/ui-subagent/src/client/SubagentsSection.tsx +++ b/packages/client/ui-subagent/src/client/SubagentsSection.tsx @@ -1,77 +1,67 @@ /** Session panel section listing the current Session's subagents. */ import { useMemo } from 'react' -import type { HostObservable, InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots' +import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots' import type { NS } from './locales.ts' import type {} from '@deepseek-ai/dsh-client-ui-session-panel/client' -import type {} from '@deepseek-ai/dsh-agent-team/client' -import { CatalogTree, deriveCatalogs, progressOf, type SubagentCatalogInjected, type SubagentCatalogSnapshot } from './SubagentCatalog.tsx' -import type {} from './slots.ts' +import { CatalogTree, deriveCatalogs, progressOf, type Catalogs, type SubagentCatalogInjected } from './SubagentCatalog.tsx' import css from './SubagentCatalog.module.css' -/** Catalog actions and availability of the section's optional footer. */ -export type SubagentsSectionInjected = SubagentCatalogInjected & { - hooks: { - /** Whether the footer currently has a registered contributor. */ - footerAvailable: HostObservable - } -} - /** Full props of the subagents section. */ export type SubagentsSectionProps = PropsRuntime<'conversation.session.panel.section'> - & Omit, 'SessionProvider'> - & InjectFace + & InjectFace & PropsLocale /** Full props of the section's progress title control. */ export type SubagentsProgressProps = PropsRuntime<'conversation.session.panel.section.actions'> & PropsLocale -const LOADING: SubagentCatalogSnapshot = { entries: [], state: 'loading', error: null } +function deriveSummaries(state: Parameters[0]>[0]) { + return state.byId +} /** - * Render the Session's subagent tree and, when a contributor registered one, - * the footer such as the shared task board. The section renders nothing while - * the Session has no subagents, no failed catalog read, and no board content. - * Opening a subagent closes the panel's overlay. - * @param props - Session hooks, panel owner values, catalog actions, footer renderer, and copy. + * Read every held Session's catalog from the standard Session hooks. + * @param props - Session list and status hooks. + * @returns catalogs keyed by parent Session, and the Session list rows. + */ +function useCatalogs({ useSessions, useSessionStatus }: Pick): { + readonly catalogs: Catalogs + readonly summaries: ReturnType +} { + const projections = useSessions(state => state.projectionsBySession) + const summaries = useSessions(deriveSummaries) + const statuses = useSessionStatus(value => value) + const catalogs = useMemo(() => deriveCatalogs(projections, summaries, statuses), [projections, summaries, statuses]) + return { catalogs, summaries } +} + +/** + * Render the Session's subagent tree. The section renders nothing while the + * Session has no subagents and no failed catalog read. Opening a subagent + * closes the panel's overlay. + * @param props - Session hooks, panel owner values, catalog actions, and copy. * @returns the section body, or null with nothing to show. */ export function SubagentsSection({ - sessionId, dismissOverlay, useSessions, useSessionStatus, useProjection, useFooterAvailable, - openChild, openChildAside, refreshProjection, renderSlot, t, + sessionId, dismissOverlay, useSessions, useSessionStatus, openChild, openChildAside, refreshProjection, t, }: SubagentsSectionProps) { - const projections = useSessions(state => state.projectionsBySession) - const summaries = useSessions(state => state.byId) - const statuses = useSessionStatus(value => value) - const catalogs = useMemo(() => deriveCatalogs(projections, summaries, statuses), [projections, summaries, statuses]) - const footerAvailable = useFooterAvailable(value => value) - const hasSharedTasks = useProjection('agentTeam', team => team?.enabled === true - && team.tasks.some(task => task.status !== 'deleted')) - const hasTaskFailure = useProjection('agentTeam', team => team?.enabled === true && team.failure !== undefined) - const boardContent = footerAvailable && (hasSharedTasks || hasTaskFailure) + const { catalogs, summaries } = useCatalogs({ useSessions, useSessionStatus }) const catalog = catalogs[sessionId] - const listed = catalog !== undefined && (catalog.state === 'error' || catalog.entries.length > 0) - if (!listed && !boardContent) return null - const presented = catalog ?? LOADING + if (catalog === undefined || (catalog.state !== 'error' && catalog.entries.length === 0)) return null return (
- {presented.state === 'ready' && presented.entries.length === 0 - ?

{t('section.empty')}

- : ( - - )} - {footerAvailable && renderSlot('conversation.session.panel.subagents.footer', {})} +
) } @@ -82,13 +72,9 @@ export function SubagentsSection({ * @returns the progress phrase, or null without subagents. */ export function SubagentsProgress({ sessionId, useSessions, useSessionStatus, t }: SubagentsProgressProps) { - const projections = useSessions(state => state.projectionsBySession) - const summaries = useSessions(state => state.byId) - const statuses = useSessionStatus(value => value) - const progress = useMemo(() => { - const catalog = deriveCatalogs(projections, summaries, statuses)[sessionId] - return catalog === undefined ? '' : progressOf(catalog, summaries, t) - }, [projections, summaries, statuses, sessionId, t]) + const { catalogs, summaries } = useCatalogs({ useSessions, useSessionStatus }) + const catalog = catalogs[sessionId] + const progress = catalog === undefined ? '' : progressOf(catalog, summaries, t) if (progress === '') return null return {progress} } diff --git a/packages/client/ui-subagent/src/client/index.ts b/packages/client/ui-subagent/src/client/index.ts index ccb2f7bf05..faf3793283 100644 --- a/packages/client/ui-subagent/src/client/index.ts +++ b/packages/client/ui-subagent/src/client/index.ts @@ -5,7 +5,7 @@ import type { SessionId } from '@deepseek-ai/dsh-session/types' import type { ComposerChainProps } from '@deepseek-ai/dsh-client-ui-conversation/client' import { SubagentHeaderLineage } from './SubagentHeaderLineage.tsx' import type { SubagentCatalogInjected } from './SubagentCatalog.tsx' -import { SubagentsProgress, SubagentsSection, type SubagentsSectionInjected } from './SubagentsSection.tsx' +import { SubagentsProgress, SubagentsSection } from './SubagentsSection.tsx' import { SubagentReadOnlyComposer, type SubagentReadOnlyMatch, } from './SubagentReadOnlyComposer.tsx' @@ -18,7 +18,6 @@ import type {} from '@deepseek-ai/dsh-client-ui-session-panel/client' import type {} from '@deepseek-ai/dsh-client-ui-sidebar-right/client' import type {} from '@deepseek-ai/dsh-client-ui-workspace/client' import { en, ja, es, fr, de, ru, pt, NS, zh, type SubagentKey } from './locales.ts' -export type * from './slots.ts' declare module '@deepseek-ai/dsh-client-ui-slots' { interface LocaleNamespaceMap { @@ -29,7 +28,7 @@ declare module '@deepseek-ai/dsh-client-ui-slots' { export type { SubagentCatalogInjected } from './SubagentCatalog.tsx' export type { SubagentHeaderLineageProps } from './SubagentHeaderLineage.tsx' -export type { SubagentsProgressProps, SubagentsSectionInjected, SubagentsSectionProps } from './SubagentsSection.tsx' +export type { SubagentsProgressProps, SubagentsSectionProps } from './SubagentsSection.tsx' export type { SubagentReadOnlyComposerProps, SubagentReadOnlyMatch, } from './SubagentReadOnlyComposer.tsx' @@ -71,10 +70,6 @@ export function apply(ctx: ClientContext): void { void ctx.sessions.refreshProjections(parentSessionId) }, }) - const footerAvailable = { - getSnapshot: () => ctx.slots.entries('conversation.session.panel.subagents.footer').length > 0, - subscribe: (listener: () => void) => ctx.slots.subscribe('conversation.session.panel.subagents.footer', listener), - } ctx.slots.inject( 'conversation.session.header.lineage', () => ctx.slots.register({ @@ -87,14 +82,11 @@ export function apply(ctx: ClientContext): void { yield ctx.slots.register({ name: 'conversation.session.panel.section', id: 'subagents', - // After change requests (100), before background jobs (300). + // After change requests (100), before shared tasks (250). order: 200, label: () => t('section.title'), locale: NS, - inject: (sessionId): SubagentsSectionInjected => ({ - ...catalogActions(sessionId), hooks: { footerAvailable }, - }), - children: { 'conversation.session.panel.subagents.footer': { kind: 'list', scope: 'session' } }, + inject: catalogActions, }, SubagentsSection) yield ctx.slots.register({ name: 'conversation.session.panel.section.actions', diff --git a/packages/client/ui-subagent/src/client/locales.ts b/packages/client/ui-subagent/src/client/locales.ts index 6e87f7eef9..5cf0dd0ff0 100644 --- a/packages/client/ui-subagent/src/client/locales.ts +++ b/packages/client/ui-subagent/src/client/locales.ts @@ -6,7 +6,6 @@ export const NS = 'subagent' /** Simplified Chinese dictionary (the key-set source of truth). */ export const zh = { 'section.title': '子智能体', - 'section.empty': '暂无子智能体', 'progress.completed': '{count} 已完成', 'progress.active': '{count} 进行中', 'progress.inactive': '{count} 未运行', @@ -53,7 +52,6 @@ export const zh = { /** English dictionary, key-identical to the Chinese source of truth. */ export const en: Record = { 'section.title': 'Subagents', - 'section.empty': 'No subagents', 'progress.completed': '{count} completed', 'progress.active': '{count} in progress', 'progress.inactive': '{count} not running', @@ -103,7 +101,6 @@ export type SubagentKey = keyof typeof zh /** Japanese copy, checked against the English keys. */ export const ja = { 'section.title': 'サブエージェント', - 'section.empty': 'サブエージェントはありません', 'progress.completed': '{count}件完了', 'progress.active': '{count}件進行中', 'progress.inactive': '{count}件停止中', @@ -150,7 +147,6 @@ export const ja = { /** Spanish dictionary, checked against the English keys. */ export const es = { 'section.title': 'Subagentes', - 'section.empty': 'No hay subagentes', 'progress.completed': '{count} completado', 'progress.active': '{count} en progreso', 'progress.inactive': '{count} sin ejecutar', @@ -197,7 +193,6 @@ export const es = { /** French dictionary, checked against the English keys. */ export const fr = { 'section.title': 'Sous-agents', - 'section.empty': 'Aucun sous-agent', 'progress.completed': '{count} terminé', 'progress.active': '{count} en cours', 'progress.inactive': '{count} à l’arrêt', @@ -244,7 +239,6 @@ export const fr = { /** German dictionary, checked against the English keys. */ export const de = { 'section.title': 'Subagenten', - 'section.empty': 'Keine Subagenten', 'progress.completed': '{count} abgeschlossen', 'progress.active': '{count} in Bearbeitung', 'progress.inactive': '{count} nicht aktiv', @@ -291,7 +285,6 @@ export const de = { /** Russian dictionary, checked against the English keys. */ export const ru = { 'section.title': 'Субагенты', - 'section.empty': 'Нет субагентов', 'progress.completed': '{count} завершено', 'progress.active': '{count} в процессе', 'progress.inactive': '{count} не выполняются', @@ -338,7 +331,6 @@ export const ru = { /** Portuguese dictionary, checked against the English keys. */ export const pt = { 'section.title': 'Subagentes', - 'section.empty': 'Nenhum subagente', 'progress.completed': '{count} concluído', 'progress.active': '{count} em andamento', 'progress.inactive': '{count} sem execução', diff --git a/packages/client/ui-subagent/src/client/slots.ts b/packages/client/ui-subagent/src/client/slots.ts deleted file mode 100644 index 2233130f87..0000000000 --- a/packages/client/ui-subagent/src/client/slots.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** Extension position below the Session panel's subagent tree. */ -import type {} from '@deepseek-ai/dsh-client-ui-session-panel/client' - -declare module '@deepseek-ai/dsh-client-ui-slots' { - interface SlotMap { - /** Content below the Session's subagent tree in the Session panel, such as the shared task board. */ - 'conversation.session.panel.subagents.footer': { - kind: 'list' - scope: 'session' - } - } -} - -export {} diff --git a/packages/client/ui-subagent/tests/browser-plugin.client.spec.ts b/packages/client/ui-subagent/tests/browser-plugin.client.spec.ts index a0dd3c56cd..cfd4255282 100644 --- a/packages/client/ui-subagent/tests/browser-plugin.client.spec.ts +++ b/packages/client/ui-subagent/tests/browser-plugin.client.spec.ts @@ -13,7 +13,6 @@ import type { ComposerChainProps } from '@deepseek-ai/dsh-client-ui-conversation import { apply as applyLocale, inject as localeInject } from '@deepseek-ai/dsh-client-locale/client' import { SubagentHeaderLineage } from '../src/client/SubagentHeaderLineage.tsx' import type { SubagentCatalogInjected } from '../src/client/SubagentCatalog.tsx' -import type { SubagentsSectionInjected } from '../src/client/SubagentsSection.tsx' import { resolveSlotLabel } from '@deepseek-ai/dsh-client-ui-slots' import { en } from '../src/client/locales.ts' import { @@ -114,14 +113,13 @@ describe('apply', () => { it('keeps the root catalog extension available when optional Sidebar services arrive', async () => { const { ctx } = await fullBench(FAMILY) onTestFinished(() => ctx.fiber.dispose()) - ctx.slots.register({ name: 'conversation.session.panel.subagents.footer', id: 'test-content' }, () => null) const registerResource = vi.fn(() => () => {}) const registerTab = vi.fn(() => () => {}) ctx.provide('resources', { register: registerResource } as never) ctx.provide('sidebarRightTabs', { register: registerTab } as never) await vi.waitFor(() => { expect(registerResource).toHaveBeenCalledOnce() }) expect(registerTab).toHaveBeenCalledOnce() - expect(ctx.slots.entries('conversation.session.panel.subagents.footer')).toHaveLength(1) + expect(ctx.slots.entries('conversation.session.panel.section').map(entry => entry.options.id)).toEqual(['subagents']) }) it('registers catalog actions and selects read-only subagent composers from session facts', async () => { @@ -157,20 +155,8 @@ describe('apply', () => { expect(sectionEntry.options.order).toBe(200) expect(resolveSlotLabel(sectionEntry.options.label)).toBe(en['section.title']) expect(ctx.slots.entries('conversation.session.panel.section.actions').map(entry => entry.options.key)).toEqual(['subagents']) - const sectionProps = (sectionEntry.inject as (id: SessionId) => SubagentsSectionInjected)(sid('parent')) - const source = sectionProps.hooks.footerAvailable - const changed = vi.fn() - const unsubscribe = source.subscribe(changed) - expect(source.getSnapshot()).toBe(false) - const remove = ctx.slots.register({ - name: 'conversation.session.panel.subagents.footer', id: 'test-footer', - }, () => null) - expect(source.getSnapshot()).toBe(true) - await vi.waitFor(() => { expect(changed).toHaveBeenCalledOnce() }) - remove() - expect(source.getSnapshot()).toBe(false) - await vi.waitFor(() => { expect(changed).toHaveBeenCalledTimes(2) }) - unsubscribe() + const sectionActions = (sectionEntry.inject as (id: SessionId) => SubagentCatalogInjected)(sid('parent')) + expect(Object.keys(sectionActions).sort()).toEqual(['openChild', 'openChildAside', 'refreshProjection']) const composerEntry = ctx.slots.entries('conversation.composer') .find(entry => entry.component === SubagentReadOnlyComposer)! diff --git a/packages/client/ui-subagent/tests/conversation-ui.client.spec.tsx b/packages/client/ui-subagent/tests/conversation-ui.client.spec.tsx index 044226ce46..78a0600daa 100644 --- a/packages/client/ui-subagent/tests/conversation-ui.client.spec.tsx +++ b/packages/client/ui-subagent/tests/conversation-ui.client.spec.tsx @@ -7,7 +7,6 @@ import type { SessionListState, SessionSummary, SessionSnapshot, } from '@deepseek-ai/dsh-api-session-controller/client' import type { SubagentAddress, SubagentCatalogEntry } from '@deepseek-ai/dsh-subagent/client' -import type { TeamProjection, TeamTaskId, TeamTaskView } from '@deepseek-ai/dsh-agent-team/client' import type { SessionId } from '@deepseek-ai/dsh-session/types' import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client' import { SubagentHeaderLineage, type SubagentHeaderLineageProps } from '../src/client/SubagentHeaderLineage.tsx' @@ -36,18 +35,11 @@ type CatalogFixtureEntry = Entry extends SubagentC : never type CatalogFixture = { - team?: TeamProjection entries: readonly CatalogFixtureEntry[] state: SessionListState['projectionsBySession'][SessionId]['state'] error: SessionListState['projectionsBySession'][SessionId]['error'] } -const sharedTask: TeamTaskView = { - id: 'shared-task' as TeamTaskId, revision: 1, subject: 'Plan shared work', description: 'Prepare the implementation', - status: 'pending', blockedBy: [], writeScopes: [], ready: true, writeScopeWarnings: [], -} -const sharedTeam: TeamProjection = { enabled: true, tasks: [sharedTask] } - function catalog(over: Partial = {}): CatalogFixture { return { entries: [ @@ -94,7 +86,6 @@ function props( projectionsBySession: Object.fromEntries(Object.entries(catalogs).map(([id, catalog]) => [id, { state: catalog.state, error: catalog.error, values: { - ...catalog.team === undefined ? {} : { agentTeam: catalog.team }, subagentCatalog: catalog.entries.map(({ activity: _activity, ...entry }) => ({ ...entry, createdAt: 1 })), }, }])) , @@ -135,7 +126,6 @@ function props( ...standard, sessionId: PARENT, useSessions, - useFooterAvailable: (select: (available: boolean) => T): T => select(true), useSessionStatus: (select: (snapshot: SessionStatusSnapshot) => T): T => select(statuses), useSession: (select: (snapshot: SessionSnapshot) => T): T => select(snapshot), openChild: vi.fn(), @@ -189,8 +179,6 @@ function enableTooltips(): void { function HeaderCatalog(props: HeaderCatalogProps) { const sectionProps: SubagentsSectionProps = { ...props, sessionId: props.lineageSessionId, presentation: 'docked', dismissOverlay: props.dismissOverlay ?? vi.fn(), - useProjection: ((_key: 'agentTeam', selector: (value: TeamProjection | undefined) => boolean) => - props.useSessions(state => selector(state.projectionsBySession[props.lineageSessionId]?.values.agentTeam))) as SubagentsSectionProps['useProjection'], } return ( <> @@ -202,23 +190,12 @@ function HeaderCatalog(props: HeaderCatalogProps) { describe('SubagentHeaderLineage', () => { - it.each([ - { name: 'absent Team projection', team: undefined, footer: true }, - { name: 'disabled Team mode', team: { ...sharedTeam, enabled: false }, footer: true }, - { name: 'empty tasks', team: { enabled: true, tasks: [] }, footer: true }, - { name: 'deleted-only tasks', team: { enabled: true, tasks: [{ ...sharedTask, status: 'deleted' }] }, footer: true }, - { name: 'failure without tasks', team: { enabled: true, tasks: [], failure: 'Invalid task record' }, footer: true }, - { name: 'unavailable task footer', team: sharedTeam, footer: false }, - ] satisfies { name: string; team: TeamProjection | undefined; footer: boolean }[])( - 'omits section headings from a members-only catalog with $name', ({ team, footer }) => { - const input = props(catalog({ ...team === undefined ? {} : { team } })) - render( select(footer)} />) - expect(screen.getByRole('tree')).toBeTruthy() - expect(screen.queryByRole('heading')).toBeNull() - expect(document.querySelector('[data-subagent-section-header]')).toBeNull() - expect(screen.queryByText(zh['section.empty'])).toBeNull() - }, - ) + it('omits section headings from a catalog of members', () => { + render() + expect(screen.getByRole('tree')).toBeTruthy() + expect(screen.queryByRole('heading')).toBeNull() + expect(document.querySelector('[data-subagent-section-header]')).toBeNull() + }) it.each([undefined, ''])('keeps a single ID line when the creation description is %s', (label) => { const input = props(catalog({ @@ -252,15 +229,9 @@ describe('SubagentHeaderLineage', () => { expect(input.openChild).toHaveBeenCalledExactlyOnceWith({ parentSessionId: PARENT, childSessionId: CHILD, mode: 'continuable' }) }) - it('leaves task-board keys alone and dismisses the shared panel from outside focus', () => { + it('leaves Escape from outside focus alone', () => { const input = props(catalog()) - render(<>