diff --git a/.agents/notes/implemented/feature/2026-11-05-session-panel.i18n.yaml b/.agents/notes/implemented/feature/2026-11-05-session-panel.i18n.yaml index 4bd1f78eff..8a662fec9c 100644 --- a/.agents/notes/implemented/feature/2026-11-05-session-panel.i18n.yaml +++ b/.agents/notes/implemented/feature/2026-11-05-session-panel.i18n.yaml @@ -24,5 +24,5 @@ en: 9cf81cde02bf900b zh: 549d92a260541e3d /agent-note-session-panel-over-the-conversation-body-s-end-gutter/consequences: - en: c1f661c6a62953b6 - zh: 8642f081c2879307 + en: ef24751bd72963f7 + zh: 36a0f313bc06130e diff --git a/.agents/notes/implemented/feature/2026-11-05-session-panel.md b/.agents/notes/implemented/feature/2026-11-05-session-panel.md index ca4b96e4ab..6ce439c5cd 100644 --- a/.agents/notes/implemented/feature/2026-11-05-session-panel.md +++ b/.agents/notes/implemented/feature/2026-11-05-session-panel.md @@ -45,3 +45,4 @@ The turn rail used the end edge of the scrollport, which the docked panel now oc - Sections from independent plugins share one surface, ordering, and title style without depending on each other, and an occupied section id can be replaced by a higher-priority registration. - The Conversation width controls gained one callback and the Conversation service one per-Session source; the composer stack height now lands on the content body so chrome outside the scrollport can read it. - The turn rail's position changed for every user; its behavior and hiding rule did not. +- Change requests, background jobs, and subagents became sections, replacing the change requests sidebar tab, its start-page entry, and the header controls of jobs and subagents; the header keeps the subagent breadcrumb switcher for child Sessions. A section mounts only while the panel shows, so state that must outlast hiding the panel, such as cleared job rows, lives in a per-Session slot store. diff --git a/.agents/notes/implemented/feature/2026-11-05-session-panel.zh.md b/.agents/notes/implemented/feature/2026-11-05-session-panel.zh.md index 136ceff8a0..29ef6a852d 100644 --- a/.agents/notes/implemented/feature/2026-11-05-session-panel.zh.md +++ b/.agents/notes/implemented/feature/2026-11-05-session-panel.zh.md @@ -45,3 +45,4 @@ Status: implemented - 独立插件的分栏共享同一界面、排序和标题样式,彼此不依赖;已占用的分栏 id 可以被更高优先级的注册替换。 - Conversation 宽度控件多了一个回调,Conversation 服务多了一个按会话划分的 source;composer 区域高度现在写在正文容器上,滚动容器之外的界面元素也能读取。 - 轮次轨道的位置对所有用户都变了;行为和隐藏规则不变。 +- 变更请求、后台任务和子智能体成为分栏,取代变更请求侧边栏标签页、其起始页入口,以及标题栏中的后台任务和子智能体控件;标题栏仍为子会话保留子智能体面包屑切换器。分栏只在面板显示时挂载,因此需要在隐藏面板后保留的状态(例如已清空的任务行)放在按会话划分的 slot store 中。 diff --git a/docs/subsystems/slots.md b/docs/subsystems/slots.md index ee48502923..3ef33db3e7 100644 --- a/docs/subsystems/slots.md +++ b/docs/subsystems/slots.md @@ -149,8 +149,8 @@ root [AppFrame] │ ├─ conversation.session.header.lineage │ ├─ conversation.session.header.actions │ ├─ conversation.session.header.utilities -│ │ └─ id=session-panel [SessionPanelToggle] -│ │ └─ conversation.session.panel.indicator [list, inline] + │ │ └─ id=session-panel [SessionPanelToggle] + │ │ └─ conversation.session.panel.indicator [list, inline] │ ├─ conversation.session.header.views.actions │ └─ conversation.session.header.corner └─ calls Factory: conversation.content @@ -210,8 +210,10 @@ Factory: conversation.content [ConversationContent] ├─ conversation.hero.options └─ conversation.session.panel [SessionPanel] ├─ conversation.session.panel.section [list] - │ └─ id=environment [EnvironmentSection] - │ └─ conversation.session.panel.environment.row [list] + │ ├─ id=environment [EnvironmentSection] + │ │ └─ conversation.session.panel.environment.row [list] + │ └─ id=subagents [SubagentsSection] + │ └─ conversation.session.panel.subagents.footer [list] └─ conversation.session.panel.section.actions [keyed] Factory: conversation.chat.user.content [UserContent] diff --git a/docs/subsystems/slots.zh.md b/docs/subsystems/slots.zh.md index 65224a4b0d..516854f3b9 100644 --- a/docs/subsystems/slots.zh.md +++ b/docs/subsystems/slots.zh.md @@ -151,8 +151,8 @@ root [AppFrame] │ ├─ conversation.session.header.lineage │ ├─ conversation.session.header.actions │ ├─ conversation.session.header.utilities -│ │ └─ id=session-panel [SessionPanelToggle] -│ │ └─ conversation.session.panel.indicator [list, inline] + │ │ └─ id=session-panel [SessionPanelToggle] + │ │ └─ conversation.session.panel.indicator [list, inline] │ ├─ conversation.session.header.views.actions │ └─ conversation.session.header.corner └─ calls Factory: conversation.content @@ -212,8 +212,10 @@ Factory: conversation.content [ConversationContent] ├─ conversation.hero.options └─ conversation.session.panel [SessionPanel] ├─ conversation.session.panel.section [list] - │ └─ id=environment [EnvironmentSection] - │ └─ conversation.session.panel.environment.row [list] + │ ├─ id=environment [EnvironmentSection] + │ │ └─ conversation.session.panel.environment.row [list] + │ └─ id=subagents [SubagentsSection] + │ └─ conversation.session.panel.subagents.footer [list] └─ conversation.session.panel.section.actions [keyed] Factory: conversation.chat.user.content [UserContent] diff --git a/docs/ui-radius.i18n.yaml b/docs/ui-radius.i18n.yaml index 1f40042d22..30025d94ae 100644 --- a/docs/ui-radius.i18n.yaml +++ b/docs/ui-radius.i18n.yaml @@ -21,8 +21,8 @@ en: fb6d50f3139ad186 zh: 668cb0c02bd22167 /dsh-unified-corner-radius-standard/nested-geometry-and-hover: - en: 7fe4eb7707e6a9f3 - zh: be7530a05c205e27 + en: 76037a56b0e1bf64 + zh: 890f512cc1db5263 /dsh-unified-corner-radius-standard/settings-card-materials: en: 126066f9c638433c zh: a7416d255f838b92 diff --git a/docs/ui-radius.md b/docs/ui-radius.md index 3d4ac68d2c..b29344903f 100644 --- a/docs/ui-radius.md +++ b/docs/ui-radius.md @@ -68,7 +68,7 @@ Distinguish these three arrangements before changing a child radius: | Fill flush against an enclosing edge | The enclosure owns the visible corner; clip the fill or inherit the matching corner | A split-button card with two independent hover regions | | Separate card or form group inside another surface | Choose the child's semantic tier; do not subtract all parent padding mechanically | R16 editor within an R20 settings card | -Standard menus use outer R16, 4px padding, and R12 items, including command selection, task menus, and the exposed highlights in subagent and background-job menus. Tree disclosure gutters retain their indentation; controls inside a filled job row keep their own compact geometry. Compact menus use outer R12, 4px padding, and R8 items. Shared `SegmentedControl` uses outer R12, 4px inset, and R8 segments/indicator; `SegmentedTabs` uses outer R16, 4px inset, and R12 segments/indicator. Keep indicator offsets, width calculations, submenu alignment, and pointer bridges consistent when changing padding. +Standard menus use outer R16, 4px padding, and R12 items, including command selection, task menus, and the exposed highlights in the subagent switcher menu. Tree disclosure gutters retain their indentation. Compact menus use outer R12, 4px padding, and R8 items. Shared `SegmentedControl` uses outer R12, 4px inset, and R8 segments/indicator; `SegmentedTabs` uses outer R16, 4px inset, and R12 segments/indicator. Keep indicator offsets, width calculations, submenu alignment, and pointer bridges consistent when changing padding. The radius subtraction is also the nominal sizing rule for nested superellipses. Equal exponents do not make them exact offset curves, so their diagonal gap may differ from the side inset. Keep the shared superellipse menu and segmented-control treatments; use circular arcs when strict equal radial spacing is required. diff --git a/docs/ui-radius.zh.md b/docs/ui-radius.zh.md index 306a27223e..9dd6e05bd1 100644 --- a/docs/ui-radius.zh.md +++ b/docs/ui-radius.zh.md @@ -68,7 +68,7 @@ H 表示以 CSS 像素计、包含边框的设计外部高度。R 表示浏览 | 底色紧贴容器边缘 | 由外框决定可见圆角;裁切底色或继承相应圆角 | 两个独立 hover 区域组成的分体按钮卡片 | | 容器内独立的卡片或表单组 | 按子元素用途选择档位;不机械减去全部父级内边距 | R20 设置卡片内的 R16 编辑器 | -标准菜单使用外层 R16、4px 内边距、R12 菜单项,包含命令选择、任务菜单,以及子会话和后台任务菜单的外露高亮区域。树形展开操作保留缩进;带底色任务行内的控件保留各自的紧凑几何。紧凑菜单使用外层 R12、4px 内边距、R8 菜单项。公共 `SegmentedControl` 使用外层 R12、4px 内缩、R8 分段和指示器;`SegmentedTabs` 使用外层 R16、4px 内缩、R12 分段和指示器。修改内边距时,同步保持指示器偏移、宽度计算、子菜单对齐与指针桥接区域一致。 +标准菜单使用外层 R16、4px 内边距、R12 菜单项,包含命令选择、任务菜单,以及子会话切换菜单的外露高亮区域。树形展开操作保留缩进。紧凑菜单使用外层 R12、4px 内边距、R8 菜单项。公共 `SegmentedControl` 使用外层 R12、4px 内缩、R8 分段和指示器;`SegmentedTabs` 使用外层 R16、4px 内缩、R12 分段和指示器。修改内边距时,同步保持指示器偏移、宽度计算、子菜单对齐与指针桥接区域一致。 半径相减也用于嵌套超级椭圆的名义尺寸关系。相同指数不意味着两条曲线严格等距,因此对角线间隙可能不同于侧边内缩。菜单与分段控件保留公共的超级椭圆样式;要求径向严格等距时使用圆弧。 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 new file mode 100644 index 0000000000..045d5b9f53 --- /dev/null +++ b/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.i18n.yaml @@ -0,0 +1,16 @@ +# Bilingual-pair consistency record for guide.md (docs/i18n/README.md): per heading +# section, a hash of its English and Chinese blocks outside code blocks and generated regions. +# 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 +/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 +/session-header-entries-move-into-the-session-panel/migration: + en: 4a83e0877cc47f10 + zh: aefacb01489018e5 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 new file mode 100644 index 0000000000..b2d818ec3b --- /dev/null +++ b/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.md @@ -0,0 +1,25 @@ +--- +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." +--- + +# Session header entries move into the Session panel + +English | [中文](guide.zh.md) + +## Change + +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-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`. + +Client plugins and runtime extensions that register into the old footer slot, open the `forge-panel` tab type, or import the removed types are affected. A right sidebar restored with a `forge-panel` tab no longer shows that tab. Session data and configuration keys are unchanged. + +## 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`. +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. 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 new file mode 100644 index 0000000000..0e115ef838 --- /dev/null +++ b/docs/upgrade-guide/v0.2.2-rc.1/session-panel-entries/guide.zh.md @@ -0,0 +1,25 @@ +--- +kind: upgrade-guide +description: "后台任务、子智能体与 forge 变更请求从会话标题栏和右侧边栏移入会话面板,子智能体页脚 slot 随之改名,forge 标签页类型退役。" +--- + +# 会话标题栏入口移入会话面板 + +[English](guide.md) | 中文 + +## 变更 + +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-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`。 + +注册到旧页脚 slot、打开 `forge-panel` 标签页类型或导入已移除类型的 Client 插件与运行时扩展会受影响。恢复右侧边栏时,`forge-panel` 标签页不再显示。Session 数据与配置键不变。 + +## 迁移 + +1. 在 Client 插件与运行时扩展中,把对 `conversation.session.header.actions.subagent.footer` 的注册与子 slot 声明全部改为 `conversation.session.panel.subagents.footer`。 +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,点击标题栏中的会话面板开关,在“子智能体”分栏下找到页脚内容,即确认迁移完成。 diff --git a/packages/client/ui-agent-team/README.i18n.yaml b/packages/client/ui-agent-team/README.i18n.yaml index 3f894b097c..091f66d174 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: cecfe90c9079279f - zh: 58062db454093088 + en: 356f94d30f140ff8 + zh: 0bca4d344825321c /deepseek-ai-dsh-client-ui-agent-team: en: 39c47e6e926425bf zh: 0fd155c454355e3a /deepseek-ai-dsh-client-ui-agent-team/summary: - en: 88103cec4c91d755 - zh: 6536e4307a5ce122 + en: 8e14c24476cf235c + zh: ab0e5e6a431893ec /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: d502ab38773eef34 - zh: e1f9c4edbc74c38f + en: 1d0c7d73cd3de38b + zh: 6e9d323c228b70d3 /deepseek-ai-dsh-client-ui-agent-team/use-this-package/inspect-the-task-board: - en: 2f606827b3ab14bc - zh: 7f713d10268e7498 + en: f597ca74be6cb613 + zh: 8bfda029a0f3e40a /deepseek-ai-dsh-client-ui-agent-team/understand-the-implementation: - en: 9b0b6a8505a9ebbf - zh: beb5d89f80463b3e + en: 4fd1c83aa652c25d + zh: 60ab94db9ecb6faf /deepseek-ai-dsh-client-ui-agent-team/further-exploration: - en: 4d9214370681b02e - zh: 4acb21b9ecf25e85 + en: 4b7e17ead1b44084 + zh: 58a98e07c52ad193 /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 7e87010dcb..acd4a17aae 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 from the Web conversation header." +description: "Inspect the shared task board in the Web Session panel's Subagents section." kind: "package-reference" --- @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -This package displays shared tasks below the Subagent tree in one header panel. 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 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. ## Table of Contents @@ -25,7 +25,7 @@ This package displays shared tasks below the Subagent tree in one header panel. ## Use this package -In the root conversation’s model and reasoning menu, turn on **Enable agent teamwork**. New Sessions default to off. While enabled, open the root conversation’s Subagent control to see members above shared tasks. Child conversations keep subagent navigation without a task board or Team switch, including before their subagent address is discovered. The entry is hidden when both the subagent catalog and shared tasks are empty; catalog and task-record errors remain accessible. Section headers appear only when Team mode is enabled, at least one nondeleted shared task exists, and the task footer is available. In that case, the noncollapsible Subagents section remains above shared tasks even when its catalog is empty. Otherwise, the menu shows only subagent navigation, without section headers, a shared-task module, empty-state copy, or a divider. Turning it off retains tasks and subagents. The entire 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 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. 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. The shared menu is 360px wide with 6px outer padding, constrained to fit the viewport. Shared tasks have a 4px top margin rather than a divider. Both section headers keep a 7px icon/title gap and an additional 4px before their counts. Only the menu scrolls; 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 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. ----- @@ -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 and subagent-catalog and 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 Subagents section footer, and its model-menu slots through Cordis effects; it mounts no Remote namespace. Disposing the plugin fiber removes its registrations. -The Subagent catalog owns the shared panel, scrolling, hover, keyboard, and dismissal interactions. This package contributes the task section only below the root conversation’s 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 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 [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, catalog-section, and model-menu registrations | +| [`src/client/mount.ts`](src/client/mount.ts) | Locale, Subagents section footer, 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. -- [Conversation UI](../ui-conversation/README.md) — the stable header slot and addressed-subagent navigation surface. +- [Subagent UI](../ui-subagent/README.md) — the Session panel’s Subagents section, whose footer slot hosts the task board. ----- diff --git a/packages/client/ui-agent-team/README.zh.md b/packages/client/ui-agent-team/README.zh.md index c0db84fe78..2c6d541f78 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 默认加载此包;它不添加模型可见输入。 +此包在会话面板的「子智能体」分栏中,将共享任务显示在 subagent 树下方。Host 投影帧持续更新任务状态,无需刷新控件。普通 subagent(子智能体)导航负责成员列表和队友对话。Web bundle 默认加载此包;它不添加模型可见输入。 ## 目录 @@ -25,7 +25,7 @@ kind: "package-reference" ## 使用本包 -在根会话的模型与推理等级菜单中打开**启用智能体团队协作**。新 Session 默认关闭。开启后,通过根会话的 Subagent 入口同时查看上方的成员树和下方的共享任务。子会话保留子智能体导航,不显示任务板或 Team 开关,包括尚未发现子代理地址时。子智能体目录和共享任务都为空时隐藏入口;目录或任务记录错误仍保留查看入口。仅当 Team 模式已开启、存在至少一个未删除的共享任务且任务 footer 可用时,才显示区域标题。此时即使目录为空,共享任务上方仍保留不可折叠的“子智能体”区域。其他情况下,菜单仅显示 subagent 导航,不显示区域标题、共享任务模块、空状态文案或分隔线。关闭后保留任务和子代理。团队设置整行在悬停时高亮,点击可切换状态,但独立的信息按钮除外。开关调用 `remote.agentTeams.setEnabled`,等待保存后的投影更新,失败由菜单宿主提示;锁定或保存中不能通过整行切换。旁边的信息按钮可通过悬停、键盘聚焦或点击/轻触查看共享任务协作与额外 token 消耗的说明,不改变开关状态。按 Escape 或点击外部可关闭说明。 +在根会话的模型与推理等级菜单中打开**启用智能体团队协作**。新 Session 默认关闭。开启后,打开根会话的会话面板,即可在「子智能体」分栏中同时查看上方的成员树和下方的共享任务。子会话保留子智能体导航,不显示 Team 开关,包括尚未发现子代理地址时。任务板读取当前 Session 的 `agentTeam` 投影,因此只在自身投影已开启的 Session 中显示。子智能体目录和共享任务都为空时隐藏「子智能体」分栏;目录或任务记录错误仍保持可见。目录加载为空、分栏因共享任务或任务记录错误而显示时,在其上方显示“暂无子智能体”。没有共享任务或任务记录错误时,分栏仅显示 subagent 导航,不显示共享任务模块或空状态文案。关闭后保留任务和子代理。团队设置整行在悬停时高亮,点击可切换状态,但独立的信息按钮除外。开关调用 `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`;两个字段都没有时显示本地化的无负责人标签。共享菜单宽度为 360px,外层内边距为 6px,并受视口可用宽度约束。共享任务上方保留 4px 外边距,不显示分隔线。两个区域标题均保留 7px 图标与文字间距,并在统计数量前额外留出 4px。仅菜单本身滚动,任务列表与详情不单独滚动。Agent 通过工具修改任务;面板不提供修改控件。投影失败以独立警告显示在保留的任务上方,即使没有任务也保持可见。 +不可折叠的“共享任务”标题使用 Checklist 图标,并显示已完成、进行中和待处理数量;省略零值,文案和分隔符与输入区任务列表一致。紧凑只读行显示主题、状态和展开箭头,13px 主标题与悬停区域对齐子智能体行;展开详情使用 12px 文字。任务行使用 7px 垂直内边距、6px 水平内边距和 7px 间距,使可点击内容与 subagent 行对齐。所有任务详情初始关闭,打开一项会关闭上一项。详情仅显示完整描述(如有),下方以单行显示负责人标签和负责人名称,两者使用相同颜色,间距为 4px。过长的负责人名称以省略号截断,仅在被截断时通过工具提示显示完整内容。任务文字和负责人的工具提示在悬停 500ms 后显示。负责人显示任务保存的 `ownerName`,例如 `lead` 或 `reviewer/checker`,不依赖已加载的 subagent 目录。缺少 `ownerName` 时显示 `ownerId`;两个字段都没有时显示本地化的无负责人标签。位于非空 subagent 树下方时,任务板上方保留 4px 外边距,不显示分隔线。“共享任务”标题保留 7px 图标与文字间距,并在统计数量前额外留出 4px。会话面板负责任务板滚动,任务列表与详情不单独滚动。Agent 通过工具修改任务;面板不提供修改控件。投影失败以独立警告显示在保留的任务上方,即使没有任务也保持可见。 ----- @@ -47,15 +47,15 @@ Chat 隐藏历史 `/team on` 和 `/team off` 记录中尚未完成或执行成
实现细节——点击展开 -Client export 通过 Cordis effect 注册语言字典、子代理目录与模型菜单 slot;它不挂载 Remote namespace。销毁插件 fiber 会移除这些注册。 +Client export 通过 Cordis effect 注册语言字典、「子智能体」分栏 footer 与模型菜单 slot;它不挂载 Remote namespace。销毁插件 fiber 会移除这些注册。 -Subagent 目录负责共享面板的滚动、悬停、键盘和关闭交互。本包仅在根会话的树下方提供任务区。任务板通过 `useProjection('agentTeam')` 读取当前 Session 的模式与任务;仅当投影可用、已开启且含有未删除的任务时才显示任务区;投影错误可独立显示,不需要任务区。任务 ID、依赖、准备状态、写入范围及其提示仍保留在任务数据中,但不作为详情字段显示;被依赖阻塞的 pending 任务仍使用 warning 图标。 +会话面板负责「子智能体」分栏的显示、滚动和关闭,`dsh-client-ui-subagent` 负责其中的目录树。本包把任务板注册到分栏在目录树下方的 `conversation.session.panel.subagents.footer` slot。任务板通过 `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) | 语言字典、目录任务区和模型菜单注册 | +| [`src/client/mount.ts`](src/client/mount.ts) | 语言字典、「子智能体」分栏 footer 和模型菜单注册 | | [`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 @@ Subagent 目录负责共享面板的滚动、悬停、键盘和关闭交互。 - [Web bundle](../../bundle/web-app/README.zh.md)——默认挂载本 Client plugin。 - [Agent Teams 服务](../../team/agent-team/README.zh.md) — 任务和投影行为的权威来源。 -- [会话 UI](../ui-conversation/README.zh.md)——稳定 header slot 与 addressed-subagent 导航表层。 +- [Subagent UI](../ui-subagent/README.zh.md)——会话面板的「子智能体」分栏,其 footer slot 承载任务板。 ----- diff --git a/packages/client/ui-jobs/README.i18n.yaml b/packages/client/ui-jobs/README.i18n.yaml index f6bb8ea61f..e06cfe5c43 100644 --- a/packages/client/ui-jobs/README.i18n.yaml +++ b/packages/client/ui-jobs/README.i18n.yaml @@ -3,32 +3,32 @@ # After editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-jobs/README.md /: - en: 063a69d5d6281c07 - zh: 04562d2b1dd29590 + en: ee6ba7faaa030a05 + zh: c74dcdb3f5d7d0b7 /deepseek-ai-dsh-client-ui-jobs: en: faa1eecdc7f06930 zh: c6e7b06ccb434f0b /deepseek-ai-dsh-client-ui-jobs/summary: - en: b61245c057c1a924 - zh: 6013131975ece32e + en: 4181e6f8df4dc4e9 + zh: 7a8f25a775bd854a /deepseek-ai-dsh-client-ui-jobs/table-of-contents: en: d152484eb41ac6b4 zh: 09388d293f9be9cb /deepseek-ai-dsh-client-ui-jobs/use-this-package: - en: 3466553808f81088 - zh: 02a806ece1c3e012 + en: 78a5780d9ccfdc0e + zh: 2e3ba7a42ba587bd /deepseek-ai-dsh-client-ui-jobs/use-this-package/one-row-per-job: - en: 64c1f55b35e73295 - zh: 4d93594923cf787f + en: 2070f740163c524a + zh: 2910dea28ce1b8b3 /deepseek-ai-dsh-client-ui-jobs/use-this-package/the-expanded-panel: en: c34dad62fee63306 zh: 167d9da7928a9488 /deepseek-ai-dsh-client-ui-jobs/understand-the-implementation: - en: 640e8bd39b28c07d - zh: 86c7eb39acfeebc0 + en: e5bbb2f24732e6e9 + zh: ac3f248b255c5211 /deepseek-ai-dsh-client-ui-jobs/further-exploration: - en: 01eaaecb5850f391 - zh: 2eabd14cde191ab8 + en: e9370f09a7b49495 + zh: 6b297e9dbf7a6aa6 /deepseek-ai-dsh-client-ui-jobs/model-experience: en: 84ad94ba940f17af zh: 0199b09d360df0d8 diff --git a/packages/client/ui-jobs/README.md b/packages/client/ui-jobs/README.md index 04abc0f1d1..551ade8b95 100644 --- a/packages/client/ui-jobs/README.md +++ b/packages/client/ui-jobs/README.md @@ -1,5 +1,5 @@ --- -description: "The session-header background-job list: expandable streaming output panels, running/finished sections, and static rows for settled jobs without retained output." +description: "The Session panel's background-jobs section: expandable streaming output panels, live rows above a folded finished list, and static rows for settled jobs without retained output." kind: "package-reference" --- @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -`dsh-client-ui-jobs` shows the session's background jobs in one header control, with lifecycle, elapsed time, progress, and terminal detail. Live jobs and settled jobs with retained output offer expandable output panels; collapsing stops the stream. Live rows lead with a ticking duration, followed by kind and status. Settled rows fold under a section heading; those without retained output, including subagents whose answers went to the model, stay static. +`dsh-client-ui-jobs` shows the session's background jobs in the Session panel's Background jobs section, with lifecycle, elapsed time, progress, and terminal detail. Live jobs and settled jobs with retained output offer expandable output panels; collapsing stops the stream. Live rows show the label above the kind, current progress, and a ticking duration. Settled rows fold under a count; those without retained output, including subagents whose answers went to the model, stay static. ## Table of Contents @@ -25,17 +25,17 @@ English | [中文](README.zh.md) ## Use this package -Load the plugin through the web-app manifest; it renders nothing until the session can see at least one job, so an ordinary conversation never grows a control for a capability it is not using. +Load the plugin through the web-app manifest. It registers the [Session panel](../ui-session-panel/README.md#contribute-a-section) section `background-jobs` at order 300, after Subagents, titled “Background jobs”. The section renders nothing until the session can see at least one job, so the panel hides it together with its title and an ordinary conversation shows no section for a capability it is not using. -The header shows the live job count when any jobs are running or stopping, otherwise the visible job count, without repeating the spinner's running state in visible text. The trigger's accessible description identifies live work in both wide and compact layouts. In wide layout, a 14px icon slot shows the spinner for live jobs or the 14px layers icon for idle jobs; the root trigger has no disclosure arrow. At container widths up to 460px, the count hides and the trigger always shows the layers icon, including while jobs are live; running indicators remain inside the menu. The trigger matches More and sidebar controls: a 28×28px icon button with no padding, a 15px glyph in a 15px slot, secondary ink, and ghost hover and active backgrounds. Header actions use an 8px gap in compact layout and 10px in wide layout. Its count tooltip appears after 500ms of hover or immediately on keyboard focus, and stays hidden while the list is open. +Live rows come first in start order on filled cards; settled rows follow newest-first under a “Finished {count}” toggle with a “Clear” action. The settled list folds while any job is live and opens when only settled jobs remain; pressing the toggle overrides that default. Clear hides the current settled rows in this client while the Session stays open, also after the panel is hidden and shown again; the registry keeps their records, a job that settles later appears normally, and the section hides when no rows remain. -Non-touch hover on the text-visible trigger opens the list after 150ms; leaving both the trigger and its portaled list closes it after 120ms. Clicking the wide trigger opens or pins the list; clicking an already pinned trigger closes it. The compact trigger toggles on click and never opens on hover, including when the count hides during a pending hover. ArrowDown opens and pins the list and focuses its first control. Pointer interaction or keyboard focus inside also pins it. Outside click or Escape dismisses it, and Tab connects the trigger to the portaled controls. Hover timers and pins reset when the session changes, no visible jobs remain, or the component unmounts. +Pressing an observable row expands its output panel, and pressing it again collapses it; one row expands at a time. Each duration has a tooltip, “Running for {duration}” on live rows and “Took {duration}” on settled rows, and live durations advance once per second while any job is live. ### One row per job The `job.list` stream `ctx.jobs` mirrors is the single roster: each `JobView` row carries lifecycle, duration, the live `progress` line or the terminal `detail`, and its retained byte count — a live job, or a settled one with retained output, is what makes a row expandable. There is no second roster to join. -Running job rows also carry a two-press stop control: the first press arms it, the confirming press within three seconds calls `ctx.jobs.kill`, and the row converges through the roster stream (`stopping`, then the settled section, whose detail carries `cancelled by the user`). The kill claims nothing in the model's notice ledger, so the owning agent still receives the standard completion notice — the model is told the user stopped its task rather than left to infer it ([reference](../../jobs/tool-jobs/README.md)). The settled section folds behind its count while live work exists and can be cleared client-side. +Running job rows also carry a two-press stop control: the first press arms it and widens it into a “Confirm stop” button, the confirming press within three seconds calls `ctx.jobs.kill`, and the row converges through the roster stream (`stopping`, then the settled list, whose detail carries `cancelled by the user`). A rejected kill shows “Stop failed” for four seconds. The kill claims nothing in the model's notice ledger, so the owning agent still receives the standard completion notice — the model is told the user stopped its task rather than left to infer it ([reference](../../jobs/tool-jobs/README.md)). ### The expanded panel @@ -49,15 +49,16 @@ Expanding an observable row opens that job's output observation stream from `ctx
Implementation internals — click to expand -One slot entry in the header actions band (after the preset label) renders the trigger; its popover uses a body-mounted `MenuSurface` with fixed positioning so dock panels and clipping ancestors cannot cover it. CSS anchors keep the popover attached to its trigger within layout-viewport size limits. Browser zoom and panning move it with the page, so it may extend beyond the visual viewport. Its internal scrolling and dismissal remain available. All data arrives through `ctx.jobs` — the component holds no transport state. The roster follows the mount: one `useEffect` keeps the session's `job.list` stream open while the control lives. Observation follows visibility: another `useEffect` opens the stream for the expanded row's job and closes it on collapse, unmount, or popover close. +One `conversation.session.panel.section` registration renders the section body; the Session panel draws its title, supplies its inset, and scrolls it. All data arrives through `ctx.jobs` — the component holds no transport state. The roster follows the mount: one `useEffect` keeps the session's `job.list` stream open while the section is mounted, which is while the Session panel shows. Observation follows visibility: another `useEffect` opens the stream for the expanded row's job and closes it on collapse or unmount, including when the panel hides. | File | Role | |---|---| -| [`src/client/JobListAction.tsx`](src/client/JobListAction.tsx) | The job list: sections, durations, panels | -| [`src/client/index.ts`](src/client/index.ts) | Slot registration and the dictionaries | +| [`src/client/JobsSection.tsx`](src/client/JobsSection.tsx) | The section: live and settled rows, durations, the stop control, output panels | +| [`src/client/jobs-store.ts`](src/client/jobs-store.ts) | Per-Session store of cleared rows | +| [`src/client/index.ts`](src/client/index.ts) | Session panel section registration and the dictionaries | | [`src/client/locales.ts`](src/client/locales.ts) | The `job` namespace copy (zh source of truth) | -Background-job rows follow the [standard menu edge geometry](../../../docs/ui-radius.md#nested-hover); controls inside a filled running row retain compact corners. +Background-job rows use the standard menu item radius from the [nested geometry rules](../../../docs/ui-radius.md#nested-hover); controls inside a filled running row retain compact corners.
@@ -68,6 +69,7 @@ Background-job rows follow the [standard menu edge geometry](../../../docs/ui-ra - [`dsh-api-job-controller`](../../api/job-controller/README.md) — the `job.list` and `job.follow` streams, the `job.kill` Remote, and the `ctx.jobs` service behind the rows, the panel, and the stop control. - [`dsh-jobs`](../../jobs/jobs/README.md) — the registry contract that owns the ring and projection semantics. +- [`dsh-client-ui-session-panel`](../ui-session-panel/README.md) — the Session panel that orders, titles, and scrolls this section. - [`dsh-client-ui-primitives`](../ui-primitives/README.md) — the `TerminalBlock` surface the panel configures. ----- diff --git a/packages/client/ui-jobs/README.zh.md b/packages/client/ui-jobs/README.zh.md index 0f226d9973..356f173c99 100644 --- a/packages/client/ui-jobs/README.zh.md +++ b/packages/client/ui-jobs/README.zh.md @@ -1,5 +1,5 @@ --- -description: "会话头部后台任务列表:可展开的流式输出面板、进行中/已结束分组,以及无保留输出的已结束任务的静态行。" +description: "会话面板的「后台任务」分栏:可展开的流式输出面板、位于已折叠的已结束列表上方的进行中行,以及无保留输出的已结束任务的静态行。" kind: "package-reference" --- @@ -9,7 +9,7 @@ kind: "package-reference" ## 概述 -`dsh-client-ui-jobs` 在一个头部控件中展示本会话的后台任务,包括生命周期、耗时、进度与终态详情。进行中的任务和保留了输出的已结束任务提供可展开的输出面板;收起即停流。进行中的行以持续更新的时长为主行,随后展示类型与状态。已结束的行折叠在分组标题下;没有保留输出的任务保持静态,包括回答已交给模型的 subagent。 +`dsh-client-ui-jobs` 在会话面板的「后台任务」分栏中展示本会话的后台任务,包括生命周期、耗时、进度与终态详情。进行中的任务和保留了输出的已结束任务提供可展开的输出面板;收起即停流。进行中的行在标签下方展示类型、当前进度与持续更新的时长。已结束的行折叠在计数之下;没有保留输出的任务保持静态,包括回答已交给模型的 subagent。 ## 目录 @@ -25,17 +25,17 @@ kind: "package-reference" ## 使用本包 -通过 web-app 清单加载本插件;在会话看得到至少一个 job 之前它不渲染任何东西,因此普通对话不会为未使用的能力长出控件。 +通过 web-app 清单加载本插件。它在 order 300 注册[会话面板](../ui-session-panel/README.zh.md#contribute-a-section)分栏 `background-jobs`,位于「子智能体」之后,标题为「后台任务」。在会话看得到至少一个 job 之前,该分栏不渲染任何东西,面板因此连同标题一起隐藏它,普通对话不会为未使用的能力显示分栏。 -有运行中或正在停止的任务时,头部显示这些任务的数量;否则显示可见任务总数,可见文字不重复旋转指示器已表达的运行状态。宽布局和紧凑布局中的触发器均通过无障碍描述说明是否有进行中的任务。宽布局下,14px 图标区域在有进行中任务时显示旋转指示器,否则显示 14px 图层图标;根触发器不带展开箭头。容器宽度不超过 460px 时,数量文字隐藏,触发器始终显示图层图标,包括任务运行期间;运行指示器仍在菜单内显示。触发器与更多及侧边栏控件一致:28×28px 图标按钮,无内边距,15px 图标位内显示 15px 图标,使用次级前景色以及 ghost 悬停和按下背景。页头操作在紧凑布局中间距为 8px,宽布局中为 10px。数量工具提示在悬停 500ms 后或获得键盘焦点时立即显示,列表打开期间保持隐藏。 +进行中的行按开始顺序排在最前,显示为带底色的卡片;已结束的行按结束时间从新到旧排在「已结束 {count}」切换按钮之下,旁边有「清空」操作。有任务进行中时已结束列表折叠,只剩已结束任务时展开;按下切换按钮会覆盖该默认状态。「清空」在本客户端中隐藏当前已结束的行,Session 保持打开期间一直有效,隐藏后再次显示面板也不变;注册表保留其记录,之后结束的 job 照常出现,没有剩余行时分栏隐藏。 -非触摸指针在文字可见的触发器上悬停 150ms 后打开列表;指针离开触发器和挂载到 portal 的列表后,经过 120ms 关闭。点击宽布局触发器会打开或固定列表;再次点击已固定的触发器会关闭列表。紧凑触发器通过点击切换开关状态,不因悬停打开,包括等待悬停期间数量文字隐藏的情况。ArrowDown 会打开并固定列表,将焦点移至首个控件。在列表内进行指针交互或移入键盘焦点也会固定列表。点击外部或按 Escape 可关闭列表,Tab 将触发器与 portal 内的控件连接起来。切换会话、没有可见任务或组件卸载时,悬停计时器与固定状态都会重置。 +按下可观察的行会展开其输出面板,再次按下则收起;同一时间只展开一行。每个时长都带工具提示:进行中的行为「已运行 {duration}」,已结束的行为「耗时 {duration}」;有任务进行中时,进行中的时长每秒更新一次。 ### 一 job 一行 `ctx.jobs` 镜像的 `job.list` 流是唯一名册:每个 `JobView` 行携带生命周期、时长、实时 `progress` 行或终态 `detail`,以及其保留字节数——进行中的 job,或留有保留输出的已结束 job,就是行可展开的依据。不存在需要 join 的第二份名册。 -运行中的 job 行还带一个两击式停止控件:首击武装,三秒内的确认击调用 `ctx.jobs.kill`,行状态经名册流收敛(先 `stopping`,再入已结束分组,其 detail 携带 `cancelled by the user`)。该 kill 不在模型的播报台账里认领任何东西,任务的 owner agent 因此照常收到标准完成通知——模型被明确告知用户停止了它的任务,而不是留给它去猜([参考](../../jobs/tool-jobs/README.zh.md))。已结束分组在有进行中工作时折叠在其计数之后,并可在客户端清空。 +运行中的 job 行还带一个两击式停止控件:首击武装并将其展宽为「确认停止」按钮,三秒内的确认击调用 `ctx.jobs.kill`,行状态经名册流收敛(先 `stopping`,再入已结束列表,其 detail 携带 `cancelled by the user`)。kill 被拒绝时显示「停止失败」四秒。该 kill 不在模型的播报台账里认领任何东西,任务的 owner agent 因此照常收到标准完成通知——模型被明确告知用户停止了它的任务,而不是留给它去猜([参考](../../jobs/tool-jobs/README.zh.md))。 ### 展开的面板 @@ -49,15 +49,16 @@ kind: "package-reference"
实现内幕——点击展开 -头部操作带里的一个 slot 条目(preset 标签之后)渲染触发器;弹出层通过挂载到 body 的 `MenuSurface` 固定定位,避免被停靠面板遮挡或被祖先容器裁剪。CSS 锚点让弹层跟随触发器,并按布局视口限制尺寸。浏览器缩放和平移时弹层随页面移动,因此可以超出视觉视口。内部滚动和关闭操作保持可用。所有数据经 `ctx.jobs` 到达——组件不持有任何传输状态。名册跟随挂载:一个 `useEffect` 在控件存活期间保持会话的 `job.list` 流打开。观测跟随可见性:另一个 `useEffect` 为展开行的 job 打开流,并在收起、卸载或弹出层关闭时关闭它。 +一条 `conversation.session.panel.section` 注册渲染分栏正文;会话面板绘制其标题、提供内边距并负责滚动。所有数据经 `ctx.jobs` 到达——组件不持有任何传输状态。名册跟随挂载:一个 `useEffect` 在分栏挂载期间(即会话面板显示期间)保持会话的 `job.list` 流打开。观测跟随可见性:另一个 `useEffect` 为展开行的 job 打开流,并在收起或卸载时关闭它,包括面板隐藏时。 | 文件 | 角色 | |---|---| -| [`src/client/JobListAction.tsx`](src/client/JobListAction.tsx) | 任务列表:分组、时长、面板 | -| [`src/client/index.ts`](src/client/index.ts) | slot 注册与词典 | +| [`src/client/JobsSection.tsx`](src/client/JobsSection.tsx) | 分栏:进行中与已结束的行、时长、停止控件、输出面板 | +| [`src/client/jobs-store.ts`](src/client/jobs-store.ts) | 按 Session 保存已清空行的 store | +| [`src/client/index.ts`](src/client/index.ts) | 会话面板分栏注册与词典 | | [`src/client/locales.ts`](src/client/locales.ts) | `job` 命名空间文案(zh 为事实源) | -后台任务行遵循[标准菜单边缘几何](../../../docs/ui-radius.zh.md#nested-hover);带底色运行行内的控件保留紧凑圆角。 +后台任务行使用[嵌套几何规则](../../../docs/ui-radius.zh.md#nested-hover)中的标准菜单项圆角;带底色运行行内的控件保留紧凑圆角。
@@ -68,6 +69,7 @@ kind: "package-reference" - [`dsh-api-job-controller`](../../api/job-controller/README.zh.md) —— 行、面板与停止控件背后的 `job.list`、`job.follow` 流、`job.kill` Remote 与 `ctx.jobs` 服务。 - [`dsh-jobs`](../../jobs/jobs/README.zh.md) —— 拥有环与投影语义的注册表契约。 +- [`dsh-client-ui-session-panel`](../ui-session-panel/README.zh.md) —— 为本分栏排序、绘制标题并负责滚动的会话面板。 - [`dsh-client-ui-primitives`](../ui-primitives/README.zh.md) —— 面板所配置的 `TerminalBlock` 表面。 ----- diff --git a/packages/client/ui-jobs/package.json b/packages/client/ui-jobs/package.json index 3c50087660..192e7c1ce6 100644 --- a/packages/client/ui-jobs/package.json +++ b/packages/client/ui-jobs/package.json @@ -38,6 +38,7 @@ "@deepseek-ai/cordis": "workspace:~", "@deepseek-ai/dsh-api-job-controller": "workspace:*", "@deepseek-ai/dsh-client-locale": "workspace:*", + "@deepseek-ai/dsh-client-store": "workspace:*", "@deepseek-ai/dsh-client-test-runtime": "workspace:*", "@deepseek-ai/dsh-client-ui-primitives": "workspace:*", "@deepseek-ai/dsh-client-ui-renderer": "workspace:*", diff --git a/packages/client/ui-jobs/src/client/JobsSection.tsx b/packages/client/ui-jobs/src/client/JobsSection.tsx index b348e89777..4406f0935a 100644 --- a/packages/client/ui-jobs/src/client/JobsSection.tsx +++ b/packages/client/ui-jobs/src/client/JobsSection.tsx @@ -5,7 +5,8 @@ import { IconChevronDownOutlineRegular, IconStopFillRegular, StateDot, TerminalBlock, type StateDotState, type TerminalBlockLabels, } from '@deepseek-ai/dsh-client-ui-primitives' -import type { InjectFace, PropsLocale, PropsRuntime, TranslateNS } from '@deepseek-ai/dsh-client-ui-slots' +import type { InjectFace, PropsLocale, PropsRuntime, PropsStore, TranslateNS } from '@deepseek-ai/dsh-client-ui-slots' +import type { createJobsSectionStore } from './jobs-store.ts' import { NS } from './locales.ts' import type {} from '@deepseek-ai/dsh-client-ui-session-panel/client' import css from './JobsSection.module.css' @@ -42,6 +43,7 @@ export type JobsSectionProps = PropsRuntime<'conversation.session.panel.section'> & PropsLocale & InjectFace + & PropsStore> /** Stable empty list so a session with no jobs keeps one array identity. */ const NO_JOBS: readonly JobView[] = [] @@ -321,7 +323,7 @@ function JobItem({ job, view, expanded, now, onToggle, kill, t }: { * observation, and kill controls, and the namespace translator. * @returns the job list, or null when there is nothing to show. */ -export function JobsSection({ sessionId, useJobs, watchRows, observe, killJob, t }: JobsSectionProps) { +export function JobsSection({ sessionId, useJobs, watchRows, observe, killJob, useStore, actions, t }: JobsSectionProps) { const jobs = useJobs(state => state.rows[sessionId]) ?? NO_JOBS const observedViews = useJobs(state => state.observed) const [expandedKey, setExpandedKey] = useState(undefined) @@ -331,15 +333,15 @@ export function JobsSection({ sessionId, useJobs, watchRows, observe, killJob, t const [settledOpen, setSettledOpen] = useState(undefined) // Rows the user cleared from the settled tail (client-side hide only; the // registry keeps its records and a later settlement reappears normally). - const [clearedKeys, setClearedKeys] = useState>(() => new Set()) + const cleared = useStore(state => state.cleared) // One kill affordance advances at a time: arming a row disarms any other. const [killPhase, setKillPhase] = useState<{ key: string; state: Exclude } | undefined>(undefined) const rows = useMemo(() => ordered(jobs), [jobs]) const liveRows = useMemo(() => rows.filter(isLive), [rows]) const settledRows = useMemo( - () => rows.filter(job => !isLive(job) && !clearedKeys.has(String(job.id))), - [rows, clearedKeys], + () => rows.filter(job => !isLive(job) && cleared[String(job.id)] !== true), + [rows, cleared], ) const settledExpanded = settledOpen ?? liveRows.length === 0 @@ -404,11 +406,7 @@ export function JobsSection({ sessionId, useJobs, watchRows, observe, killJob, t if (liveRows.length + settledRows.length === 0) return null const clearSettled = (): void => { - setClearedKeys((current) => { - const next = new Set(current) - for (const job of settledRows) next.add(String(job.id)) - return next - }) + actions.cleared(settledRows.map(job => String(job.id))) if (expandedKey !== undefined && settledRows.some(job => String(job.id) === expandedKey)) { setExpandedKey(undefined) } diff --git a/packages/client/ui-jobs/src/client/index.ts b/packages/client/ui-jobs/src/client/index.ts index 8bc214bccc..f401d765b7 100644 --- a/packages/client/ui-jobs/src/client/index.ts +++ b/packages/client/ui-jobs/src/client/index.ts @@ -8,6 +8,7 @@ import type { Context as ClientContext } from '@deepseek-ai/cordis' import type { JobId } from '@deepseek-ai/dsh-jobs/brand' import { JobsSection } from './JobsSection.tsx' import type { JobsSectionInjected } from './JobsSection.tsx' +import { createJobsSectionStore } from './jobs-store.ts' import type {} from '@deepseek-ai/dsh-api-job-controller/client' import type {} from '@deepseek-ai/dsh-client-locale/client' import type {} from '@deepseek-ai/dsh-client-ui-renderer/client' @@ -43,6 +44,7 @@ export function apply(ctx: ClientContext): void { order: 300, label: () => t('list.aria'), locale: NS, + store: createJobsSectionStore(), inject: (): JobsSectionInjected => ({ hooks: { jobs: ctx.jobs.state }, watchRows: sessionId => ctx.jobs.watchRows(sessionId), diff --git a/packages/client/ui-jobs/src/client/jobs-store.ts b/packages/client/ui-jobs/src/client/jobs-store.ts new file mode 100644 index 0000000000..928eb99a91 --- /dev/null +++ b/packages/client/ui-jobs/src/client/jobs-store.ts @@ -0,0 +1,38 @@ +/** + * Settled rows the user cleared from the background-jobs section. The + * registration declares it as an exclusive store, so each Session keeps its + * own while its scope is retained, across hiding and showing the panel. + */ + +import { defineStore, type EngineStoreHandle } from '@deepseek-ai/dsh-client-store' + +/** Cleared row keys of one Session. */ +export interface JobsSectionState { + /** Keys of the settled rows the user cleared. */ + cleared: Record +} + +/** The jobs section store's write set. */ +type JobsSectionActions = { + cleared: (draft: JobsSectionState, keys: readonly string[]) => void +} + +/** + * Declare the jobs section's store. + * @returns the store handle to declare on the registration. + */ +export function createJobsSectionStore(): EngineStoreHandle { + return defineStore({ + init: (): JobsSectionState => ({ cleared: {} }), + actions: { + /** + * Hide settled rows from the section; the registry keeps their records. + * @param d - draft state. + * @param keys - row keys to hide. + */ + cleared: (d, keys: readonly string[]) => { + for (const key of keys) d.cleared[key] = true + }, + }, + }) +} diff --git a/packages/client/ui-jobs/tests/jobs-section.client.spec.tsx b/packages/client/ui-jobs/tests/jobs-section.client.spec.tsx index 296b28fc00..50a4a3ed32 100644 --- a/packages/client/ui-jobs/tests/jobs-section.client.spec.tsx +++ b/packages/client/ui-jobs/tests/jobs-section.client.spec.tsx @@ -1,10 +1,12 @@ // @vitest-environment jsdom import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { useSyncExternalStore } from 'react' import { act, cleanup, fireEvent, render, screen, within } from '@testing-library/react' import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime' import type { JobsSnapshot, JobView, ObservedJob } from '@deepseek-ai/dsh-api-job-controller/client' import type { SessionId } from '@deepseek-ai/dsh-session/types' import { JobsSection, type JobsSectionProps } from '../src/client/JobsSection.tsx' +import { createJobsSectionStore } from '../src/client/jobs-store.ts' import { zh, ru } from '../src/client/locales.ts' beforeEach(() => { @@ -55,18 +57,31 @@ function outputJob(over: Partial = {}): JobView { return job({ output: { total: 12, earliest: 0 }, ...over }) } +/** One Session's section store, as the registration mints it. */ +type SectionStore = ReturnType['create']> + +/** Test-local selector hook over a framework-neutral store instance. */ +function hookOf(instance: { subscribe: (listener: () => void) => () => void; getSnapshot: () => T }) { + return function useSelector(select: (state: T) => S): S { + return select(useSyncExternalStore(instance.subscribe, instance.getSnapshot)) + } +} + function props( jobs: readonly JobView[], observe: JobsSectionProps['observe'] = () => () => {}, observed: Readonly> = {}, killJob: JobsSectionProps['killJob'] = async () => true, watchRows: JobsSectionProps['watchRows'] = () => () => {}, + store: SectionStore = createJobsSectionStore().create(), ): JobsSectionProps { const jobsState: JobsSnapshot = { rows: jobs.length > 0 ? { [SESSION]: jobs } : {}, observed } function useJobs(select: (value: JobsSnapshot) => T): T { return select(jobsState) } - return { sessionId: SESSION, useJobs, watchRows, observe, killJob, t } as JobsSectionProps + return { + sessionId: SESSION, useJobs, watchRows, observe, killJob, useStore: hookOf(store), actions: store.actions, t, + } as Pick as JobsSectionProps } /** The section renders its rows inline; there is no trigger to open. */ @@ -130,6 +145,18 @@ describe('JobsSection rows', () => { expect(screen.queryByRole('button', { name: zh['section.clear'] })).toBeNull() }) + it('keeps cleared rows hidden when the section mounts again for the same Session', () => { + const store = createJobsSectionStore().create() + const settled = job({ id: 'bash-2' as JobView['id'], label: 'settled work', status: 'completed', finishedAt: 1_700_000_012_000 }) + const first = render() + fireEvent.click(screen.getByRole('button', { name: zh['section.settledCount'].replace('{count}', '1') })) + fireEvent.click(screen.getByRole('button', { name: zh['section.clear'] })) + first.unmount() + render() + expect(screen.queryByRole('button', { name: zh['section.settledCount'].replace('{count}', '1') })).toBeNull() + expect(screen.queryByText('settled work')).toBeNull() + }) + it('opens the settled tail by default when nothing is live', () => { render( ## Use this package -The session header uses the session title for ordinary breadcrumbs. Subagent breadcrumbs prefer the original creation description (`entry.label`), then the agent name (`entry.name`), then the Session id. Ordinary and subagent breadcrumb titles both use 14px text with a 20px line height. When the session's direct catalog has entries or a read has failed, the descendant-count trigger renders after the preset label in the header actions band, with no breadcrumb separator. An absent or empty catalog hides the count trigger unless the root Session has an enabled, available Team board with shared tasks or a task-record error. Enabling Team mode alone does not show an empty entry. The trigger opens that direct catalog, uses the total count as its accessible name and the running count as its accessible description, and loads nested catalogs only when their rows expand. Select a local child at any depth to open that child's conversation with its exact `{parentSessionId, childSessionId, mode}` address, or use a noncurrent local row's trailing arrow to open the same address in the right Sidebar, preferring a separate pane when room permits. +The session header uses the session title for ordinary breadcrumbs. Subagent breadcrumbs prefer the original creation description (`entry.label`), then the agent name (`entry.name`), then the Session id. Ordinary and subagent breadcrumb titles both use 14px text with a 20px line height. Each subagent breadcrumb title is a switcher over its parent's direct catalog that marks the title's Session as current; root Sessions have no switcher. The [Session panel](../ui-session-panel/README.md#contribute-a-section) section `subagents` (order 200, titled “Subagents”) lists the current Session's direct catalog, in root and child conversations alike, when the catalog has entries or a read has failed, and loads nested catalogs only when their rows expand. An absent or empty catalog hides the section and its title unless a footer contribution is available and the Session's enabled `agentTeam` projection has nondeleted shared tasks or a task-record error. Enabling Team mode alone does not show an empty section. Select a local child at any depth to open that child's conversation with its exact `{parentSessionId, childSessionId, mode}` address, or use a noncurrent local row's trailing arrow to open the same address in the right Sidebar, preferring a separate pane when room permits. Either action closes the panel's overlay or the switcher menu that holds the row. 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. -Every open catalog menu is 360px wide with 6px outer padding, constrained to fit the layout viewport. The root menu shows noncollapsible Subagents and Shared tasks headers only when Team mode is enabled, at least one nondeleted shared task exists, and the footer contribution is available. The Subagents header uses a Users icon and counts direct entries in completed, in progress, not running, and external order; zero counts are omitted and the separator matches the input task list. External tasks never count as running or completed. An empty Subagents section shows “No subagents” only alongside shared tasks. With Team mode off or no shared tasks, the menu shows only the subagent list, without section headers, a shared-task module, empty-state copy, or a divider; a real task-record failure remains a separate alert. Shared tasks have a 4px top margin rather than a divider. Both section headers keep a 7px icon/title gap and an additional 4px before their counts. Only the menu scrolls; sections have no nested scrolling. In WebKit-compatible browsers, the 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. 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 root catalog exposes `conversation.session.header.actions.subagent.footer` for shared tasks. Child and ancestor breadcrumb catalogs show navigation only, without section headers. +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. -The wide root count trigger shows a 14px Users icon in its 14px slot when no child is running and the shared ongoing loader otherwise, without a dropdown arrow. As the title row narrows, passive preset text hides at widths of 540px or less and the count text hides at 460px or less. The compact trigger always shows the Users icon, including while children are running; running indicators remain inside the menu. It matches More and sidebar controls: a 28×28px action with no padding, a 15px glyph in a 15px slot, secondary ink, and ghost hover and active backgrounds. Header actions use an 8px gap in compact layout and 10px in wide layout. The icon-only tooltip exposes the full count. Resizing preserves focus on the trigger. Subagent switchers retain their description-first text and existing icon. +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. ### Browsing the tree -Count, owner, and sidebar-action tooltips appear after 500ms of hover. Hovering a text-visible trigger opens its catalog after 150ms; leaving both trigger and catalog closes it after 120ms. Clicking the descendant-count trigger opens and pins its catalog, or closes an already pinned catalog. The icon-only count trigger does not open on hover, including when a pending hover crosses into the narrow layout. Clicking toggles its pinned menu; ArrowDown opens and pins the menu and focuses its first row. Outside click or Escape dismisses a pinned menu. Clicking moves focus into the panel, where ArrowDown/Home enters the first tree row and ArrowUp/End enters the last; Escape returns focus when it was inside. Breadcrumb-title clicks navigate to the corresponding conversation. +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 text-visible header trigger vertically centers its activity glyph and count with a 4px gap. The trailing column stacks total durable provider usage above active-turn duration. Keyboard navigation works with ArrowRight/ArrowLeft to expand and collapse branches and ArrowUp/ArrowDown, Home, End, and Escape to navigate or close the tree. 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; 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. ### Continuing a conversation @@ -61,17 +61,17 @@ The [subagent runtime](../../subagent/subagent/README.md) owns continuation and ### Catalog derivation -The header lineage renderer reads `projectionsBySession` through the standard `useSessions` hook. The renderer selects `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 menu 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 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. -Each header entry declares a footer slot below its tree. Optional UI contributes there within the same scroll container; the catalog owns opening and dismissal. CSS anchors keep the panel attached to its trigger 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 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. -Opening a catalog dropdown does not request its root catalog. Child-catalog expansion and failed-read retries call `refreshProjection`; shared projection-value changes update the display automatically. +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. Breadcrumb addresses derive from the Provider-bound Session address, loaded parent catalogs, or already-listed subagent lineage, including never-selected ancestors. ### Duration, completion, and tokens -Each visible catalog level advances its own clock while it contains a running child; collapsing the level or closing the menu releases that clock. Token totals sum the four disjoint `tokenUsage` buckets. The `subagentTiming` projection sums completed-turn duration and supplies `latestTurnCompleted` for both the success dot and completed count; opening another turn clears that completion until its own `turn/end`. Duration advances once per second only for an open turn on a running child and freezes after the child becomes inactive; an interrupted open turn is bounded by its same-cut `active.through`, never by newer session metadata. +Each visible catalog level advances its own clock while it contains a running child; collapsing the level, hiding the panel, or closing the switcher menu releases that clock. Token totals sum the four disjoint `tokenUsage` buckets. The `subagentTiming` projection sums completed-turn duration and supplies `lastTurnCompleted` for both the success dot and completed count; opening another turn clears that completion until its own `turn/end`. Duration advances once per second only for an open turn on a running child and freezes after the child becomes inactive; an interrupted open turn is bounded by its same-cut `active.through`, never by newer session metadata. ### Composer election @@ -79,7 +79,7 @@ One-shot and unknown-mode children elect a read-only composer. Continuable child Unknown-mode catalog rows remain visible and clickable, using the child id when no label is available. Their composer is read-only until child history establishes a supported mode; a read failure is reported in the child conversation. -Lineage-menu highlights follow the [standard menu edge geometry](../../../docs/ui-radius.md#nested-hover). Each branch disclosure target covers its 28px left gutter and full row height without overlapping adjacent rows; only the 12px glyph rotates in place, and disclosure clicks do not trigger row or sidebar navigation. Disclosure hover highlights only its arrow; navigation-body hover and keyboard focus retain their background highlight. Thin level-3 border connectors align with the first-line glyph centers, cross reserved disclosure space to reach leaf status glyphs, and end the final vertical stem at its glyph center. +Catalog row highlights use the standard menu item radius from the [nested geometry rules](../../../docs/ui-radius.md#nested-hover). Each branch disclosure target covers its 28px left gutter and full row height without overlapping adjacent rows; only the 12px glyph rotates in place, and disclosure clicks do not trigger row or sidebar navigation. Disclosure hover highlights only its arrow; navigation-body hover and keyboard focus retain their background highlight. Thin level-3 border connectors align with the first-line glyph centers, cross reserved disclosure space to reach leaf status glyphs, and end the final vertical stem at its glyph center.
@@ -90,7 +90,8 @@ Lineage-menu highlights follow the [standard menu edge geometry](../../../docs/u These pages cover the conversation surface, the host seam, and the design notes. -- [ui-conversation](../ui-conversation/README.md) — the chat surface hosting the header action and composer chain. +- [ui-conversation](../ui-conversation/README.md) — the chat surface hosting the breadcrumb lineage and composer chain. +- [ui-session-panel](../ui-session-panel/README.md) — the Session panel hosting the Subagents section. - [ui-input-trigger](../ui-input-trigger/README.md) — the suggestion machinery hosting the `@` source. - [subagent](../../subagent/subagent/README.md) — the host-side capability seam behind continuable children. - [historical Web subagent conversations](../../../.agents/notes/archived/feature/2026-07-27-web-subagent-conversations.md) — the catalog and composer specification. diff --git a/packages/client/ui-subagent/README.zh.md b/packages/client/ui-subagent/README.zh.md index 52d9abc110..fe08322261 100644 --- a/packages/client/ui-subagent/README.zh.md +++ b/packages/client/ui-subagent/README.zh.md @@ -1,5 +1,5 @@ --- -description: "dsh Web 客户端的 subagent 对话目录、续接路由 UI 与 '@' 引用 source。" +description: "dsh Web 客户端会话面板中的 subagent 对话目录、面包屑同级切换器、续接路由 UI 与 '@' 引用 source。" kind: "package-reference" --- @@ -9,7 +9,7 @@ kind: "package-reference" ## 概述 -从父会话页头浏览本地子代理对话与外部任务。本地对话展示活跃状态、token 用量和耗时;可继续子代理接受后续提示词并支持 Stop。外部任务显示为不可打开的叶子项,不展示执行状态。历史一次性对话以只读记录打开。普通侧边栏省略子代理对话;独立的 `@` 来源插入运行中子代理的标签,不授予继续执行权限。 +在会话面板的「子智能体」分栏中浏览本地子代理对话与外部任务,并从子会话的面包屑切换同级子代理。本地对话展示活跃状态、token 用量和耗时;可继续子代理接受后续提示词并支持 Stop。外部任务显示为不可打开的叶子项,不展示执行状态。历史一次性对话以只读记录打开。普通侧边栏省略子代理对话;独立的 `@` 来源插入运行中子代理的标签,不授予继续执行权限。 ## 目录 @@ -25,21 +25,21 @@ kind: "package-reference" ## 使用本包 -会话页头的普通面包屑使用会话标题。subagent 面包屑优先使用创建时的原始描述(`entry.label`),其次使用智能体名称(`entry.name`),最后回退到 Session id。普通与 subagent 面包屑标题均使用 14px 文字和 20px 行高。当会话的直接目录有子项或读取失败时,后代数量触发器渲染在页头操作区中预设标签之后,不带任何面包屑分隔符。目录缺席或为空时隐藏数量触发器,除非根 Session 已开启且可用的 Team 任务板有共享任务或任务记录错误。仅开启 Team 模式不会显示空入口。触发器打开该直接目录,以总数作为无障碍名称、运行数作为无障碍描述,并且只在行展开时加载嵌套目录。选择任意深度,即可用该子会话的确切 `{parentSessionId, childSessionId, mode}` 地址打开其对话;也可以使用非当前本地行的行尾箭头在右侧 Sidebar 打开同一地址,并在空间允许时优先使用独立分栏。 +会话页头的普通面包屑使用会话标题。subagent 面包屑优先使用创建时的原始描述(`entry.label`),其次使用智能体名称(`entry.name`),最后回退到 Session id。普通与 subagent 面包屑标题均使用 14px 文字和 20px 行高。每个 subagent 面包屑标题都是覆盖其父会话直接目录的切换器,并把该标题对应的 Session 标为当前项;根 Session 没有切换器。[会话面板](../ui-session-panel/README.zh.md#contribute-a-section)分栏 `subagents`(order 200,标题为“子智能体”)在根会话和子会话中都列出当前 Session 的直接目录,前提是目录有子项或读取失败;只在行展开时加载嵌套目录。目录缺席或为空时,分栏连同标题一起隐藏,除非存在可用的 footer 扩展,且 Session 已开启的 `agentTeam` 投影含有未删除的共享任务或任务记录错误。仅开启 Team 模式不会显示空分栏。选择任意深度的本地 child,即可用该子会话的确切 `{parentSessionId, childSessionId, mode}` 地址打开其对话;也可以使用非当前本地行的行尾箭头在右侧 Sidebar 打开同一地址,并在空间允许时优先使用独立分栏。两种操作都会关闭面板浮层或该行所在的切换器菜单。 本包注册 `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 与宽度控制。 -每个打开的目录菜单宽度均为 360px,外层内边距为 6px,并受布局视口可用宽度约束。仅当 Team 模式已开启、存在至少一个未删除的共享任务且 footer 扩展可用时,根菜单才显示不可折叠的“子智能体”和“共享任务”标题。“子智能体”标题使用 Users 图标,仅统计直接条目,依次显示已完成、进行中、未运行和外部任务数量;省略零值,分隔符与输入区任务列表一致。外部任务不计入运行中或已完成数量。空的“子智能体”区域仅在同时展示共享任务时显示“暂无子智能体”。Team 模式关闭或没有共享任务时,菜单仅显示 subagent 列表,不显示区域标题、共享任务模块、空状态文案或分隔线;真实的任务记录错误仍以独立警告显示。共享任务上方保留 4px 外边距,不显示分隔线。两个区域标题均保留 7px 图标与文字间距,并在统计数量前额外留出 4px。仅菜单本身滚动,各区域不单独滚动。在兼容 WebKit 的浏览器中,原生 5px 滚动条位于右侧 6px 内边距内,轨道两端内缩,并保留稳定的滚动条空间,使内容在需要滚动时保持原有宽度。其他浏览器保留标准原生滚动条。 +分栏的标题控件(`conversation.session.panel.section.actions`,键为 `subagents`)显示直接成员进度:依次为已完成、进行中、未运行和外部任务数量;省略零值,分隔符与输入区任务列表一致。外部任务不计入运行中或已完成数量。目录加载为空、分栏因共享任务或任务记录错误而显示时,在其上方显示“暂无子智能体”;Session 列表尚未持有目录时,显示“正在加载子智能体…”。会话面板负责分栏滚动,目录树不单独滚动。面包屑切换器菜单宽度为 360px,外层内边距为 6px,并受布局视口可用宽度约束,仅菜单本身滚动。在兼容 WebKit 的浏览器中,其原生 5px 滚动条位于右侧 6px 内边距内,轨道两端内缩,并保留稳定的滚动条空间,使内容在需要滚动时保持原有宽度。其他浏览器保留标准原生滚动条。 -根会话目录通过 `conversation.session.header.actions.subagent.footer` 提供共享任务扩展。子会话与祖先面包屑目录只显示导航,不显示区域标题。 +「子智能体」分栏在目录树下方提供 `conversation.session.panel.subagents.footer` 列表插槽,用于共享任务,并且仅在该插槽有注册时渲染它。面包屑切换器菜单只显示导航。 -宽布局下,根会话数量触发器在没有运行中 child 时,于 14px 图标位内显示 14px Users 图标,否则显示共享 ongoing loader,不带下拉箭头。标题行变窄时,静态预设文字在宽度不超过 540px 时隐藏,数量文字在不超过 460px 时隐藏。紧凑触发器始终显示 Users 图标,包括 child 运行期间;运行指示器仍在菜单内显示。它与更多及侧边栏控件一致:28×28px 操作区域,无内边距,15px 图标位内显示 15px 图标,使用次级前景色以及 ghost 悬停和按下背景。页头操作在紧凑布局中间距为 8px,宽布局中为 10px。纯图标工具提示提供完整数量。调整宽度不会丢失触发器焦点。subagent 切换器保留描述优先的文本与原有图标。 +切换器标题最宽 244px,超出时以省略号截断,后接上下双向箭头图标。当前 Session 的标题使用主前景色、字重 500;祖先标题使用三级前景色、常规字重。 ### 浏览目录 -数量、负责人及侧边栏操作的工具提示在悬停 500ms 后显示。悬停文字可见的触发器 150ms 后打开目录;指针离开触发器和目录后,经过 120ms 关闭。点击后代数量触发器会打开并固定目录,或关闭已固定的目录。纯图标数量触发器不会因悬停而打开,包括等待悬停打开期间切换到窄布局的情况。点击可切换固定菜单的开关状态;ArrowDown 会打开并固定菜单,并将焦点移至首行。点击外部或按 Escape 可关闭已固定的菜单。点击会将焦点移入面板,此时 ArrowDown/Home 进入首个树行,ArrowUp/End 进入最后一个树行;Escape 在焦点原本位于面板内时将其送回。点击面包屑标题会导航至对应会话。 +侧边栏操作的工具提示在悬停 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 状态对齐。文字可见的页头触发器会垂直居中活动图标与数量,并保留 4px 水平间距。尾随列在上行显示提供方的持久化 token 用量总计,在下行显示活跃轮次耗时。键盘导航:ArrowRight/ArrowLeft 展开和折叠分支;ArrowUp/ArrowDown、Home、End 与 Escape 用于导航或关闭树。没有 label 的 one-shot 行回退到其会话 id。只有一行自身的目录加载为空后,它才是已知叶子。 +目录行在智能体名称上方显示创建描述,缺少创建描述时使用可用的 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。只有一行自身的目录加载为空后,它才是已知叶子。 ### 续接对话 @@ -61,17 +61,17 @@ kind: "package-reference" ### 目录派生 -页头谱系 renderer 通过标准 `useSessions` 钩子读取 `projectionsBySession`。renderer 从每个 Session 的共享值中选择 `subagentCatalog`,用于成员关系、展开控件与数量。活动状态优先使用统一 UI status,缺少时使用 Session 摘要;摘要提供标题与用量。展开行读取目标投影,包括普通冷历史。列表行的 `formatStatus` 为 `migration-required` 时,行在展开前即显示“需要迁移”,保留打开历史的操作,但不能展开下级,也不改变子会话的 mode;投影读取需要迁移且缺少目录时,也显示同一提示。打开会话后,历史与 control 投影提供其目录。其他情况下,已有目录仍可使用,包括显式空目录。实时 projection 帧更新所有已加载层级,无需菜单订阅或重复成员查询。其他行在目录缺席、加载中或失败时保持可展开,并在目录就绪且为空后成为已知叶子。外部行始终为叶子,不加载子 Session。 +「子智能体」分栏、其进度控件与面包屑切换器通过标准 `useSessions` 钩子读取 `projectionsBySession`,并从每个 Session 的共享值中选择 `subagentCatalog`,用于成员关系、展开控件与数量。活动状态优先使用统一 UI status,缺少时使用 Session 摘要;摘要提供标题与用量。展开行读取目标投影,包括普通冷历史。列表行的 `formatStatus` 为 `migration-required` 时,行在展开前即显示“需要迁移”,保留打开历史的操作,但不能展开下级,也不改变子会话的 mode;投影读取需要迁移且缺少目录时,也显示同一提示。打开会话后,历史与 control 投影提供其目录。其他情况下,已有目录仍可使用,包括显式空目录。实时 projection 帧更新所有已加载层级,无需逐树订阅或重复成员查询。其他行在目录缺席、加载中或失败时保持可展开,并在目录就绪且为空后成为已知叶子。外部行始终为叶子,不加载子 Session。 -每个页头入口在树下方声明 footer 插槽。可选 UI 通过该插槽加入同一滚动容器;目录负责打开和关闭。CSS 锚点让面板跟随触发器,并按布局视口限制尺寸。浏览器缩放和平移时面板随页面移动,因此可以超出视觉视口。内部滚动、悬停行为、点击固定展开和焦点恢复保持独立。 +分栏注册在目录树下方声明 footer 插槽。可选 UI 通过该插槽加入,并随会话面板滚动;会话面板负责显示和关闭分栏。切换器菜单是挂载到 body 的 `MenuSurface`;CSS 锚点让菜单跟随其标题,并按布局视口限制尺寸。浏览器缩放和平移时菜单随页面移动,因此可以超出视觉视口。内部滚动、悬停行为、点击固定展开和焦点恢复保持独立。 -打开目录下拉菜单不会请求其根目录。展开子节点目录或重试失败读取时调用 `refreshProjection`;共享投影值的变化会自动更新显示。 +显示分栏或打开切换器菜单不会请求根目录。展开子节点目录或重试失败读取时调用 `refreshProjection`;共享投影值的变化会自动更新显示。 面包屑地址从 Provider 所绑定的 Session 地址、已加载的 parent 目录或已列出的 subagent 谱系推导,也包括从未选中过的祖先。 ### 耗时、完成状态与 token -每个可见目录层在包含运行中 child 时独立推进时钟;折叠该层或关闭菜单会释放时钟。token 用量总计为四个互不重叠的 `tokenUsage` 桶之和。`subagentTiming` 投影会累加已结束轮次的耗时,并提供 `latestTurnCompleted`,用于成功圆点与已完成数量;新轮次开始时会清除该完成状态,直到自身的 `turn/end` 到达。耗时仅在运行中 child 存在未结束轮次时每秒递增一次,并在 child 变为 inactive 后冻结;被中断的未结束轮次以其同一切面的 `active.through` 为上界,绝不使用更新的会话元数据。 +每个可见目录层在包含运行中 child 时独立推进时钟;折叠该层、隐藏面板或关闭切换器菜单会释放时钟。token 用量总计为四个互不重叠的 `tokenUsage` 桶之和。`subagentTiming` 投影会累加已结束轮次的耗时,并提供 `lastTurnCompleted`,用于成功圆点与已完成数量;新轮次开始时会清除该完成状态,直到自身的 `turn/end` 到达。耗时仅在运行中 child 存在未结束轮次时每秒递增一次,并在 child 变为 inactive 后冻结;被中断的未结束轮次以其同一切面的 `active.through` 为上界,绝不使用更新的会话元数据。 ### 编辑器选举 @@ -79,7 +79,7 @@ one-shot 和模式未知的 child 选用只读编辑器。可继续 child 经由 模式未知的目录项仍可见、可点击,没有标签时显示子会话 id。读取子历史并确认受支持模式前,输入区保持只读;读取失败在该子会话中报告。 -会话树菜单高亮遵循[标准菜单边缘几何](../../../docs/ui-radius.zh.md#nested-hover)。每个分支展开控件的点击区域覆盖左侧 28px 空间与所在行的完整高度,不与相邻行重叠;仅原位的 12px 图标旋转,点击展开控件不会触发行导航或侧边栏导航。悬停展开控件仅高亮箭头;悬停导航主体或键盘聚焦时仍保留背景高亮。细连接线使用三级边框颜色,与首行图标中心对齐,跨过预留的展开控件空间连接叶子状态图标,末端竖线止于对应图标中心。 +目录行高亮使用[嵌套几何规则](../../../docs/ui-radius.zh.md#nested-hover)中的标准菜单项圆角。每个分支展开控件的点击区域覆盖左侧 28px 空间与所在行的完整高度,不与相邻行重叠;仅原位的 12px 图标旋转,点击展开控件不会触发行导航或侧边栏导航。悬停展开控件仅高亮箭头;悬停导航主体或键盘聚焦时仍保留背景高亮。细连接线使用三级边框颜色,与首行图标中心对齐,跨过预留的展开控件空间连接叶子状态图标,末端竖线止于对应图标中心。
@@ -90,7 +90,8 @@ one-shot 和模式未知的 child 选用只读编辑器。可继续 child 经由 以下页面覆盖对话界面、宿主 seam 与设计笔记。 -- [ui-conversation](../ui-conversation/README.zh.md)——承载页头操作与编辑器链的聊天界面。 +- [ui-conversation](../ui-conversation/README.zh.md)——承载面包屑谱系与编辑器链的聊天界面。 +- [ui-session-panel](../ui-session-panel/README.zh.md)——承载「子智能体」分栏的会话面板。 - [ui-input-trigger](../ui-input-trigger/README.zh.md)——承载 `@` source 的建议机制。 - [subagent](../../subagent/subagent/README.zh.md)——可继续 child 背后的宿主能力 seam。 - [历史Web subagent 对话](../../../.agents/notes/archived/feature/2026-07-27-web-subagent-conversations.md)——目录与编辑器规范。 diff --git a/packages/client/ui-subagent/src/client/SubagentCatalog.tsx b/packages/client/ui-subagent/src/client/SubagentCatalog.tsx index 98a35ed536..b218abf9b6 100644 --- a/packages/client/ui-subagent/src/client/SubagentCatalog.tsx +++ b/packages/client/ui-subagent/src/client/SubagentCatalog.tsx @@ -45,7 +45,12 @@ interface CatalogRowsProps { closeCatalog: () => void } -function treeItems(root: HTMLElement): HTMLElement[] { +/** + * List the focusable rows of a catalog tree in display order. + * @param root - the tree or an element that contains it. + * @returns the rows that accept focus. + */ +export function treeItems(root: HTMLElement): HTMLElement[] { return Array.from(root.querySelectorAll('[role="treeitem"]:not([aria-disabled="true"])')) } diff --git a/packages/client/ui-subagent/src/client/SubagentHeaderLineage.tsx b/packages/client/ui-subagent/src/client/SubagentHeaderLineage.tsx index 2179934a72..8db6e9192e 100644 --- a/packages/client/ui-subagent/src/client/SubagentHeaderLineage.tsx +++ b/packages/client/ui-subagent/src/client/SubagentHeaderLineage.tsx @@ -6,7 +6,9 @@ import { MenuSurface } from '@deepseek-ai/dsh-client-ui-primitives' import type { InjectFace, PropsLocale, PropsRuntime, TranslateNS } from '@deepseek-ai/dsh-client-ui-slots' import { NS } from './locales.ts' import type {} from '@deepseek-ai/dsh-client-ui-conversation/client' -import { CatalogTree, deriveCatalogs, entryName, type SubagentCatalogInjected, type SubagentCatalogSnapshot } from './SubagentCatalog.tsx' +import { + CatalogTree, deriveCatalogs, entryName, treeItems, type SubagentCatalogInjected, type SubagentCatalogSnapshot, +} from './SubagentCatalog.tsx' import css from './SubagentCatalog.module.css' export type { SubagentCatalogInjected } from './SubagentCatalog.tsx' @@ -160,6 +162,16 @@ function Switcher({ tabIndex={-1} aria-label={t('tree.aria')} data-subagent-panel + onKeyDown={(event) => { + // A pinned menu takes focus itself; the tree handles keys once a row has focus. + if (event.target !== event.currentTarget) return + const items = treeItems(event.currentTarget) + const row = event.key === 'ArrowDown' || event.key === 'Home' ? items[0] + : event.key === 'ArrowUp' || event.key === 'End' ? items.at(-1) : undefined + if (row === undefined) return + event.preventDefault() + row.focus() + }} onPointerEnter={(event) => { if (event.pointerType !== 'touch') cancelHover() }} onPointerLeave={hoverOut} > 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 3b39f187f0..044226ce46 100644 --- a/packages/client/ui-subagent/tests/conversation-ui.client.spec.tsx +++ b/packages/client/ui-subagent/tests/conversation-ui.client.spec.tsx @@ -1283,6 +1283,25 @@ describe('breadcrumb switcher', () => { expect(document.activeElement).toBe(switcher) }) + it('moves focus from a pinned menu into the tree with the arrow, Home, and End keys', async () => { + render() + fireEvent.click(screen.getByRole('button', { name: '切换子智能体:worker' })) + await act(async () => { await Promise.resolve() }) + const menu = screen.getByRole('dialog') + const rows = within(menu).getAllByRole('treeitem') + expect(document.activeElement).toBe(menu) + fireEvent.keyDown(menu, { key: 'Enter' }) + expect(document.activeElement).toBe(menu) + for (const [key, row] of [['ArrowDown', rows[0]], ['End', rows.at(-1)], ['Home', rows[0]], ['ArrowUp', rows.at(-1)]] as const) { + menu.focus() + fireEvent.keyDown(menu, { key }) + expect(document.activeElement).toBe(row) + } + // Keys from a row stay with the tree's own navigation. + fireEvent.keyDown(rows.at(-1) as HTMLElement, { key: 'Home' }) + expect(document.activeElement).toBe(rows[0]) + }) + it('closes on Escape from the page without moving focus, and after a row opens a Session', () => { const input = childInput() render()