Merge remote-tracking branch 'origin/master' into turtle/clean-empty-catch-69cac4a2ccee

This commit is contained in:
Turtle committed 2026-11-16 12:01:22 +08:00
commit cb92e8d6cf
742 files changed
+12975 -6105

No files matched your search

@@ -9,8 +9,8 @@
en: 44615a7a0939054e
zh: b8efa721321ba0d7
/agent-note-creator-mode-installs-persistent-plugin-bundles/decision:
en: 38ecabc170c418c7
zh: d380f53fa508328e
en: 013a2088d8f8c435
zh: 5491ff817716696b
/agent-note-creator-mode-installs-persistent-plugin-bundles/alternatives-considered:
en: af527d8aabdfd59c
zh: 34388da992d2ab56
@@ -14,7 +14,7 @@ Creator mode enables the existing `plugin_manager` tool. Agents author packages
The default Standard mode enables the same tool under the same profile condition and approval gate. Without it, Standard sessions did not install plugins directly and spent extra turns and tokens working around the missing tool; the change also moves Standard and Creator toward one capability set. A full-access Standard session can therefore install Host code without a separate prompt, as its shell already can. PTC and Minimal keep the tool disabled.
The model sees two read-only Cordis inspection tools. Generated-code define/run/stop/undefine and dynamic self-inspection tool APIs are absent. Existing runtime and Client consumers retain their services; historical session cards remain readable. This supersedes only the model-facing mutation workflow in the [self-referential toolset reference](../../../../packages/extensions/cordis-host-runner/README.md); its runtime ownership and sandbox rationale remain independently relevant. The [profile transaction decision](2026-09-14-current-profile-plugin-management.md) continues to govern locking, package installation, and partial failures.
Standard and Creator expose one read-only Cordis inspection tool, `cordis_inspect`. Omitting `query` discovers providers; supplying `query` reads one declared method. The shared entry keeps runtime discovery available in the default mode without duplicating tool descriptions. Generated-code define/run/stop/undefine and dynamic self-inspection tool APIs are absent. Existing runtime and Client consumers retain their services; historical session cards remain readable. This supersedes only the model-facing mutation workflow in the [self-referential toolset reference](../../../../packages/extensions/cordis-host-runner/README.md); its runtime ownership and sandbox rationale remain independently relevant. The [profile transaction decision](2026-09-14-current-profile-plugin-management.md) continues to govern locking, package installation, and partial failures.
Visual creation requests default to an installed Client plugin rendered in the current Web page unless the user names another destination. The development skill supplies a minimal package and effect-owned Client registration. Discovery ends when the required APIs are known; a working first version is installed before optional visual refinement. Verification uses the connected page where available. Browser authentication or operating-system setup is not a prerequisite for plugin installation, and a mock preview cannot establish an in-app result.
@@ -14,7 +14,7 @@ agent 需要安装能力并在同一段对话中使用。生成代码工具在
默认的标准模式以相同的 profile 条件和审批门槛启用同一工具。缺少该工具时,标准模式会话不会直接安装插件,而要额外花费轮次和 token 绕过;此改动也让标准模式和创造模式朝同一能力集收敛。因此,完整权限的标准模式会话无需单独审批即可安装 Host 代码,与其 shell 已有的能力一致。PTC 和 Minimal 仍禁用该工具。
模型可见两个只读 Cordis 检查工具,不再提供生成代码的 define/run/stop/undefine 和动态自省工具 API。现有运行时和 Client 消费者保留其服务;历史会话卡片仍然可读。这仅取代[自引用工具集参考](../../../../packages/extensions/cordis-host-runner/README.zh.md)中的模型侧变更流程;其运行时所有权和沙箱依据仍有独立价值。[profile 事务决策](2026-09-14-current-profile-plugin-management.zh.md)继续规定锁、包安装和部分失败行为。
标准模式和创造模式提供一个只读 Cordis 检查工具 `cordis_inspect`。省略 `query` 以发现 provider;提供 `query` 以读取一个已声明的方法。共用此入口使默认模式能够进行运行时发现,同时避免重复的工具描述。不再提供生成代码的 define/run/stop/undefine 和动态自省工具 API。现有运行时和 Client 消费者保留其服务;历史会话卡片仍然可读。这仅取代[自引用工具集参考](../../../../packages/extensions/cordis-host-runner/README.zh.md)中的模型侧变更流程;其运行时所有权和沙箱依据仍有独立价值。[profile 事务决策](2026-09-14-current-profile-plugin-management.zh.md)继续规定锁、包安装和部分失败行为。
除非用户指定其他目标,视觉创建请求默认通过已安装的 Client 插件显示在当前 Web 页面。开发 skill 提供最小包和由 effect 管理的 Client 注册示例。已知所需 API 后结束探查,在可选视觉优化之前先安装能工作的初版。有条件时使用已连接页面验证。浏览器认证或操作系统设置不是安装插件的前提,mock 预览不能证明应用内结果。
@@ -30,8 +30,8 @@
en: 99ee505e82fa9c7c
zh: 448bc0e160424cbf
/agent-note-boot-the-preview-worker-from-the-shipped-profile-and-fetch-lazy-chunks-on-demand/consequences:
en: 53d72faa09e78410
zh: a5224e4662a4846b
en: ed424571c81bcb91
zh: 9b79bf03741c1c21
/agent-note-boot-the-preview-worker-from-the-shipped-profile-and-fetch-lazy-chunks-on-demand/testing:
en: 532918df1acd147d
zh: e476c090d183d0a4
@@ -81,7 +81,7 @@ The Worker's structural stubs throw errors carrying `ERR_FEATURE_UNAVAILABLE_ON_
## Consequences
The Preview boots the composition the served Web deployment boots. With no bundle enabled, the Worker composition differs from the served Web composition only by the jsonl platform override, and enabling any bundle skips no patch. The Plugins page and Settings → Built-in plugins list every `OPTIONAL_BUNDLES` entry with its title and icon and no metadata error. Switching each of the 11 optional bundles on and then off returns `applied` both times; after enabling, every enabled row it changes is active, and after disabling, the plugin list returns to its prior rows. Enabling session-titles disables `@deepseek-ai/dsh-session-title-first-prompt-llm` (row `session-title-llm`) and enables `@deepseek-ai/dsh-session-title-all-prompts-llm`, as in the served Web deployment; enabling inspector-profile runs Session Inspector and starts the NodeJS Inspector degraded. Degradation requires `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`, so a served `dsh web` runs the full Inspector.
The Preview boots the composition the served Web deployment boots. With no bundle enabled, the Worker composition differs from the served Web composition only by the jsonl platform override, and enabling any bundle skips no patch. The Plugins page lists every `OPTIONAL_BUNDLES` entry with its title and icon and no metadata error. Switching each of the 11 optional bundles on and then off returns `applied` both times; after enabling, every enabled row it changes is active, and after disabling, the plugin list returns to its prior rows. Enabling session-titles disables `@deepseek-ai/dsh-session-title-first-prompt-llm` (row `session-title-llm`) and enables `@deepseek-ai/dsh-session-title-all-prompts-llm`, as in the served Web deployment; enabling inspector-profile runs Session Inspector and starts the NodeJS Inspector degraded. Degradation requires `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`, so a served `dsh web` runs the full Inspector.
Size (MiB, measured): the base image is 9.20 (12.79 with pack-time composition and eager chunks, −28%) including 11 optional bundles, plus 5 lazy tar archives totaling 4.45 (pdf 2.88, excel 1.39, terminal 0.13, frontmatter 0.05, Inspector bottom panel 0.00). The base image contains no lazily loaded chunk, and the page fetches an archive only when it requests the chunk.
@@ -81,7 +81,7 @@ Worker 的结构化 stub 抛出带 `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` 的错
## 后果
Preview 启动的组合与正式 Web 相同。不开 bundle 时,Worker 组合与正式 Web 只差 jsonl 的平台覆盖;开任一 bundle 都没有被跳过的补丁。插件页和“设置 → 内置插件”列出全部 `OPTIONAL_BUNDLES`,每个都显示标题和图标,没有元信息错误。11 个 optional bundle 逐个开启再关闭,两次都返回 `applied`;开启后它改动的每个启用行都是 active,关闭后插件列表恢复原样。启用 session-titles 会禁用 `@deepseek-ai/dsh-session-title-first-prompt-llm`(行 `session-title-llm`)并启用 `@deepseek-ai/dsh-session-title-all-prompts-llm`,与正式 Web 一致;启用 inspector-profile 后 Session Inspector 运行,NodeJS Inspector 降级启动。降级以 `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` 为前提,所以正常 `dsh web` 运行完整的 Inspector。
Preview 启动的组合与正式 Web 相同。不开 bundle 时,Worker 组合与正式 Web 只差 jsonl 的平台覆盖;开任一 bundle 都没有被跳过的补丁。插件页列出全部 `OPTIONAL_BUNDLES`,每个都显示标题和图标,没有元信息错误。11 个 optional bundle 逐个开启再关闭,两次都返回 `applied`;开启后它改动的每个启用行都是 active,关闭后插件列表恢复原样。启用 session-titles 会禁用 `@deepseek-ai/dsh-session-title-first-prompt-llm`(行 `session-title-llm`)并启用 `@deepseek-ai/dsh-session-title-all-prompts-llm`,与正式 Web 一致;启用 inspector-profile 后 Session Inspector 运行,NodeJS Inspector 降级启动。降级以 `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` 为前提,所以正常 `dsh web` 运行完整的 Inspector。
体积(MiB,实测):基础镜像 9.20(打包期组合且 chunk 随启动下载时为 12.79,−28%),含 11 个 optional bundle;另有 5 个 lazy tar 共 4.45(pdf 2.88、excel 1.39、terminal 0.13、frontmatter 0.05、inspector 底部面板 0.00)。基础镜像不含懒加载 chunk,页面请求 chunk 时才拉取对应 archive。
@@ -0,0 +1,28 @@
# Bilingual-pair consistency record for 2026-11-05-session-panel.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 .agents/notes/implemented/feature/2026-11-05-session-panel.md
/agent-note-session-panel-in-the-chat-view-s-end-gutter:
en: 1dc9957a0c9336e0
zh: 88d41c8490c2710c
/agent-note-session-panel-in-the-chat-view-s-end-gutter/problem:
en: c69d9843bc6f0b87
zh: c31bb1b2b4d9b781
/agent-note-session-panel-in-the-chat-view-s-end-gutter/decision:
en: c2ddf417ea56b626
zh: 44c30091ade7e5bf
/agent-note-session-panel-in-the-chat-view-s-end-gutter/decision/docking-follows-the-transcript-gutter:
en: 8a97ac8ac0b40d0c
zh: d42fe9c23b9dcd79
/agent-note-session-panel-in-the-chat-view-s-end-gutter/decision/sections-are-registrations-the-panel-draws-titles:
en: d6f85e07351ad90e
zh: f883a99c8ca98522
/agent-note-session-panel-in-the-chat-view-s-end-gutter/decision/the-turn-rail-sits-at-the-start-edge:
en: 08e720a4ea75d4d6
zh: 5e2e5b8452f67d36
/agent-note-session-panel-in-the-chat-view-s-end-gutter/alternatives-considered:
en: 6adaf7a36da05668
zh: c0ace7297995d764
/agent-note-session-panel-in-the-chat-view-s-end-gutter/consequences:
en: 6c2f625c9c36ebd0
zh: 0060e818dbf233ce
@@ -0,0 +1,49 @@
# Agent Note: Session panel in the Chat View's end gutter
Status: implemented
English | [中文](2026-11-05-session-panel.zh.md)
## Problem
Facts about the current Session — its project directory, the change requests it opened, and later its outputs — had no common home. Each owner added its own Session header button and, for anything larger than a menu, a right-sidebar tab: the forge change requests are one such tab. A sidebar tab takes width from the transcript while it shows, shows one tab at a time, and leaves the facts one click away from every message. The required surface is a summary the user can keep beside the conversation without covering it, that several plugins fill independently, that hides when there is no room, and that the user can show or hide from the Session header.
## Decision
[`dsh-client-ui-session-panel`](../../../../packages/client/ui-session-panel/README.md) adds a Session header toggle (`conversation.session.header.utilities`, order −10) and a floating panel that occupies `conversation.chat.aside`, a slot that [`ui-chat`](../../../../packages/client/ui-chat/README.md#scroll-ownership) renders in the Chat View beside the turn rail. The aside is a zero-height layer at the top of the Chat frame and, like the turn rail, is sticky inside the shared scrollport: the panel does not scroll with the transcript, inherits the scrollport's composer and viewport heights, and needs no seat in the Conversation shell. Views other than Chat show no panel.
### Docking follows the transcript gutter
The panel docks only while the gutter between the transcript column and the Chat frame's end edge can hold it (348px: 40px clear of the column and its width handle, a 300px minimum width, and an 8px margin). The gutter, not the viewport width, decides because the column width is adaptive and user-draggable and the right sidebar shares the frame: the same viewport can leave 75px or 600px. The Chat View owns the frame and the transcript column, so its aside layer publishes the gutter as the `--dsh-chat-aside-gutter` custom property, and the panel's stylesheet sizes the docked panel from it.
Script still needs the decision, because docked and overlay differ in behavior and not only in size: the toggle reports `aria-expanded` truthfully and knows whether a press flips docking or opens the overlay, the overlay closes on Escape and on outside presses and returns focus, and an open overlay closes once the panel can dock. A CSS-only container query cannot tell an element outside the Chat View, or a listener, any of that. The stylesheet therefore computes the decision as well: each mounted panel renders a zero-height dock probe that is 1px wide from the gutter that holds the panel's minimum width and 0 below it, derived from the same metrics as the docked width, and the plugin observes only that probe. It hears the decision flip; observing the frame and the transcript column would call back on every frame of a streamed reply, because the column's height changes with its content, and on every step of a window resize. A Session has room to dock while any of its probes does, and a Session without a probe shows no Chat View. The toggle and the panel decide the presentation with the same pure function. While no Chat View shows the Session, as in the trajectory View, the toggle is unavailable and its tooltip asks for the Chat view; `ui-conversation` keeps View selection inside its shell, so the toggle does not switch Views itself.
Docking follows one persisted preference shared by every Session and defaults to on. Without room, a press opens a transient overlay for that Session above the transcript; it never changes the preference, and it closes once its gutter can dock the panel or no Chat View shows the Session any longer, so it never reappears on its own. The panel state follows the reported gutter of the open overlay's Session. A panel withdraws its report when it unmounts or its Chat View moves to another Session, in a layout-effect cleanup kept apart from the gutter update, so a changed gutter never reads as an unmount. Hiding automatically and overlaying on request keeps the transcript uncovered without making the facts unreachable on laptop widths.
### Sections are registrations; the panel draws titles
Each section is one list registration with `id`, `order`, and a required `label`. The panel projects the live registrations into titles, draws each title, and renders the section body with `renderSlot(..., { only: id })`; a CSS `:has()` rule hides a section whose body rendered nothing, so a section opts out by rendering nothing and no effect reports visibility to the owner. Trailing title controls are a keyed slot addressed by the section `id`, and a section that several plugins share declares its own row slot, as the built-in Environment section does with `conversation.session.panel.environment.row`. Marks that must stay visible while the panel is hidden go in an indicator list over the toggle.
Rows from every contributor share one look through the panel's stylesheet instead of a shared component: each contributor writes its row's markup and marks the parts, and the panel lays them out, so icon, text, and trailing areas align across packages. A shared row component would receive each contributor's icon, text, and controls as React nodes in props, which the client rules forbid, and a feature package cannot share its own row component with another feature package.
### The turn rail sits at the start edge
The turn rail sits at the scrollport's start edge with its marks, focus ring, and preview mirrored, leaving the end gutter to the docked panel; its 900px hiding rule guarantees room beside the start-side width handle.
## Alternatives considered
- **A seat in `conversation.content`.** Rejected: it made `ui-conversation` render the panel beside the width handles and outside the scrollport, have its width controls measure the gutter into a per-Session `ctx.uiConversation.layouts` source, and move the composer and viewport height variables from the scrollport to the content body so the seat could read them. The Conversation shell would carry geometry and variable placement for one feature, while chrome that must not scroll can sit sticky inside the scrollport as the turn rail does, and the Chat View already owns the column it would measure.
- **A right-sidebar tab.** It already exists for change requests, but it narrows the transcript while shown, shows one tab at a time, and the [UI guidance](../../../skills/dsh-client-ui-ux/SKILL.md#reuse-before-adding) reserves the sidebar for content opened on demand rather than a resident summary.
- **The dock kit's floating window.** `FloatLayer` windows are draggable, resizable, and positioned in viewport coordinates; a summary anchored to the transcript gutter needs none of that and would have to fight the window's own placement rules.
- **Viewport-width breakpoints.** The transcript width is adaptive and draggable and the right sidebar takes a variable track, so a viewport breakpoint either covers the transcript or hides the panel with room to spare.
- **CSS-only hiding with a click-time read.** A container query on the gutter can hide the docked panel, and the toggle could read the computed result when pressed, as the background-job trigger does. The toggle would still render without knowing whether the panel shows, so `aria-expanded` and its tooltip would be wrong whenever the preference says dock but the gutter is too narrow.
- **Squeezing the transcript to make room.** Docking on laptop widths by moving the transcript column aside changes the centered column, the composer, and both width handles; it remains a separate layout decision.
- **A Session-scoped standard hook for the gutter.** Adding a hook to every Session-scoped Slot would make every component fixture in the client restate it; the docking decision has two readers, the panel and the toggle, and both read it from the plugin's own state.
## Consequences
- With the default transcript width, which stops at 880px, the body must be 1576px wide to dock, so laptop widths use the overlay; the panel never covers the transcript unless the user opens it.
- 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.
- `ui-chat` gained one slot and one custom property on its layer and observes nothing for them. Each mounted panel adds one `ResizeObserver` on its dock probe, which calls back only when the docking decision flips. `ui-conversation` caps the default transcript width at 880px.
- The panel shows only in Chat Views; elsewhere the toggle stays in the header, unavailable. Every Chat View occurrence renders the aside, so a Session shown in the main body and in an embedded Conversation at once shows its overlay in both.
- The turn rail's position changed for every user; its behavior and hiding rule did not.
@@ -0,0 +1,49 @@
# Agent Note: 停靠在 Chat 视图末端留白的会话面板
Status: implemented
[English](2026-11-05-session-panel.md) | 中文
## Problem
与当前会话相关的信息(项目目录、它开出的变更请求,以及之后的产物)没有统一的位置。各自的拥有者分别加会话标题栏按钮,内容一多就再开一个右侧栏标签页,forge 的变更请求就是这样一个标签页。侧栏标签页显示时占用正文宽度,一次只显示一个,而且每条消息之外都要多点一次才能看到。需要的界面是:可以放在对话旁边常驻而不遮挡正文;多个插件各自填充;没有空间时自动隐藏;用户可以从会话标题栏显示或隐藏。
## Decision
[`dsh-client-ui-session-panel`](../../../../packages/client/ui-session-panel/README.zh.md) 新增一个会话标题栏开关(`conversation.session.header.utilities`,order −10)和一块悬浮面板,面板占用 `conversation.chat.aside`:这是 [`ui-chat`](../../../../packages/client/ui-chat/README.zh.md#scroll-ownership) 在 Chat 视图中、轮次轨道旁渲染的 slot。侧边层是 Chat 外框顶部的零高度图层,与轮次轨道一样在共享滚动容器内 sticky 定位:面板不随正文滚动,继承滚动容器的输入框区域与视口高度,也不需要 Conversation 外壳提供落位。Chat 以外的视图不显示面板。
### 停靠取决于正文留白
只有正文列到 Chat 外框末端边缘的留白放得下面板时才停靠(348px:与正文列及其宽度拖拽条保持 40px,最小宽度 300px,外加 8px 边距)。判断依据是留白而不是视口宽度,因为正文列宽度可自适应、可由用户拖拽,右侧栏也会占用框架宽度:同一个视口可能只剩 75px,也可能有 600px。Chat 视图持有外框和正文列,因此由它的侧边层把留白发布为自定义属性 `--dsh-chat-aside-gutter`,面板的样式表据此决定停靠宽度。
脚本仍然需要知道这个判断,因为停靠与浮层的差别不只在尺寸,还在行为:开关要如实报告 `aria-expanded`,也要知道按下后是切换停靠还是打开浮层;浮层在按 Esc 或在外部按下时关闭并归还焦点;面板可以停靠后,已打开的浮层要关闭。纯 CSS 的容器查询无法把这些告诉 Chat 视图之外的元素或事件监听器。因此样式表把判断也一并算出:每个已挂载的面板渲染一个零高度的停靠探针,它从放得下面板最小宽度的留白起宽 1px,更窄时宽度为 0,与停靠宽度出自同一组尺寸,插件只观察这个探针。这样插件只在判断翻转时收到通知;如果改为观察外框和正文列,流式回答的每一帧都会回调(正文列的高度随内容变化),窗口缩放的每一步也会回调。会话的任一探针有空间时该会话就可以停靠,没有探针的会话表示没有 Chat 视图在显示它。开关和面板用同一个纯函数决定呈现方式。没有 Chat 视图显示该会话时(例如在轨迹视图中),开关不可用,悬停提示请用户切到「对话」视图;`ui-conversation` 把视图选择留在其外壳内部,因此开关不自行切换视图。
停靠遵循所有会话共用的一个持久化偏好,默认开启。没有空间时,按下开关会为该会话在正文上方打开临时浮层;它从不改变偏好;该会话的留白可以停靠面板,或不再有 Chat 视图显示该会话时,浮层关闭,因此不会自己重新出现。面板状态跟随打开浮层的会话所上报的留白。面板卸载或其 Chat 视图换到另一个会话时撤回上报;撤回放在与留白更新分开的 layout effect 清理中,因此留白变化永远不会被当成卸载。自动隐藏加按需浮层,既保证正文不被遮挡,也让笔记本宽度下的信息依然可达。
### 分栏是注册项;面板绘制标题
每个分栏是一次 list 注册,带 `id`、`order` 和必填的 `label`。面板把实时注册投影成标题并逐个绘制,再用 `renderSlot(..., { only: id })` 渲染分栏正文;CSS `:has()` 规则隐藏正文没有渲染内容的分栏,因此分栏不渲染任何内容即可退出,不需要 effect 向拥有者上报可见性。标题尾部控件是以分栏 `id` 为键的 keyed slot;多个插件共用的分栏声明自己的行 slot,内置「环境」分栏就以 `conversation.session.panel.environment.row` 这样做。面板隐藏时也要可见的标记放进开关上的角标列表。
各贡献方的行通过面板的样式表共享同一外观,而不是共享组件:各贡献方自己写行的标记并标出各个部分,由面板统一排版,使不同包的图标、文字与尾部区域对齐。共享的行组件要把各贡献方的图标、文字和控件作为 React 节点从 props 传入,这是客户端规则禁止的;功能包之间也不能共享各自的行组件。
### 轮次轨道位于起始边
轮次轨道连同刻度、焦点环和预览位于滚动容器的起始边,末端留白留给停靠面板;它的 900px 隐藏规则保证旁边有足够空间容纳起始侧的宽度拖拽条。
## Alternatives considered
- **落位在 `conversation.content`。** 已否决:这种做法让 `ui-conversation` 在宽度拖拽条旁、滚动容器之外渲染面板,由宽度控件把留白测量结果写入按会话划分的 `ctx.uiConversation.layouts` source,并把输入框区域与视口高度变量从滚动容器挪到正文容器上,使落位能读到它们。Conversation 外壳因此要为单个功能承担几何测量和变量位置;而不随滚动的界面元素可以像轮次轨道那样在滚动容器内 sticky 定位,要测量的正文列也本来就归 Chat 视图所有。
- **右侧栏标签页。** 变更请求已有这种实现,但它显示时会压窄正文,一次只显示一个标签页,而且 [UI 指南](../../../skills/dsh-client-ui-ux/SKILL.md#reuse-before-adding)把侧栏留给按需打开的内容,而不是常驻摘要。
- **dock kit 的悬浮窗。** `FloatLayer` 窗口可拖拽、可缩放、按视口坐标定位;锚定在正文留白的摘要用不上这些能力,还要对抗窗口自身的定位规则。
- **按视口宽度断点。** 正文宽度自适应、可拖拽,右侧栏占用可变宽度,视口断点要么遮挡正文,要么在空间充足时也隐藏面板。
- **纯 CSS 隐藏加点击时读取。** 对留白做容器查询可以隐藏停靠面板,开关在按下时读取计算结果,与后台任务按钮的做法相同。但开关渲染时仍不知道面板是否显示,偏好为停靠而留白不足时,`aria-expanded` 与提示文字都会出错。
- **挤压正文腾出空间。** 在笔记本宽度下把正文列移开来停靠,会改变居中的正文列、composer 和两侧宽度拖拽条;这仍是另一项布局决策。
- **会话作用域标准 hook。** 给每个会话作用域 Slot 增加一个留白 hook,会让客户端所有组件测试夹具都要补上它;停靠判断只有两个读取方,即面板和开关,两者都从插件自己的状态读取。
## Consequences
- 默认正文宽度最多 880px,此时对话区要 1576px 宽才能停靠,因此笔记本宽度使用浮层;除非用户主动打开,面板不会遮挡正文。
- 独立插件的分栏共享同一界面、排序和标题样式,彼此不依赖;已占用的分栏 id 可以被更高优先级的注册替换。
- `ui-chat` 多了一个 slot,侧边层多了一个自定义属性,但不为它们观察任何尺寸。每个已挂载的面板在停靠探针上多一个 `ResizeObserver`,只在停靠判断翻转时回调。`ui-conversation` 把默认正文宽度上限定为 880px。
- 面板只出现在 Chat 视图中;其他视图下开关仍在标题栏中,但不可用。每个 Chat 视图实例都会渲染侧边层,因此同一会话同时显示在主正文区和嵌入的对话中时,两处都会显示浮层。
- 轮次轨道的位置对所有用户都变了;行为和隐藏规则不变。
@@ -0,0 +1,19 @@
# Bilingual-pair consistency record for 2026-11-13-no-new-cordis-root-reads.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 .agents/notes/implemented/process/2026-11-13-no-new-cordis-root-reads.md
/agent-note-prohibit-new-reads-of-the-cordis-root-context:
en: b46331d0804f9d45
zh: d8b3d8a47541c838
/agent-note-prohibit-new-reads-of-the-cordis-root-context/problem:
en: c6935cb7ef54f299
zh: 214ed828b3201539
/agent-note-prohibit-new-reads-of-the-cordis-root-context/decision:
en: 458cdad9fce26157
zh: 6ac3b9d7404b4996
/agent-note-prohibit-new-reads-of-the-cordis-root-context/alternatives-considered:
en: 81d959fa34f3e682
zh: 861f22528134e255
/agent-note-prohibit-new-reads-of-the-cordis-root-context/consequences:
en: 6067864f7a2ff1c8
zh: df4c9af26a1abd5d
@@ -0,0 +1,31 @@
# Agent Note: Prohibit new reads of the Cordis root context
Status: implemented
English | [中文](2026-11-13-no-new-cordis-root-reads.zh.md)
## Problem
`ctx[Context.root]` returns the application's root context. A property read through it skips the `inject` check, because the root fiber has no runtime; a listener registered on it skips scope filtering; and it reads the root realm instead of the caller's isolate realm. DSH code uses it to read undeclared services, to listen to every Agent's events, to key per-application state, and to call boot APIs that require the root context. Each of these uses has, or needs, a declared replacement: an `inject` entry, `{ global: true }` on a listener, or a service that owns the root-level operation.
The repository contains such reads across boot, host, preset, protocol, experimental, and test owners. Replacing all of them in one change would combine the enforcement decision with several service designs.
## Decision
New reads of the Cordis root context are prohibited in first-party JavaScript and TypeScript, including tests, fixtures, and scripts. The [checker](../../../../scripts/verify-cordis-root.ts), exposed as `pnpm run verify-cordis-root`, uses the TypeScript syntax tree and a type checker over each file alone. A read names the root symbol through a Cordis value binding of `Context` or `symbols`: `.root`, `['root']`, or `root` destructured in a declaration, a parameter default, or an assignment. A binding comes from `@deepseek-ai/cordis` or one of its subpaths through a static import, including renamed, default, namespace, and `import =` forms, or through a destructured or namespace `import()` or `require()` result; a local that shadows the import is not a binding. Any string literal whose value is exactly `cordis.root`, the key behind `Symbol.for('cordis.root')`, is also a read. Type positions, interfaces, type aliases, ambient declarations, comments, other strings, and source text embedded in a template are not reads.
Existing reads have an exact baseline in `scripts/cordis-root.baseline.json`, kept by [the shared inventory module](../../../../scripts/baseline-inventory.ts) under the rules of the [unknown-cast inventory](2026-09-19-no-unknown-casts.md): baseline edits only delete entries or decrease counts, `--prune` removes retired entries and refuses to write while new reads exist, and no command adds an allowance. A read's fingerprint covers the tokens of the element access whose key is the root symbol, so a recorded read moved to another receiver is a new finding.
Files that exercise the root contract itself are listed with a reason in `CORDIS_ROOT_EXEMPTIONS` inside the checker and are not scanned: the Cordis rc.12 specification and the checker. An exemption whose file no longer reads the root fails the gate. Vendored sources and frozen archived Agent Notes keep their inventory exclusions. The checker runs in CI static and primary modes and the local `hygiene` and `check-all` profiles in [the gate runner](../../../../scripts/run-gates.ts). The [defensive pattern](../../../../docs/defensive-patterns/general.md#plugins-do-not-read-the-cordis-root-context) states the rule and its replacements for authors, and the gate's rejection message links it.
## Alternatives considered
**Replace every existing read before enforcing the rule.** Rejected because several replacements need new services, such as a profile-composition service for the boot APIs and an application-lifecycle signal; enforcing first stops new reads while those designs are reviewed separately.
**Use the `no-restricted-properties` lint rule.** Rejected because it matches the identifier `Context` by name, so a renamed import such as `CordisContext` passes, and it cannot match `Symbol.for('cordis.root')`.
**Record the exempt files in the baseline.** Rejected because the baseline only shrinks, while the exempt files are expected to keep their reads; keeping them apart lets the baseline reach empty.
## Consequences
Owners must remove a recorded read before changing its receiver or moving it into an unlisted file, and prune its entry after removal. Passing the check establishes that no unlisted syntactic root read exists. It does not detect a root context obtained through another value, such as a stored reference, an alias of `Context`, a service that returns it, or code assembled from strings at runtime.
@@ -0,0 +1,31 @@
# Agent Note: 禁止新增对 Cordis 根上下文的读取
Status: implemented
[English](2026-11-13-no-new-cordis-root-reads.md) | 中文
## 问题
`ctx[Context.root]` 返回应用的根上下文。通过它读取属性会跳过 `inject` 检查,因为根 fiber 没有 runtime;在它上面注册的监听器会跳过 scope 过滤;它读取的是根 realm,而不是调用方所在的 isolate realm。DSH 代码用它读取未声明的服务、监听所有 Agent 的事件、作为应用级状态的键,以及调用要求根上下文的启动 API。这些用法都已有或需要一个显式声明的替代方式:`inject` 条目、监听器上的 `{ global: true }`,或负责根级操作的服务。
仓库中的此类读取分布在 boot、host、preset、protocol、experimental 和测试等多个所有者中。在一次变更中全部替换,会把执行规则的决定与多个服务设计混在一起。
## 决定
第一方 JavaScript 和 TypeScript(包括测试、fixture 和脚本)禁止新增对 Cordis 根上下文的读取。[检查器](../../../../scripts/verify-cordis-root.ts)通过 `pnpm run verify-cordis-root` 运行,使用 TypeScript 语法树,并对每个文件单独建立类型检查器。读取指通过 `Context` 或 `symbols` 的 Cordis 值绑定访问根符号:`.root`、`['root']`,或在声明、参数默认值或赋值中解构出的 `root`。绑定来自 `@deepseek-ai/cordis` 或其子路径,可以是静态导入(包括重命名、默认、命名空间和 `import =` 形式),也可以是解构或整体接收的 `import()` 或 `require()` 结果;遮蔽导入的局部变量不是绑定。值恰为 `cordis.root` 的任何字符串字面量也算读取,即 `Symbol.for('cordis.root')` 背后的键。类型位置、接口、类型别名、ambient 声明、注释、其他字符串以及嵌入模板中的源码文本不算读取。
现有读取使用 `scripts/cordis-root.baseline.json` 中的精确基线记录,由[共享清单模块](../../../../scripts/baseline-inventory.ts)按 [unknown 类型断言清单](2026-09-19-no-unknown-casts.zh.md)的规则维护:基线修改只能删除条目或减少次数,`--prune` 删除已失效的条目并在存在新读取时拒绝写入,且没有任何命令可以添加放行。读取的指纹覆盖以根符号为键的元素访问的 token,因此把已记录的读取换到另一个接收者上会产生新的检查发现。
测试根上下文约定本身的文件在检查器内的 `CORDIS_ROOT_EXEMPTIONS` 中逐个列出并注明原因,不参与扫描:Cordis rc.12 规范测试和检查器本身。若豁免文件不再读取根上下文,门禁失败。vendored 源码和已冻结的归档 Agent Notes 保留清单的排除规则。检查器参与[门禁运行器](../../../../scripts/run-gates.ts)中的 CI static 和 primary 模式以及本地 `hygiene` 和 `check-all` 配置。[防御性模式](../../../../docs/defensive-patterns/general.zh.md#plugins-do-not-read-the-cordis-root-context)为作者写明该规则及替代方式,门禁的拒绝信息链接到这一节。
## 考虑过的替代方案
**在执行规则前替换所有现有读取。** 已否决,因为部分替换需要新的服务,例如供启动 API 使用的 profile 组合服务和应用生命周期信号;先执行规则可以阻止新增读取,同时单独评审这些设计。
**使用 `no-restricted-properties` lint 规则。** 已否决,因为它按名称匹配标识符 `Context`,重命名导入(如 `CordisContext`)可以绕过,而且无法匹配 `Symbol.for('cordis.root')`。
**把豁免文件记入基线。** 已否决,因为基线只会缩小,而豁免文件预期会保留其读取;分开维护可以让基线最终清空。
## 影响
所有者在更换已记录读取的接收者或将其移入未登记的文件之前,必须先移除该读取,并在移除后裁剪其条目。通过此检查表明不存在未登记的语法层面的根读取。它无法检测通过其他值获得的根上下文,例如保存的引用、`Context` 的别名、返回根上下文的服务,或运行时由字符串拼装的代码。
+122
View File
@@ -0,0 +1,122 @@
/**
* Daily stale pull-request reminders for the `Stale pull requests` workflow.
*
* A pull request's last activity is the latest of its creation, a commit, a force push, a reopen or ready-for-review
* event, and a comment or review from a non-bot account. Other timeline events, such as mentions, labels and cross
* references, do not count, so reminder comments never extend it. After 7 and 14 days without activity the workflow
* comments once per stage and mentions the author. Activity starts a new cycle. Pull requests labelled `DO_NOT_CLOSE`
* and pull requests opened by bots receive no reminders. The workflow never closes pull requests.
*
* Each run reads the timeline of every open pull request that is neither exempt nor bot-authored, because `updated_at`
* also changes on events that are not activity. Each run posts at most `MAX_COMMENTS_PER_RUN` reminders, least recently
* updated pull requests first, so a backlog spreads over several days within GitHub's content-creation limits. A failed
* pull request is reported and skipped.
*/
/** Label that exempts a pull request from reminders. */
export const EXEMPT_LABEL = 'DO_NOT_CLOSE'
/** Days without activity after which each reminder is posted, in ascending order. */
export const REMINDER_DAYS = [7, 14]
const DAY_MS = 24 * 60 * 60 * 1000
// GitHub asks integrations to wait at least one second between content-creating requests.
const COMMENT_INTERVAL_MS = 1000
const MAX_COMMENTS_PER_RUN = 100
const MARKER = /<!-- stale-pr-reminder:(\d+) -->/
// Review bots that use ordinary user accounts.
const BOT_LOGINS = new Set(['ds-review-bot'])
const isBot = account => account?.type === 'Bot' || (account?.login ?? '').endsWith('[bot]') || BOT_LOGINS.has(account?.login)
/**
* Returns the timestamps a timeline event contributes to the last activity.
* @param {object} event GitHub issue timeline event.
* @returns {string[]} ISO timestamps; empty for bot activity and events that are not activity.
*/
function activityTimes(event) {
switch (event.event) {
case 'committed':
return [event.committer?.date].filter(Boolean)
case 'head_ref_force_pushed':
case 'reopened':
case 'ready_for_review':
return [event.created_at]
case 'commented':
return isBot(event.actor) ? [] : [event.created_at]
case 'line-commented':
case 'commit-commented':
return (event.comments ?? []).filter(comment => !isBot(comment.user)).map(comment => comment.created_at)
case 'reviewed':
return isBot(event.user) ? [] : [event.submitted_at]
default:
return []
}
}
/**
* Selects the reminder a pull request is due for.
* @param {object} options
* @param {string} options.createdAt Pull-request creation time.
* @param {object[]} options.timeline Complete issue timeline of the pull request.
* @param {Date} options.now Evaluation time.
* @returns {number | undefined} Due reminder stage in days, or `undefined` when none is due.
*/
export function dueReminder({ createdAt, timeline, now }) {
const times = [createdAt, ...timeline.flatMap(activityTimes)].map(time => Date.parse(time)).filter(Number.isFinite)
const lastActivity = Math.max(...times)
const due = REMINDER_DAYS.filter(days => now.getTime() - lastActivity >= days * DAY_MS).at(-1)
if (due === undefined) return undefined
const sent = timeline
.filter(event => event.event === 'commented' && isBot(event.actor) && Date.parse(event.created_at) > lastActivity)
.map(event => Number(MARKER.exec(event.body ?? '')?.[1]))
return sent.some(days => days >= due) ? undefined : due
}
/**
* Builds the reminder comment.
* @param {string} author Pull-request author login.
* @param {number} days Reminder stage in days.
* @returns {string} Comment body.
*/
export function reminderBody(author, days) {
return [
`<!-- stale-pr-reminder:${days} -->`,
`@${author} This pull request has had no activity for ${days} days. Please update it, reply to keep it open, or close it if it is no longer needed. Add the \`${EXEMPT_LABEL}\` label, or ask a maintainer to add it, to stop these reminders.`,
].join('\n')
}
/**
* Posts every due reminder on open pull requests of the workflow repository.
* @param {object} options
* @param {object} options.github Authenticated Octokit client from `actions/github-script`.
* @param {object} options.context Workflow context from `actions/github-script`.
* @param {object} options.core Actions toolkit core from `actions/github-script`.
* @param {Date} [options.now] Evaluation time.
* @param {(ms: number) => Promise<void>} [options.sleep] Delay between comments.
* @returns {Promise<void>}
*/
export async function remindStalePullRequests({ github, context, core, now = new Date(), sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) }) {
const { owner, repo } = context.repo
const pulls = await github.paginate(github.rest.pulls.list, { owner, repo, state: 'open', sort: 'updated', direction: 'asc', per_page: 100 })
let posted = 0
let failed = 0
for (const pull of pulls) {
if (posted >= MAX_COMMENTS_PER_RUN) break
if (isBot(pull.user)) continue
if (pull.labels.some(label => label.name === EXEMPT_LABEL)) continue
try {
const timeline = await github.paginate(github.rest.issues.listEventsForTimeline, { owner, repo, issue_number: pull.number, per_page: 100 })
const days = dueReminder({ createdAt: pull.created_at, timeline, now })
if (days === undefined) continue
if (posted > 0) await sleep(COMMENT_INTERVAL_MS)
await github.rest.issues.createComment({ owner, repo, issue_number: pull.number, body: reminderBody(pull.user.login, days) })
posted++
core.info(`#${pull.number}: posted the ${days}-day reminder`)
} catch (error) {
failed++
core.warning(`#${pull.number}: ${error.message}`)
}
}
if (failed > 0) core.setFailed(`${failed} pull requests failed; see the warnings above.`)
}
@@ -0,0 +1,96 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import { dueReminder, reminderBody, remindStalePullRequests } from './remind.mjs'
const now = new Date('2026-11-30T00:00:00Z')
const daysAgo = days => new Date(now.getTime() - days * 24 * 60 * 60 * 1000).toISOString()
const human = { login: 'author', type: 'User' }
const bot = { login: 'github-actions[bot]', type: 'Bot' }
const comment = (actor, days, body = 'ok') => ({ event: 'commented', actor, created_at: daysAgo(days), body })
const reminder = (days, stage) => comment(bot, days, reminderBody('author', stage))
test('no reminder is due within 7 days of the last activity', () => {
assert.equal(dueReminder({ createdAt: daysAgo(6), timeline: [], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(30), timeline: [comment(human, 6)], now }), undefined)
})
test('the latest due stage is posted once after the last activity', () => {
assert.equal(dueReminder({ createdAt: daysAgo(7), timeline: [], now }), 7)
assert.equal(dueReminder({ createdAt: daysAgo(10), timeline: [reminder(3, 7)], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(14), timeline: [reminder(7, 7)], now }), 14)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [], now }), 14)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [reminder(20, 14)], now }), undefined)
})
test('human activity restarts the cycle and bot activity does not', () => {
const sentBefore = [reminder(30, 7), reminder(23, 14)]
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, comment(human, 8)], now }), 7)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'committed', committer: { date: daysAgo(3) } }], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'reviewed', user: human, submitted_at: daysAgo(3) }], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'line-commented', comments: [{ user: human, created_at: daysAgo(3) }] }], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'head_ref_force_pushed', actor: human, created_at: daysAgo(3) }], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, comment({ login: 'ci[bot]', type: 'Bot' }, 1)], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, comment({ login: 'ds-review-bot', type: 'User' }, 1)], now }), undefined)
})
test('mentions, labels and cross references are not activity', () => {
const at = (event, days) => ({ event, actor: human, created_at: daysAgo(days) })
// GitHub records a `mentioned` event for the author right after each reminder.
assert.equal(dueReminder({ createdAt: daysAgo(14), timeline: [reminder(7, 7), at('mentioned', 7 - 1e-5), at('subscribed', 7 - 1e-5)], now }), 14)
assert.equal(dueReminder({ createdAt: daysAgo(20), timeline: [at('labeled', 1), at('cross-referenced', 1), at('review_requested', 1)], now }), 14)
})
test('reminders mention the author and skip exempt and bot-authored pull requests', async () => {
const pull = (number, overrides = {}) => ({ number, user: human, labels: [], created_at: daysAgo(20), updated_at: daysAgo(20), ...overrides })
const pulls = [
pull(1),
pull(2, { labels: [{ name: 'DO_NOT_CLOSE' }] }),
pull(3, { user: { login: 'dependabot[bot]', type: 'Bot' } }),
// A bot comment or label refreshes `updated_at` without being activity.
pull(4, { updated_at: daysAgo(1) }),
pull(6),
pull(5),
]
const comments = []
const timelines = []
const github = {
rest: {
pulls: { list: 'pulls' },
issues: {
listEventsForTimeline: 'timeline',
createComment: async params => {
if (params.issue_number === 6) throw new Error('locked')
comments.push(params)
},
},
},
paginate: async (method, params) => {
if (method === 'pulls') return pulls
timelines.push(params.issue_number)
return []
},
}
const sleeps = []
const warnings = []
const failures = []
const core = { info() {}, warning: message => warnings.push(message), setFailed: message => failures.push(message) }
await remindStalePullRequests({ github, context: { repo: { owner: 'o', repo: 'r' } }, core, now, sleep: async ms => sleeps.push(ms) })
assert.deepEqual(timelines, [1, 4, 6, 5])
assert.deepEqual(warnings, ['#6: locked'])
assert.equal(failures.length, 1)
assert.deepEqual(comments.map(({ issue_number }) => issue_number), [1, 4, 5])
assert.match(comments[0].body, /^<!-- stale-pr-reminder:14 -->\n@author This pull request has had no activity for 14 days\./)
assert.deepEqual(sleeps, [1000, 1000, 1000])
})
test('a run posts at most 100 reminders', async () => {
const pulls = Array.from({ length: 105 }, (_, number) => ({ number, user: human, labels: [], created_at: daysAgo(20), updated_at: daysAgo(20) }))
let comments = 0
const github = {
rest: { pulls: { list: 'pulls' }, issues: { listEventsForTimeline: 'timeline', createComment: async () => comments++ } },
paginate: async method => method === 'pulls' ? pulls : [],
}
await remindStalePullRequests({ github, context: { repo: { owner: 'o', repo: 'r' } }, core: { info() {} }, now, sleep: async () => {} })
assert.equal(comments, 100)
})
+35
View File
@@ -0,0 +1,35 @@
# Reminds authors of open pull requests after 7 and 14 days without activity; never closes them.
# Rules: .github/stale-pull-requests/remind.mjs.
name: Stale pull requests
on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: stale-pull-requests
cancel-in-progress: false
jobs:
remind:
name: Remind stale pull requests
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Check out reminder rules
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
sparse-checkout: .github/stale-pull-requests
persist-credentials: false
- name: Post due reminders
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3
with:
script: |
const { remindStalePullRequests } = await import(`${process.env.GITHUB_WORKSPACE}/.github/stale-pull-requests/remind.mjs`)
await remindStalePullRequests({ github, context, core })
+2 -2
View File
@@ -12,8 +12,8 @@
en: cc03e6b75206661b
zh: 99e41f4143198352
/deepseek-ai-dsh/profiles:
en: 523477a093beb0c2
zh: f88ea21e5fbea969
en: 85171337ac2fb2ff
zh: 705a4eef97d9b519
/deepseek-ai-dsh/optional-overlays:
en: 3a40ddc44e55f79c
zh: 8d3949132e1ef93c
+1 -1
View File
@@ -34,7 +34,7 @@ dsh --help # the launcher's own help
<a id="profiles"></a>
## Profiles
A profile directory holds a `package.json` (out-of-tree plugin dependencies plus the profile manifest `dsh.profile` with its ordered `bundles` list) and a `cordis.patch.yml` (the user's own patch layer). `dsh-hmr`, when enabled in YAML, watches the profile manifest and both profile and home patch files, then recomposes all layers through one serialized reload. Without HMR, changes apply on restart. Edits arriving during watcher registration use the same nonfatal reload reporting as later edits. [Plugin Manager](../../packages/boot/plugin-manager/README.md) shares package operations and the profile write lock with `dsh plugin`; package updates retain disabled bundle selections. CLI package commands inherit authentication variables and terminal descriptors, including interactive build approval; service calls retain their scrubbed environment and captured diagnostics.
A profile directory holds a `package.json` (out-of-tree plugin dependencies plus the profile manifest `dsh.profile` with its ordered `bundles` list) and a `cordis.patch.yml` (the user's own patch layer). `dsh-hmr`, when enabled in YAML, watches the profile manifest, the profile and home patch files, and every `--patch` overlay file, then recomposes all layers through one serialized reload. Without HMR, changes apply on restart, except that a Config Editor save applies the current contents of every patch and overlay file. Edits arriving during watcher registration use the same nonfatal reload reporting as later edits. [Plugin Manager](../../packages/boot/plugin-manager/README.md) shares package operations and the profile write lock with `dsh plugin`; package updates retain disabled bundle selections. CLI package commands inherit authentication variables and terminal descriptors, including interactive build approval; service calls retain their scrubbed environment and captured diagnostics.
Installation and profile startup enforce the declared `engines.dsh` range, or DSH peer ranges when it is absent, against the same runtime version shown by `dsh --version`. Incompatible plugins require an explicitly acknowledged exact-version exemption. The [plugin manager's compatibility reference](../../packages/boot/plugin-manager/README.md#version-compatibility-and-exemptions) documents `version-exemptions`, `allow-version`, `revoke-version`, persistence, and risks.
+1 -1
View File
@@ -34,7 +34,7 @@ dsh --help # the launcher's own help
<a id="profiles"></a>
## Profile
profile 目录包含一个 `package.json`,其中记录树外插件依赖,以及 profile manifest(元数据清单)`dsh.profile`、其中按顺序排列的 `bundles` 列表;还包含一个 `cordis.patch.yml`,其中保存用户自己的 patch 层。在 YAML 中启用的 `dsh-hmr` 监视 profile manifest、profile 与 home 级 patch 文件,再通过统一串行重载重新组合所有层。未启用 HMR 时,更改在重启后生效。监听器注册期间发生的编辑与后续编辑使用相同的非致命重载错误报告。[插件管理器](../../packages/boot/plugin-manager/README.zh.md) 与 `dsh plugin` 共享包操作和 profile 写锁;更新依赖会保留已停用的组合包选择。CLI 包操作继承认证环境和终端描述符,支持交互式构建批准;service 调用保留清理后的环境并捕获诊断。
profile 目录包含一个 `package.json`,其中记录树外插件依赖,以及 profile manifest(元数据清单)`dsh.profile`、其中按顺序排列的 `bundles` 列表;还包含一个 `cordis.patch.yml`,其中保存用户自己的 patch 层。在 YAML 中启用的 `dsh-hmr` 监视 profile manifest、profile 与 home 级 patch 文件以及每个 `--patch` overlay 文件,再通过统一串行重载重新组合所有层。未启用 HMR 时,更改在重启后生效;例外是 Config Editor 保存时会应用所有 patch 与 overlay 文件的当前内容。监听器注册期间发生的编辑与后续编辑使用相同的非致命重载错误报告。[插件管理器](../../packages/boot/plugin-manager/README.zh.md) 与 `dsh plugin` 共享包操作和 profile 写锁;更新依赖会保留已停用的组合包选择。CLI 包操作继承认证环境和终端描述符,支持交互式构建批准;service 调用保留清理后的环境并捕获诊断。
安装和 profile 启动会按声明的 `engines.dsh` 范围(未声明时按 DSH peer 范围),检查与 `dsh --version` 显示值相同的运行时版本。不兼容插件需要用户明确确认精确版本豁免。[插件管理器的兼容性参考](../../packages/boot/plugin-manager/README.zh.md#version-compatibility-and-exemptions)说明 `version-exemptions`、`allow-version`、`revoke-version`、持久化规则与风险。
+2 -2
View File
@@ -21,8 +21,8 @@
en: 8d2cfff9bab7327f
zh: 21515ab6e6798504
/dsh-cli-behavior-reference/web-profile:
en: 149c5571acd51baf
zh: 300e3c2425273a92
en: afc6ddcd63f24664
zh: ed11d2ad6d7a9852
/dsh-cli-behavior-reference/shared-deployment-behavior:
en: f02219118dcec531
zh: fe2977628d7340da
+1 -1
View File
@@ -128,7 +128,7 @@ The production Web runner needs built package and frontend artifacts (`pnpm run
Process shutdown gives the plugin tree up to five seconds to dispose. The first `SIGINT`/`SIGTERM` starts that graceful drain — `SIGTERM` is a supervisor's ordinary stop request and exits 0 on every surface, `SIGINT` reports 130; a second signal forces immediate exit. If one-shot normal completion is already stuck in disposal, the first `Ctrl+C` is the escalation and exits immediately instead of being swallowed.
The base-backed modes treat the invoking directory as the default workspace root, load applicable `AGENTS.md` or `CLAUDE.md` instructions with a 65,536-byte render budget for each instruction chain, and use an in-memory SQLite session content index. The standalone `sdk-minimal` profile uses the invoking directory as its sandbox-policy root and includes `read_image`, but omits text filesystem tools, instruction discovery, and SQLite. An enabled HMR plugin watches both `cordis.patch.yml` layers (profile and home) and reapplies valid edits transactionally; without HMR, the process applies them once. A one-shot surface exits through its bounded shutdown, which disposes any live watchers.
The base-backed modes treat the invoking directory as the default workspace root, load applicable `AGENTS.md` or `CLAUDE.md` instructions with a 65,536-byte render budget for each instruction chain, and use an in-memory SQLite session content index. The standalone `sdk-minimal` profile uses the invoking directory as its sandbox-policy root and includes `read_image`, but omits text filesystem tools, instruction discovery, and SQLite. An enabled HMR plugin watches both `cordis.patch.yml` layers (profile and home) and every `--patch` overlay file, and reapplies valid edits transactionally; without HMR, the process applies them once. A one-shot surface exits through its bounded shutdown, which disposes any live watchers.
New sessions in base-backed profiles default to the `workspace-write` permission preset. Bash and filesystem mutations are restricted to the session workspace and platform temporary roots; reads and network access are not confined, while process visibility depends on the selected sandbox backend — bwrap runs commands in a private PID namespace that hides host processes, and Landlock and Seatbelt leave host process visibility unchanged. `DSH_PERMISSION_MODE` changes the process fallback. Stored General-settings permissions affect later Web sessions, not an already-open one. The standalone `sdk-minimal` tree instead pins `danger-full-access` and mounts no approval or permission-settings service.
+1 -1
View File
@@ -128,7 +128,7 @@ dsh web --help
进程关闭时,插件树最多有 5 秒完成 dispose。首次收到 `SIGINT` 或 `SIGTERM` 时会开始优雅排空:`SIGTERM` 是监督进程发出的常规停止请求,在所有运行模式下都以 0 退出;`SIGINT` 则报告 130。第二次收到信号时会立即强制退出。如果一次性运行在正常结束时已经卡在 dispose 阶段,第一次按下 `Ctrl+C` 就会直接升级为强制退出,而不会被忽略。
基于 base 的模式都将运行命令时所在的目录作为默认 workspace 根目录,以每条指令链 65,536 字节的渲染预算加载适用的 `AGENTS.md` 或 `CLAUDE.md` 指令,并使用内存 SQLite 会话内容索引。独立的 `sdk-minimal` profile 把运行命令时所在的目录作为沙箱策略根目录并包含 `read_image`,但省略文本文件系统工具、指令发现与 SQLite。启用的 HMR 插件会监视 profile 与 home 两个 `cordis.patch.yml` 配置层的有效变更,并以事务方式重新应用;未启用 HMR 时只应用一次。一次性运行模式通过有界关闭流程退出,该流程会 dispose 所有实时监视器。
基于 base 的模式都将运行命令时所在的目录作为默认 workspace 根目录,以每条指令链 65,536 字节的渲染预算加载适用的 `AGENTS.md` 或 `CLAUDE.md` 指令,并使用内存 SQLite 会话内容索引。独立的 `sdk-minimal` profile 把运行命令时所在的目录作为沙箱策略根目录并包含 `read_image`,但省略文本文件系统工具、指令发现与 SQLite。启用的 HMR 插件会监视 profile 与 home 两个 `cordis.patch.yml` 配置层以及每个 `--patch` overlay 文件的有效变更,并以事务方式重新应用;未启用 HMR 时只应用一次。一次性运行模式通过有界关闭流程退出,该流程会 dispose 所有实时监视器。
基于 base 的 profile 中,新会话默认使用 `workspace-write` 权限预设。Bash 和文件系统修改仅限于会话 workspace 与平台临时根目录;读取和网络访问不受限制,进程可见性则取决于所选沙箱后端——bwrap 在私有 PID 命名空间中运行命令并隐藏宿主进程,Landlock 与 Seatbelt 保持宿主进程可见性不变。`DSH_PERMISSION_MODE` 更改进程后备值。General settings 中存储的权限影响后续 Web 会话,不改变已打开的会话。独立的 `sdk-minimal` 配置树则固定为 `danger-full-access`,且不挂载 approval 或权限 settings 服务。
+4 -7
View File
@@ -14,14 +14,12 @@ import { existsSync, mkdirSync, mkdtempSync, renameSync, rmSync, writeFileSync }
import { dirname, join, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { FiberState, type Context } from '@deepseek-ai/cordis'
import type { PatchOptions } from '@deepseek-ai/cordis-plugin-include'
import {
boot,
readProfilePatches,
createRuntimeResolution,
initProfile,
installFailLoud,
loadOverlayPatches,
loadProfile,
reportSkippedBundles,
PluginPackages,
@@ -204,8 +202,8 @@ interface ComposedProfile {
profile: Profile
/** Immutable runtime resolution computed before any plugin imports. */
resolution: RuntimeResolution
/** Command-line overlay contents, frozen for this invocation. */
overlays: PatchOptions[]
/** Absolute command-line overlay files, in argv order. */
overlayPaths: string[]
}
/**
@@ -231,8 +229,7 @@ async function composeProfile(
if (resolvedProfile !== undefined) writeFileSync(join(profile.dir, PROFILE_ROOT_FILENAME), PROFILE_ROOT_CONFIG)
const resolutionOptions = { installAnchor: resolvedProfile?.installAnchor ?? INSTALL_ANCHOR, profile }
const resolution = await createRuntimeResolution(resolutionOptions)
const overlays = patchFiles.flatMap(file => loadOverlayPatches(NAME, resolve(file)))
return { profile, resolution, overlays }
return { profile, resolution, overlayPaths: patchFiles.map(file => resolve(file)) }
}
/** An application-owned profile and its independent installation fallback. */
@@ -331,7 +328,7 @@ export async function runProfile(options: RunProfileOptions): Promise<{ ctx: Con
installAnchor: options.resolvedProfile?.installAnchor ?? INSTALL_ANCHOR,
startedBundles: composed.profile.layers.map(layer => layer.packageName),
cwd: process.cwd(), home: resolveDshHome(),
overlays: composed.overlays, telemetryDisabledEnv: process.env.DSH_TELEMETRY_DISABLED,
overlayPaths: composed.overlayPaths, telemetryDisabledEnv: process.env.DSH_TELEMETRY_DISABLED,
}
const ctx = await boot(NAME, rootConfig, readProfilePatches(NAME, profileContext, composed.profile), async (hostCtx) => {
app.current = hostCtx
@@ -95,7 +95,7 @@ describe.skipIf(!existsSync(join(root, 'apps/cli/lib/bin.js')))('Official option
const profile = app.loadProfileDirectory('bundle-test', directory, installAnchor)
const profileContext: ProfileContext = {
name: 'web', dir: directory, patchPath: profile.patchPath, installAnchor, cwd: workspace, home,
startedBundles: profile.layers.map(layer => layer.packageName), overlays: [], telemetryDisabledEnv: '1',
startedBundles: profile.layers.map(layer => layer.packageName), overlayPaths: [], telemetryDisabledEnv: '1',
}
const resolution = await app.createRuntimeResolution({ installAnchor, home, profile })
const listeners = new Set<() => void>()
@@ -17,7 +17,7 @@
{
"name": "cua_run_code",
"title": "Computer use program",
"description": "Run a TypeScript program to observe and operate desktop applications. The global cua object is ready to use; retain application and window objects across calls. Only tools.cua is available inside the program. Call other session tools directly. Use inspect(...values) to display selected text and images. The program contains TypeScript REPL statements; only erasable syntax is accepted, with no enum or namespaces. Type annotations are advisory. Top-level declarations and await are supported; top-level return is not supported. Use inspect(...values) to display output. Do not use console. The program runs in strict mode: assigning an undeclared name throws, so use globalThis for intentional globals; eval and new Function are unavailable. Variables, functions, and imported modules remain in memory for this Agent across calls. Each call runs one program in its own top-level scope. Its top-level let, const, var, class, and function declarations, and the names it received from earlier programs, are copied into the top-level scope of later programs: later programs receive copies of these variables, not references to them, so an object they hold is still shared. In one program, either use a copied name or declare it again; do not declare a name and also use its copied value. Assigning to a copied name, even one declared with const, changes only this program's copy, which later programs receive. Do not declare var inside blocks; a block-level var changes which value later programs copy. Functions and still-running code from earlier programs keep the values they captured, and assignments they make later are not copied; keep shared mutable state in objects. If a program fails before a declaration of an existing name finishes, later programs keep that name's earlier value. Use await import(...) for modules; require and module are unavailable. Relative import specifiers resolve from the working directory of this environment's first program, while process.cwd() and relative file paths follow each program's working directory. Direct filesystem access follows the environment's launch-time sandbox policy; process.env starts empty. Timeout and cancellation results say whether retained variables were preserved or cleared. Restart, sandbox changes, output overflow, or process failure clears them. Recreate missing variables and resources; conversation history does not restore state. Earlier mutations and tool effects are not rolled back. Approved sandbox escalations use a fresh environment and discard its variables afterward. Await tools and cleanup before the program ends; unfinished tools reject. After completion, timeout, or cancellation, new tool calls are rejected and captured output is discarded; background work may still change state. Await child-process completion before the program ends; raw output belongs to the active evaluation. Each program starts in the Session's current directory. Running programs keep their initial directory. A sandbox escalation approves this complete program for one execution only. Nested tools retain their own policies and approvals. Request wider access only after evidence of a denial. Earlier effects may already have completed: inspect them before explicitly retrying. Programs are never replayed automatically.",
"description": "Run a TypeScript program to observe and operate desktop applications. The global cua object is ready to use; retain application and window objects across calls. Only tools.cua is available inside the program. Call other session tools directly. Use inspect(...values) to display selected text and images. The program contains TypeScript REPL statements; only erasable syntax is accepted, with no enum or namespaces. Type annotations are advisory. Top-level declarations and await are supported; top-level return is not supported. Use inspect(...values) to display output. Do not use console. Use the raw form of a template literal only for short text whose backslashes must stay exactly as written, such as a regular expression; write other text, in particular file contents and commands, as ordinary strings. Write file contents as an array of quoted strings, one line each, joined with newlines; never as one template literal. The program runs in strict mode: assigning an undeclared name throws, so use globalThis for intentional globals; eval and new Function are unavailable. Variables, functions, and imported modules remain in memory for this Agent across calls. Each call runs one program in its own top-level scope. Its top-level let, const, var, class, and function declarations, and the names it received from earlier programs, are copied into the top-level scope of later programs: later programs receive copies of these variables, not references to them, so an object they hold is still shared. In one program, either use a copied name or declare it again; do not declare a name and also use its copied value. Assigning to a copied name, even one declared with const, changes only this program's copy, which later programs receive. Do not declare var inside blocks; a block-level var changes which value later programs copy. Functions and still-running code from earlier programs keep the values they captured, and assignments they make later are not copied; keep shared mutable state in objects. If a program fails before a declaration of an existing name finishes, later programs keep that name's earlier value. Use await import(...) for modules; require and module are unavailable. Relative import specifiers resolve from the working directory of this environment's first program, while process.cwd() and relative file paths follow each program's working directory. Direct filesystem access follows the environment's launch-time sandbox policy; process.env starts empty. Timeout and cancellation results say whether retained variables were preserved or cleared. Restart, sandbox changes, output overflow, or process failure clears them. Recreate missing variables and resources; conversation history does not restore state. Earlier mutations and tool effects are not rolled back. Approved sandbox escalations use a fresh environment and discard its variables afterward. Await tools and cleanup before the program ends; unfinished tools reject. After completion, timeout, or cancellation, new tool calls are rejected and captured output is discarded; background work may still change state. Await child-process completion before the program ends; raw output belongs to the active evaluation. Each program starts in the Session's current directory. Running programs keep their initial directory. A sandbox escalation approves this complete program for one execution only. Nested tools retain their own policies and approvals. Request wider access only after evidence of a denial. Earlier effects may already have completed: inspect them before explicitly retrying. Programs are never replayed automatically.",
"inputSchema": {
"type": "object",
"properties": {
@@ -1,5 +1,5 @@
import { executeModelToolFixture } from '@deepseek-ai/dsh-tool-testkit'
import { mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
import { executeToolFixture, executeModelToolFixture } from '@deepseek-ai/dsh-tool-testkit'
import { mkdtemp, mkdir, readFile, realpath, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, describe, expect, it, onTestFinished, vi } from 'vitest'
@@ -152,6 +152,50 @@ async function backgroundPtcModeHarness(cwd: string): Promise<Context> {
}
describe('PTC mode typed values: keyless real-process contracts', () => {
it('returns formatted read content from inspect through the real outer run_code result', async () => {
workdir = await realpath(await mkdtemp(join(tmpdir(), 'dsh-ptc-inspect-read-')))
const path = join(workdir, 'a.txt')
await writeFile(path, 'alpha\nbeta\n')
ctx = await typedPtcModeHarness()
await ctx.plugin(ToolFs)
const formatted = `<path>${path}</path>\n<type>file</type>\n<content>\n1: alpha\n2: beta\n\n(End of file - total 2 lines)\n</content>`
const native = await executeToolFixture(ctx, {
callId: brandString<ToolCallId>('inspect-read-reference'), name: 'read',
arguments: { file_path: path }, signal: testToolSignal,
})
expect(native.isError).toBe(false)
expect(native.content).toEqual([{ type: 'text', text: formatted }])
const result = await runCode(ctx, `inspect(await tools.read({ file_path: ${JSON.stringify(path)} }));`)
expect(result.isError).toBe(false)
expect(result.content).toEqual([{ type: 'text', text: formatted + '\n' }])
expect(result.value).toEqual({
logs: [formatted + '\n'], sandbox: { mode: 'danger-full-access', denied: false },
})
})
it.each(['renderer', 'policy'])('keeps an empty %s output silent while preserving program data', async (source) => {
ctx = await typedPtcModeHarness()
ctx.tools.register(defineTool({
name: 'silent_result', description: 'Return data without display text.', parameters: {},
output: {
schema: { type: 'object', properties: { answer: { type: 'number', required: true } }, additionalProperties: false },
render: () => source === 'renderer' ? [] : [{ type: 'text', text: 'original rendering' }],
},
execute: async () => ({ answer: 42 }),
...source === 'policy' ? { finalizeContent: () => [] } : {},
}))
const result = await runCode(ctx, `
const value = await tools.silent_result({});
if (value.answer !== 42) throw new Error('program data changed');
inspect(value);
`)
expect(result.isError).toBe(false)
expect(result.content).toEqual([{ type: 'text', text: '(run_code completed with no output)' }])
expect(result.value).toEqual({ logs: [], sandbox: { mode: 'danger-full-access', denied: false } })
})
it('crosses a large intermediate value intact and exposes only typed tool failure fields', async () => {
ctx = await typedPtcModeHarness()
ctx.tools.register(defineTool({
@@ -305,15 +349,15 @@ describe('PTC mode typed values: keyless real-process contracts', () => {
} as Agent
const value = completion(await runCode(ctx, `
const listed = await tools.cordis_inspect_list({});
const listed = await tools.cordis_inspect({});
const provider = listed.providers.find(item => item.id === 'Tool');
const inspected = await tools.cordis_inspect_query({
const inspected = await tools.cordis_inspect({ query: {
platform: provider.platform, provider: provider.id, method: provider.methods[0].name,
});
} });
inspect(JSON.stringify({ provider: provider.id, names: inspected.data.tools.map(tool => tool.name) }));
`, testToolSignal, agent))
expect(value).toEqual({ provider: 'Tool', names: ['cordis_inspect_list', 'cordis_inspect_query'] })
expect(value).toEqual({ provider: 'Tool', names: ['cordis_inspect'] })
})
})
@@ -2,7 +2,7 @@
* Keyless comparison of actual SDK and Desktop/Web step-admitted tool sets.
* Keep intentional differences in tool-parity.ts; unused exceptions fail.
* Team mode is excluded while its known composition mismatch is tracked in #7172.
* SDK minimal, Creator-only tools, graphical context and optional runtime payloads
* SDK minimal, other presets, graphical context and optional runtime payloads
* are outside this fixed standard/PTC, top-level-session comparison.
*/
import { createServer } from 'node:http'
+6 -2
View File
@@ -9,8 +9,12 @@ interface Exception {
/** Intentional product differences; obsolete entries fail alongside undeclared differences. */
export const toolParityExceptions: Record<ToolMode, readonly Exception[]> = {
standard: [{ tool: 'list_subagent_models', side: 'desktop',
reason: 'Desktop enables subagent model discovery; SDK delegation inherits the caller model by default.' }],
standard: [
{ tool: 'list_subagent_models', side: 'desktop',
reason: 'Desktop enables subagent model discovery; SDK delegation inherits the caller model by default.' },
{ tool: 'cordis_inspect', side: 'desktop',
reason: 'Web exposes inspection of its Host and connected Client runtime; the SDK profile does not compose the Cordis inspection providers.' },
],
ptc: [
{ tool: 'list_subagent_models', side: 'desktop',
reason: 'Desktop enables subagent model discovery; SDK delegation inherits the caller model by default.' },
+5 -3
View File
@@ -2,7 +2,7 @@
import { lstatSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { createRequire } from 'node:module'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { join, relative } from 'node:path'
import { Context } from '@deepseek-ai/cordis'
import { createLaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment'
import {
@@ -139,7 +139,7 @@ describe('runProfile with an application-owned profile', () => {
try {
const { shutdown } = await runProfile({
environment, profile: 'desktop', resolvedProfile: runtime,
patchFiles: [overlay], args: ['--port', '0', '--no-open'],
patchFiles: [relative(process.cwd(), overlay)], args: ['--port', '0', '--no-open'],
})
expect(installProxyFromEnvironment).toHaveBeenCalledWith(environment, expect.any(Function))
const resolution = vi.mocked(createRuntimeResolution).mock.settledResults
@@ -165,7 +165,9 @@ describe('runProfile with an application-owned profile', () => {
])
expect(rows.find(row => row.id === 'target')?.config).toEqual({ overlay: true, priority: 'overlay' })
expect(rows.find(row => row.id === 'session-telemetry-otel')?.disabled).toBe(true)
expect(ctx.profileContext).toMatchObject({ dir: home, patchPath: profilePatch, installAnchor: runtime.installAnchor })
expect(ctx.profileContext).toMatchObject({
dir: home, patchPath: profilePatch, installAnchor: runtime.installAnchor, overlayPaths: [overlay],
})
await shutdown.shutdown(0)
expect(dispose).toHaveBeenCalledOnce()
expect(disposeProxy).toHaveBeenCalledOnce()
+25 -14
View File
@@ -221,7 +221,7 @@ async function bootWeb(
bootCtx.provide('profileContext', { name: surface, dir: profileDir, patchPath: profile.patchPath,
installAnchor: INSTALL_ANCHOR, home, cwd: home,
startedBundles: profileBundles ?? ['@deepseek-ai/dsh-base', '@deepseek-ai/dsh-web-app'],
overlays: [], telemetryDisabledEnv: '1' })
overlayPaths: [], telemetryDisabledEnv: '1' })
await bootCtx.plugin(PluginPackages, { resolution })
bootCtx.provide('connection', {
fetch: { register: () => () => {} },
@@ -351,7 +351,7 @@ describe('the shipped Web composition', () => {
// excluded for the reason the TUI composition e2e excludes them — they
// depend on ripgrep being present on the machine.
expect(toolNames(ctx, handle.agent).filter(name => name !== 'glob' && name !== 'grep')).toEqual([
'ask_user_question', 'bash', 'create_goal', 'edit', 'exit_plan_mode',
'ask_user_question', 'bash', 'cordis_inspect', 'create_goal', 'edit', 'exit_plan_mode',
'get_goal', 'job_kill', 'job_list', 'job_output', 'list_agents', 'list_subagent_models', 'office_convert', 'office_recalculate', 'office_render', 'plugin_manager', 'present', 'read', 'read_image',
'schedule_create', 'schedule_edit', 'schedule_list', 'schedule_view',
'send_message', 'skill',
@@ -359,6 +359,18 @@ describe('the shipped Web composition', () => {
'workflow', 'working_directory', 'write',
])
expect(ctx.commands.find(handle.agent, 'goal')).toBeDefined()
for (const query of [undefined, { platform: 'host', provider: 'Config', method: 'listConfigs', input: { name: '@deepseek-ai/dsh-agent-loop' } }] as const) {
const inspected = await executeToolFixture(ctx, {
agent: handle.agent, callId: brandString<ToolCallId>(`standard-inspect-${query === undefined ? 'list' : 'query'}`), name: 'cordis_inspect',
arguments: query === undefined ? {} : { query }, signal: new AbortController().signal,
})
expect(inspected.isError).toBe(false)
const text = inspected.content.flatMap(block => block.type === 'text' ? [block.text] : []).join('')
const value: unknown = JSON.parse(text)
const path = query === undefined ? 'providers' : 'data.entries'
const entry = query === undefined ? { platform: 'host', id: 'Config' } : { name: '@deepseek-ai/dsh-agent-loop' }
expect(value).toHaveProperty(path, expect.arrayContaining([expect.objectContaining(entry)]))
}
} finally {
await handle.dispose()
}
@@ -603,7 +615,7 @@ describe('the shipped Web composition', () => {
try {
const tools = toolNames(ctx, handle.agent)
expect(tools).toEqual(expect.arrayContaining([
'cordis_inspect_list', 'cordis_inspect_query', 'plugin_manager',
'cordis_inspect', 'plugin_manager',
]))
for (const removed of ['cordis_define', 'cordis_run', 'cordis_stop', 'cordis_undefine', 'cordis_inspect_self']) {
expect(tools).not.toContain(removed)
@@ -985,8 +997,7 @@ describe('the standard preset documentation skill', () => {
expect((await testCtx.skills.get('dsh-doc', { cwd: root, scope: creator.agent }))?.path).toBe(definition.path)
const schemas = testCtx.tools.schemas(standardAgent.agent)
expect(schemas).toEqual(testCtx.tools.schemas(baseline.agent))
expect(schemas.map(tool => tool.name)).not.toContain('cordis_inspect_list')
expect(schemas.map(tool => tool.name)).not.toContain('cordis_inspect_query')
expect(schemas.map(tool => tool.name)).toContain('cordis_inspect')
for (const handle of [baseline, standardAgent]) {
handle.agent.followup(createUserMessage({ content: [{ type: 'text', text: 'Reply ready.' }], source: { kind: 'user' } }))
await handle.agent.whenIdle()
@@ -1116,13 +1127,13 @@ describe('a user preset declared from the shipped cordis rows', () => {
try {
for (const handle of [shipped, copied]) {
expect(toolNames(copyCtx, handle.agent)).toEqual(expect.arrayContaining([
'cordis_inspect_list', 'cordis_inspect_query', 'plugin_manager',
'cordis_inspect', 'plugin_manager',
]))
}
const signal = new AbortController().signal
const listed = await executeToolFixture(copyCtx, {
callId: brandString<ToolCallId>('copied-preset-inspect-list'),
name: 'cordis_inspect_list',
name: 'cordis_inspect',
arguments: {},
signal,
agent: copied.agent,
@@ -1139,15 +1150,15 @@ describe('a user preset declared from the shipped cordis rows', () => {
onTestFinished(() => { spills.mockRestore() })
const queried = await executeToolFixture(copyCtx, {
callId: brandString<ToolCallId>('copied-preset-inspect-tools'),
name: 'cordis_inspect_query',
arguments: { platform: 'host', provider: 'Tool', method: 'listTools' },
name: 'cordis_inspect',
arguments: { query: { platform: 'host', provider: 'Tool', method: 'listTools' } },
signal,
agent: copied.agent,
})
expect(queried.isError).toBe(false)
// The tool catalog may exceed the inline budget; assert its complete stored text.
const queriedText = spills.mock.calls.at(-1)?.[0].content ?? resultText(queried)
for (const toolName of ['bash', 'cordis_inspect_list', 'cordis_inspect_query', 'plugin_manager']) {
for (const toolName of ['bash', 'cordis_inspect', 'plugin_manager']) {
expect(queriedText).toContain(`"name": "${toolName}"`)
}
@@ -1158,8 +1169,8 @@ describe('a user preset declared from the shipped cordis rows', () => {
const listConfigs = async (input: Record<string, string | number>, callId: string): Promise<ConfigPage['data']> => {
const page = await executeToolFixture(copyCtx, {
callId: brandString<ToolCallId>(callId),
name: 'cordis_inspect_query',
arguments: { platform: 'host', provider: 'Config', method: 'listConfigs', input },
name: 'cordis_inspect',
arguments: { query: { platform: 'host', provider: 'Config', method: 'listConfigs', input } },
signal,
agent: copied.agent,
})
@@ -1177,8 +1188,8 @@ describe('a user preset declared from the shipped cordis rows', () => {
expect(firstPage.nextOffset).toBe(5)
const projected = await executeToolFixture(copyCtx, {
callId: brandString<ToolCallId>('copied-preset-inspect-config'),
name: 'cordis_inspect_query',
arguments: { platform: 'host', provider: 'Config', method: 'listConfigs', input: { entry: toolsRow!.id } },
name: 'cordis_inspect',
arguments: { query: { platform: 'host', provider: 'Config', method: 'listConfigs', input: { entry: toolsRow!.id } } },
signal,
agent: copied.agent,
})
@@ -43,6 +43,16 @@ describe('web e2e: preset roster guidance', () => {
it('reads mode details and examples without changing the new-task default', async () => {
onTestFailed(() => saveFailureShot(page, 'preset-roster-guide'))
const settings = page.getByRole('dialog', { name: '设置' })
for (const name of ['标准模式', '创造模式']) {
const sharedTrigger = settings.getByRole('button', { name: `模式说明: ${name}`, exact: true })
await sharedTrigger.click()
const sharedGuide = page.getByRole('dialog', { name, exact: true })
await sharedGuide.getByText(/只读运行时检查/).waitFor()
expect(await sharedGuide.innerText()).not.toContain('增加了运行时检查')
if (name === '创造模式') expect(await sharedGuide.innerText()).toContain('创造模式专注于定制 DSH')
await page.keyboard.press('Escape')
await sharedGuide.waitFor({ state: 'detached' })
}
const trigger = settings.getByRole('button', { name: '模式说明: PTC 模式', exact: true })
await trigger.click()
const guide = page.getByRole('dialog', { name: 'PTC 模式', exact: true })
+1 -1
View File
@@ -486,7 +486,7 @@ it.each([false, true])('starts Creator from Plugins with Coding Tools=%s without
expect(scaffold.ctx.sessionProjections.checkpoint(creator.session).agentPreset?.val).toBe('cordis')
expect(scaffold.ctx.agentPresets.composedPreset(creator.ctx)).toBe('cordis')
expect(scaffold.ctx.tools.schemas(creator).map(tool => tool.name))
.toEqual(expect.arrayContaining(['cordis_inspect_list', 'cordis_inspect_query', 'plugin_manager']))
.toEqual(expect.arrayContaining(['cordis_inspect', 'plugin_manager']))
// The Session starts under Creator; a chip selection after the list updates records no switch.
expect(creator.session.snapshotEvents().filter(event => event.type === 'agent-preset/selected')).toEqual([])
expect(creator.session.snapshotEvents().some(event => event.type === 'user/message' || event.type === 'turn/start')).toBe(false)
+1 -1
View File
@@ -1305,7 +1305,7 @@ describe('web e2e: long Chat scroll contract', () => {
const top = viewport.top + element.clientTop
return Math.max(
Math.abs((railBox.top + railBox.bottom) / 2 - (top + composerBox.top) / 2),
Math.abs(viewport.left + element.clientLeft + element.clientWidth - railBox.right - 12),
Math.abs(railBox.left - viewport.left - element.clientLeft - 12),
Math.abs(composerBox.top - buttonBox.bottom - 16),
)
}), { timeout: 10_000 }).toBeLessThanOrEqual(GEOMETRY_TOLERANCE)
+35 -22
View File
@@ -17,13 +17,25 @@ const SESSION_ACTION_EXPECTED = join(EXPECTED, 'session-actions.expected.md')
const SESSION_SEED = fileURLToPath(new URL('../../../snapshots/web/seeded-history/session.v3.jsonl', import.meta.url))
const SESSION_TITLE = 'Session action extension'
async function openInventory(page: Page, url: string) {
/** Load the page on the Plugins page, which reports this page's client synchronization. */
async function openPlugins(page: Page, url: string) {
await page.goto(url, { waitUntil: 'load' })
await page.getByRole('navigation', { name: '全局面板' }).getByRole('button', { name: '插件', exact: true }).click()
await page.locator('[data-plugin-body]').waitFor({ timeout: 10_000 })
}
/** Open the Models settings page's add-provider card and return its API key field, a page-local draft. */
async function openDraft(page: Page) {
await openSettings(page, 'zh')
const dialog = page.getByRole('dialog', { name: '设置' })
await dialog.getByRole('button', { name: '内置插件', exact: true }).click()
await dialog.getByRole('searchbox', { name: '搜索插件' }).waitFor()
return dialog
await dialog.getByRole('button', { name: '模型', exact: true }).click()
const add = dialog.getByRole('button', { name: '添加模型提供商', exact: true })
await expect.poll(() => add.isEnabled(), { timeout: 10_000 }).toBe(true)
await add.click()
await dialog.getByLabel('提供商', { exact: true }).selectOption('minimax-cn')
const draft = dialog.getByRole('textbox', { name: 'API 密钥', exact: true })
await draft.waitFor({ timeout: 10_000 })
return draft
}
it('keeps ordered legacy Session menu rows before Archive and removes them with their fiber', async () => {
@@ -237,8 +249,9 @@ it('synchronizes two pages, disposes effects and restores an offline page from t
const other = await otherContext.newPage()
const consoles = [watchConsole(page), watchConsole(other)]
onTestFailed(() => saveFailureShot(page, 'web-e2e-client-live'))
await openInventory(page, scaffold.authenticatedUrl)
const otherInventory = await openInventory(other, scaffold.authenticatedUrl)
await openPlugins(page, scaffold.authenticatedUrl)
await openPlugins(other, scaffold.authenticatedUrl)
const draft = await openDraft(other)
let entryId: string | undefined
const toggle = async () => {
if (entryId === undefined) entryId = await scaffold.ctx.loader.create({ name: '@fixture/live-client' })
@@ -265,9 +278,8 @@ it('synchronizes two pages, disposes effects and restores an offline page from t
}
await compareOrRefreshGolden(join(EXPECTED, 'enabled.expected.md'), await captureStableAria(page, '[data-live-client]', scaffold.workspaceCwd), webSnapshotMode())
// The inventory filter is page-owned state that live composition must preserve.
const draft = otherInventory.getByRole('searchbox', { name: '搜索插件' })
await draft.fill('unfinished-filter')
// An unsaved Settings field is page-owned state that live composition must preserve.
await draft.fill('unfinished-draft')
await toggle()
for (const target of [page, other]) {
await expect.poll(() => live(target).count()).toBe(0)
@@ -276,7 +288,7 @@ it('synchronizes two pages, disposes effects and restores an offline page from t
expect((await dataset(target)).liveHits).toBe('1')
expect(await target.locator('style[data-plugin="@fixture/live-client"]').count()).toBe(0)
}
expect(await draft.inputValue()).toBe('unfinished-filter')
expect(await draft.inputValue()).toBe('unfinished-draft')
await toggle()
for (const target of [page, other]) {
await live(target).waitFor()
@@ -299,7 +311,7 @@ it('synchronizes two pages, disposes effects and restores an offline page from t
expect(await live(other).count()).toBe(1)
await otherContext.setOffline(false)
await expect.poll(() => live(other).count(), { timeout: 20_000 }).toBe(0)
expect(await draft.inputValue()).toBe('unfinished-filter')
expect(await draft.inputValue()).toBe('unfinished-draft')
expect(navigations).toBe(0)
expect(scaffold.ctx.loader.ctx.fiber.uid).toBe(host)
for (const console of consoles) expect(console.pageErrors).toEqual([])
@@ -315,7 +327,7 @@ it('keeps a failed client download local and retries without changing Host enabl
try {
const page = await browser.newPage({ locale: ZH_BROWSER_LOCALE })
onTestFailed(() => saveFailureShot(page, 'web-e2e-client-live-retry'))
await openInventory(page, scaffold.authenticatedUrl)
await openPlugins(page, scaffold.authenticatedUrl)
const bundle = (url: URL) => url.pathname.startsWith('/plugins/') && url.search.includes('@fixture/live-client/client.js')
await page.route(bundle, route => route.abort())
const entryId = await scaffold.ctx.loader.create({ name: '@fixture/live-client' })
@@ -352,9 +364,9 @@ it('recovers an uncreated client entry with rebuilt factory code without navigat
try {
const page = await browser.newPage({ locale: ZH_BROWSER_LOCALE })
onTestFailed(() => saveFailureShot(page, 'web-e2e-client-factory-rebuild'))
const inventory = await openInventory(page, scaffold.authenticatedUrl)
const draft = inventory.getByRole('searchbox', { name: '搜索插件' })
await draft.fill('unfinished-filter')
await openPlugins(page, scaffold.authenticatedUrl)
const draft = await openDraft(page)
await draft.fill('unfinished-draft')
let navigations = 0
page.on('framenavigated', () => { navigations++ })
const entryId = await scaffold.ctx.loader.create({ name: '@fixture/live-client' })
@@ -366,7 +378,7 @@ it('recovers an uncreated client entry with rebuilt factory code without navigat
await page.getByText('动态插件 r1 已启用', { exact: true }).waitFor()
await expect.poll(() => failure.count()).toBe(0)
await compareOrRefreshGolden(join(EXPECTED, 'recovered.expected.md'), await captureStableAria(page, '[data-live-client]', scaffold.workspaceCwd), webSnapshotMode())
expect(await draft.inputValue()).toBe('unfinished-filter')
expect(await draft.inputValue()).toBe('unfinished-draft')
expect(await page.locator('style[data-plugin="@fixture/live-client"]').count()).toBe(1)
expect(await page.evaluate(() => document.documentElement.dataset.liveMounts)).toBe('1')
expect(scaffold.ctx.loader.resolve(entryId).fiber?.state).toBe(2)
@@ -386,9 +398,9 @@ it('reports bootstrap rebuilds without remounting the settings page or navigatin
const page = await browser.newPage({ locale: ZH_BROWSER_LOCALE })
const console = watchConsole(page)
onTestFailed(() => saveFailureShot(page, 'web-e2e-client-bootstrap-rebuild'))
const inventory = await openInventory(page, scaffold.authenticatedUrl)
const draft = inventory.getByRole('searchbox', { name: '搜索插件' })
await draft.fill('unfinished-filter')
await openPlugins(page, scaffold.authenticatedUrl)
const draft = await openDraft(page)
await draft.fill('unfinished-draft')
const originalInput = await draft.elementHandle()
let navigations = 0
page.on('framenavigated', () => { navigations++ })
@@ -399,11 +411,12 @@ it('reports bootstrap rebuilds without remounting the settings page or navigatin
scaffold.ctx.clientModules.rebuilt('@deepseek-ai/dsh-client-modules')
const failure = page.locator('[data-client-sync-failure]')
await failure.getByText(/replacing bootstrap module .* requires a page reload/).waitFor()
await failure.getByRole('button', { name: '重试本页面同步' }).click()
// The Settings dialog holding the draft covers the Plugins page, so the retry is dispatched to its button.
await failure.getByRole('button', { name: '重试本页面同步' }).dispatchEvent('click')
await failure.getByText(/replacing bootstrap module .* requires a page reload/).waitFor()
await compareOrRefreshGolden(join(EXPECTED, 'bootstrap-rebuild.expected.md'), await captureStableAria(page, '[data-client-sync-failure]', scaffold.workspaceCwd), webSnapshotMode())
expect(await originalInput!.evaluate(input => input.isConnected)).toBe(true)
expect(await draft.inputValue()).toBe('unfinished-filter')
expect(await draft.inputValue()).toBe('unfinished-draft')
expect(scaffold.ctx.loader.ctx.fiber.uid).toBe(host)
expect(navigations).toBe(0)
expect(console.pageErrors).toEqual([])
@@ -421,7 +434,7 @@ it('removes the client UI and resources while Host cleanup is still pending', as
const browser = await chromium.launch()
try {
const page = await browser.newPage({ locale: ZH_BROWSER_LOCALE })
await openInventory(page, scaffold.authenticatedUrl)
await openPlugins(page, scaffold.authenticatedUrl)
let navigations = 0
page.on('framenavigated', () => { navigations++ })
const entryId = await scaffold.ctx.loader.create({ name: '@fixture/live-client' })
+8 -2
View File
@@ -112,7 +112,8 @@ it.skipIf(process.platform !== 'darwin').each([
expect(await card.getByText('实验性', { exact: true }).count()).toBe(1)
expect(await card.textContent()).not.toContain('将 PTC 模式改为可持久化')
expect(await card.textContent()).not.toContain('请切换到 PTC 模式')
expect(await card.textContent()).toContain('通过 npm 安装 DSH 的 Windows 用户需要单独配置 helper')
expect(await card.textContent()).toContain('允许 agent 直接操作电脑上的应用程序。')
expect(await card.textContent()).not.toContain('helper')
expect(await card.textContent()).not.toContain('Swift')
const description = await card.getByRole('button', { name: '查看 Computer Use', exact: true }).evaluate((button) => {
const element = document.getElementById(button.getAttribute('aria-describedby')!)!
@@ -175,7 +176,12 @@ it.skipIf(process.platform !== 'darwin').each([
expect(scaffold.ctx.agentPresets.composedPreset(fresh.ctx)).toBe('ptc')
expect(scaffold.ctx.tools.schemas(fresh).some(tool => tool.name === 'cua')).toBe(true)
await card.getByRole('button', { name: '查看 Computer Use', exact: true }).click()
await plugins.locator('[data-detail-document]').getByText('helperPath', { exact: true }).waitFor()
const detail = plugins.locator('[data-detail-document]')
await detail.getByRole('img', { name: '将会议要点填入备忘录的指令和输入结果' }).waitFor()
const guidance = plugins.locator('[data-cua-guidance]')
await guidance.getByText(/请谨慎在生产环境中使用/).waitFor()
expect(await guidance.textContent()).not.toContain('helperPath')
expect(await detail.textContent()).not.toContain('PTC')
toggle = page.locator('[data-plugin-panel]').getByRole('switch', { name: '启用 Computer Use', exact: true })
const persistent = page.getByRole('group', { name: 'PTC 执行方式', exact: true })
if (!codingTools) {
+38
View File
@@ -333,3 +333,41 @@ it.skipIf(process.platform !== 'darwin')('keeps system requests pending until fr
await diagnostic.waitFor({ state: 'hidden' })
expect(tripwire.pageErrors).toEqual([])
})
it.skipIf(process.platform !== 'darwin' && process.platform !== 'win32')('shows Windows setup when the helper is missing', async () => {
const root = await mkdtemp(join(tmpdir(), 'dsh-cua-missing-helper-'))
const resources: { scaffold?: WebScaffold; browser?: Browser } = {}
onTestFinished(async () => {
try { await resources.browser?.close() } finally {
try { await resources.scaffold?.close() } finally { await rm(root, { recursive: true, force: true }) }
}
})
const patch = join(root, 'missing-helper.yml')
const row = process.platform === 'win32' ? 'cua-windows' : 'cua-macos'
await writeFile(patch, JSON.stringify([{ id: row, config: { helperPath: join(root, 'missing.exe') } }]))
const scaffold = resources.scaffold = await launchWebScaffold({
profile: { packages: [{ dir: bundle, enabled: true }] }, extraOverlayPath: patch,
})
if (process.platform === 'darwin') {
// The Host inventory reads this Loader flag; only the platform-specific input is substituted on macOS.
const windows = [...scaffold.ctx.loader.entries()].find(entry => entry.options.id === 'cua-windows')
if (!windows) throw new Error('CUA bundle has no Windows provider row')
vi.spyOn(windows, 'disabled', 'get').mockReturnValue(false)
}
const browser = resources.browser = await chromium.launch()
const page = await newEnglishPage(browser)
await page.goto(scaffold.authenticatedUrl)
await page.getByRole('button', { name: 'Plugins', exact: true }).click()
await page.getByRole('button', { name: 'View Computer use', exact: true }).click()
const panel = page.locator('[data-cua-settings]')
const guidance = panel.locator('[data-cua-guidance]')
await guidance.getByText(/pnpm run build:native:x64/).waitFor()
await guidance.getByText(/helperPath/).waitFor()
const preview = page.locator('[data-detail-document] img')
await preview.evaluate(async (image) => { await (image as HTMLImageElement).decode() })
const firstSetting = panel.getByRole('group', { name: 'Default mode for new sessions', exact: true })
const previewBox = await preview.boundingBox(), guidanceBox = await guidance.boundingBox(), settingBox = await firstSetting.boundingBox()
expect(previewBox!.y + previewBox!.height).toBeLessThanOrEqual(guidanceBox!.y)
expect(guidanceBox!.y + guidanceBox!.height).toBeLessThanOrEqual(settingBox!.y)
expect(await panel.getByRole('button', { name: 'Request permission', exact: true }).count()).toBe(0)
})
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -1,5 +1,6 @@
- navigation "Session hierarchy": Seeded turn
- text: Minimal mode
- button "1 subagent"
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
@@ -1,5 +1,6 @@
- banner:
- navigation "Session hierarchy": Clickable links gallery
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -1,5 +1,6 @@
- banner:
- navigation "Session hierarchy": Use only Cordis tools. First
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -1,4 +1,5 @@
- region "Authorize computer use":
- paragraph: Computer use is an experimental preview. The agent may click the wrong button or type in the wrong window. Use caution in production environments. We recommend native PTC mode so the agent can operate apps and call other tools in the same program.
- heading "Authorize computer use" [level=3]
- group "Default mode for new sessions":
- strong: Default mode for new sessions
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "General"
- button "Models"
- button "Built-in plugins"
- button "Plugins"
- button "Agent presets"
- button "Open configuration file"
- button "Close"
@@ -11,6 +11,7 @@
- banner:
- navigation "Session hierarchy": Review deepseek-ai/deepseek-harness#314
- text: Standard mode
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -11,6 +11,7 @@
- banner:
- navigation "Session hierarchy": Review deepseek-ai/deepseek-harness#314
- text: Standard mode
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -1,6 +1,7 @@
- banner:
- navigation "Session hierarchy": workspace
- text: Standard mode
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -1,5 +1,6 @@
- banner:
- navigation "Session hierarchy": CJK strong emphasis
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -1,5 +1,6 @@
- banner:
- navigation "Session hierarchy": Markdown image policy
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -1,5 +1,6 @@
- banner:
- navigation "Session hierarchy": Inline code links
- button "Session panel"
- button "More actions"
- tablist:
- tab "Chat" [selected]
@@ -1,5 +1,6 @@
- banner:
- navigation "Session hierarchy": Math rendering
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -2,7 +2,7 @@
Touch refresh: one refresh request; no tooltip
Touch explanation: visible within the 390px viewport
- tooltip "在这里配置官方插件,安装和管理其他插件。内置插件列表及运行状态可在「设置 → 内置插件」中查看"
- tooltip "在这里配置官方插件,安装、管理和配置其他插件。"
Explanation closes on another tap or an outside touch
Keyboard focus after touch: refresh tooltip visible
Mouse hover after touch: refresh tooltip visible
@@ -1,5 +1,6 @@
- banner:
- navigation "Session hierarchy": Reference order target
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -0,0 +1,17 @@
- region "Recommended":
- heading "Recommended" [level=2]
- list:
- listitem:
- button "Daily brief": Daily brief Recent changes in the workspace and what needs follow-up, with what to do first today. Weekdays at 9:00
- listitem:
- button "Issue scan": Issue scan Sort new issues into bugs, requests, and questions, and flag duplicates and ones that need a reply. Weekdays at {{clock}}
- listitem:
- button "Plugin compatibility check": Plugin compatibility check When a new DSH version ships, check whether installed and self-made plugins need changes. Daily at {{clock}}
- listitem:
- button "Topic and paper tracking": Topic and paper tracking Search for news and new arXiv papers on chosen topics and list the key points. Daily at 9:00
- listitem:
- button "Branch and worktree cleanup": Branch and worktree cleanup List local branches and worktrees whose pull requests merged or closed, and delete them after confirmation. Fridays at {{clock}}
- listitem:
- button "Weather and travel": Weather and travel Weather for today and the next three days, with a note when an umbrella or warmer clothes are needed. Daily at 7:30
- listitem:
- button "Weekly workout plan": Weekly workout plan Plan next week's workouts around your goals and training days. Sundays at {{clock}}
@@ -0,0 +1,17 @@
- region "推荐":
- heading "推荐" [level=2]
- list:
- listitem:
- button "每日简报": 每日简报 汇总工作区最近的变化和待跟进的事,列出今天先做什么。 工作日 9:00
- listitem:
- button "Issue 扫描": Issue 扫描 把新开的 issue 分成 bug、需求、提问,标出重复的和需要回复的。 工作日 {{clock}}
- listitem:
- button "插件兼容检查": 插件兼容检查 DSH 出新版本时,检查已装的插件和自己做的插件要不要改。 每天 {{clock}}
- listitem:
- button "主题和论文追踪": 主题和论文追踪 搜索关注主题的新消息和 arXiv 新论文,各列几条要点。 每天 9:00
- listitem:
- button "分支和 worktree 清理": 分支和 worktree 清理 列出 PR 已合并或关闭的本地分支和 worktree,确认后再删。 周五 {{clock}}
- listitem:
- button "天气和出行": 天气和出行 今天和接下来三天的天气,要带伞或加衣时提一句。 每天 7:30
- listitem:
- button "一周运动计划": 一周运动计划 按目标和每周能练的日子排好下周的运动计划。 周日 {{clock}}
@@ -3,7 +3,7 @@
- navigation:
- button "General"
- button "Models"
- button "Built-in plugins"
- button "Plugins"
- button "Agent presets"
- button "Open configuration file"
- button "Close"
@@ -3,7 +3,7 @@
- navigation:
- button "General"
- button "Models"
- button "Built-in plugins"
- button "Plugins"
- button "Agent presets"
- button "Open configuration file"
- button "Close"
@@ -3,7 +3,7 @@
- navigation:
- button "通用设置"
- button "模型"
- button "内置插件"
- button "插件管理"
- button "Agent 预设"
- button "打开配置文件"
- button "关闭"
@@ -1,16 +0,0 @@
- list:
- listitem:
- button "子智能体控制工具, tool-subagent-control, 已启用":
- strong: 子智能体控制工具
- text: 让 AI 向子智能体发送消息或中断其运行。
- code: tool-subagent-control
- listitem:
- button "子智能体委派工具, tool-subagent, 已启用":
- strong: 子智能体委派工具
- text: 让 AI 将任务交给子智能体,并获取运行结果。
- code: tool-subagent
- listitem:
- button "子智能体委派工具, tool-subagent-fork, 已启用":
- strong: 子智能体委派工具
- text: 让 AI 将任务交给子智能体,并获取运行结果。
- code: tool-subagent-fork
@@ -1,5 +0,0 @@
- listitem:
- button "子智能体委派工具, tool-subagent, 已启用":
- strong: 子智能体委派工具
- text: 让 AI 将任务交给子智能体,并获取运行结果。
- code: tool-subagent
@@ -2,6 +2,7 @@
- navigation "Session hierarchy": Delegate a background job.
- button "1 subagent"
- button "1 background job"
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -1,6 +1,7 @@
- banner:
- navigation "Session hierarchy": /user-invoke-demo @"meeting notes-this-i
- text: Standard mode
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -1,6 +1,7 @@
- banner:
- navigation "Session hierarchy": /user-invoke-demo @"meeting notes-this-i
- text: Standard mode
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -1,5 +1,6 @@
- banner:
- navigation "Session hierarchy": {{workspace}}
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -1,6 +1,7 @@
- banner:
- navigation "Session hierarchy": Use the ask_user_question tool to
- text: Standard mode
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -1,6 +1,7 @@
- banner:
- navigation "Session hierarchy": Use the ask_user_question tool to
- text: Standard mode
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -1,6 +1,7 @@
- banner:
- navigation "Session hierarchy": Use the ask_user_question tool to
- text: Standard mode
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
@@ -0,0 +1,16 @@
/** Test package registering its own settings page into `settings.section`. */
window.__ModuleLoader__.load({
id: '@fixture/settings-section',
factory(require) {
const React = require('react')
return {
inject: ['slots'],
apply(ctx) {
ctx.slots.inject('settings.section', () => ctx.slots.register({
name: 'settings.section', id: 'fixture-settings-section', label: 'Fixture settings',
}, () => React.createElement('section', { 'data-fixture-settings-section': '', 'aria-label': 'Fixture settings' },
React.createElement('p', null, 'Settings content from the fixture'))))
},
}
},
})
@@ -0,0 +1,4 @@
# Web e2e fixture bundle whose browser half registers a plugin settings page.
- insert:
- id: fixture-settings-section
name: '@fixture/settings-section'
@@ -0,0 +1,2 @@
/** Host companion for the plugin settings page fixture. */
export function apply() {}
@@ -0,0 +1,12 @@
{
"name": "@fixture/settings-section",
"version": "0.0.1",
"private": true,
"type": "module",
"main": "index.js",
"exports": { ".": "./index.js", "./client": "./client.js" },
"dsh": {
"bundle": { "patch": "./cordis.patch.yml" },
"client": { "platform": "web" }
}
}
+4 -2
View File
@@ -2022,9 +2022,11 @@ it.skipIf(MODE === 'record')('reviews a change request by layer, hides test file
const lens = view.getByRole('radiogroup', { name: '分层透镜', exact: true })
const tree = view.getByRole('navigation')
await expect.poll(() => lens.getByRole('radio').allTextContents()).toEqual(['全部6', '接口1', '实现2', '测试3'])
// The lens spans the file tree with the filter field's insets, and its divider continues the tree's border.
// The lens spans the file tree with the filter field's insets, and its divider continues the tree's border. The radio group
// sits in the element that measures it, inside the toolbar cell above the tree.
const [lensBox, fieldBox, cellBox, treeBox] = await Promise.all([
lens.boundingBox(), tree.locator('input').locator('xpath=..').boundingBox(), lens.locator('xpath=..').boundingBox(), tree.locator('xpath=..').boundingBox(),
lens.boundingBox(), tree.locator('input').locator('xpath=..').boundingBox(), lens.locator('xpath=../..').boundingBox(),
tree.locator('xpath=..').boundingBox(),
])
if (lensBox === null || fieldBox === null || cellBox === null || treeBox === null) throw new Error('Lens and tree must be visible')
expect([lensBox.x, lensBox.x + lensBox.width]).toEqual([fieldBox.x, fieldBox.x + fieldBox.width])
+42 -2
View File
@@ -10,13 +10,13 @@ import { fileURLToPath } from 'node:url'
import type { Browser, Locator, Page } from 'playwright'
import { chromium } from 'playwright'
import { HIDDEN_BUNDLES } from '@deepseek-ai/dsh-official-bundles'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { afterAll, beforeAll, describe, expect, it, onTestFailed, onTestFinished } from 'vitest'
import { join } from 'node:path'
import {
assertFixtureInventory, captureStableAria, compareOrRefreshGolden,
launchWebScaffold, watchConsole, webSnapshotMode, type WebScaffold,
} from './scaffold.ts'
import { ZH_BROWSER_LOCALE, saveFailureShot } from './support.ts'
import { ZH_BROWSER_LOCALE, openSettings, saveFailureShot } from './support.ts'
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/plugin-config', import.meta.url))
const OFFICIAL_EXPECTED = join(SNAPSHOT_DIR, 'official.expected.md')
@@ -503,6 +503,46 @@ describe('web e2e: plugin configuration pages', () => {
expect(tripwire.warnings).toEqual([])
await assertFixtureInventory(SNAPSHOT_DIR, ['bundle.expected.md', 'official.expected.md', 'row.expected.md', 'subagent.expected.md', 'web-search.expected.md'])
})
})
describe('web e2e: a community plugin settings page', () => {
it('shows a settings.section entry in Settings and on its bundle row', async () => {
const scaffold = await launchWebScaffold({
profile: { packages: [{ dir: join(FIXTURE_PLUGINS, 'fixture-settings-section') }] },
})
onTestFinished(() => scaffold.close())
const browser = await chromium.launch()
onTestFinished(() => browser.close())
const page = await browser.newPage({ viewport: { width: 1680, height: 1000 }, locale: ZH_BROWSER_LOCALE })
const console = watchConsole(page)
onTestFailed(() => saveFailureShot(page, 'web-e2e-plugin-config-settings-section'))
await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
await page.getByRole('navigation', { name: '全局面板' }).getByRole('button', { name: '插件', exact: true }).click()
const panel = page.locator('[data-plugin-panel]')
await panel.getByRole('button', { name: '查看 @fixture/settings-section', exact: true }).click({ timeout: 20_000 })
const row = panel.locator('[data-plugin-row]', { hasText: 'fixture-settings-section' })
await row.waitFor({ timeout: 10_000 })
const configure = panel.getByRole('button', { name: '配置 @fixture/settings-section' })
expect(await configure.count()).toBe(0)
// Switched on, the browser half mounts and its settings page claims the row.
await panel.getByRole('switch', { name: '启用 @fixture/settings-section' }).click()
await configure.waitFor({ timeout: 30_000 })
await configure.click()
const rowPage = panel.locator('[data-plugin-row-detail="@fixture/settings-section#fixture-settings-section"]')
await rowPage.waitFor({ timeout: 10_000 })
await rowPage.getByRole('region', { name: 'Fixture settings', exact: true })
.getByText('Settings content from the fixture', { exact: true }).waitFor({ timeout: 10_000 })
// Settings keeps the same page in its navigation.
await openSettings(page, 'zh')
const dialog = page.getByRole('dialog', { name: '设置', exact: true })
await dialog.getByRole('navigation').getByRole('button', { name: 'Fixture settings', exact: true }).click()
await dialog.getByRole('region', { name: 'Fixture settings', exact: true })
.getByText('Settings content from the fixture', { exact: true }).waitFor({ timeout: 10_000 })
await page.keyboard.press('Escape')
await expect.poll(() => dialog.count(), { timeout: 5_000 }).toBe(0)
expect(console.pageErrors).toEqual([])
expect(console.warnings).toEqual([])
}, 90_000)
})
+2 -2
View File
@@ -792,14 +792,14 @@ describe('web e2e: plugin manager', () => {
await info.hover()
const hoverHelp = page.getByRole('tooltip')
await hoverHelp.waitFor()
expect(await hoverHelp.textContent()).toBe('在这里配置官方插件,安装和管理其他插件。内置插件列表及运行状态可在「设置 → 内置插件」中查看')
expect(await hoverHelp.textContent()).toBe('在这里配置官方插件,安装、管理和配置其他插件。')
await panel.getByRole('heading', { name: '插件', exact: true }).hover()
await hoverHelp.waitFor({ state: 'hidden' })
await info.focus()
await page.keyboard.press('Enter')
const help = page.getByRole('tooltip')
await help.waitFor()
expect(await help.textContent()).toContain('设置 → 内置插件')
expect(await help.textContent()).toBe('在这里配置官方插件,安装、管理和配置其他插件。')
await page.keyboard.press('Escape')
expect(await help.count()).toBe(0)
expect(await info.evaluate(element => element === document.activeElement)).toBe(true)
+10 -5
View File
@@ -450,10 +450,11 @@ export interface LaunchOptions {
harnessHome?: string
}
/** Dispose the booted tree and remove both owned temp roots, reporting every independent cleanup failure. */
async function cleanupScaffoldWorld(ctx: Context, workspaceCwd: string, persistenceRoot: string): Promise<unknown[]> {
/** Dispose the booted tree and remove the owned temp roots and overlay file, reporting every independent cleanup failure. */
async function cleanupScaffoldWorld(ctx: Context, workspaceCwd: string, persistenceRoot: string, overlayPath: string): Promise<unknown[]> {
const failures: unknown[] = []
await Promise.resolve(ctx.fiber.dispose()).catch((error: unknown) => failures.push(error))
await rm(overlayPath, { force: true }).catch((error: unknown) => failures.push(error))
await rm(workspaceCwd, { recursive: true, force: true }).catch((error: unknown) => failures.push(error))
await rm(persistenceRoot, { recursive: true, force: true }).catch((error: unknown) => failures.push(error))
return failures
@@ -526,6 +527,8 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise<We
// paths at load, and an in-process boot must NEVER touch the developer's
// real ~/.dsh document or credential file.
const harnessHome = options.harnessHome ?? join(workspaceCwd, '.dsh-home')
// Scaffolds sharing a harness home each watch their own process overlay file.
const overlayPath = join(harnessHome, 'profiles', 'scaffold', `${basename(workspaceCwd)}.overlay.patch.yml`)
// Skill discovery is model-visible input, and its roots now resolve inside a
// PRESET — a subtree this lane's include patches cannot reach, because the
// roster mounts it directly per session rather than as a row of the booted
@@ -811,6 +814,8 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise<We
bundles.push(SCAFFOLD_DEFAULTS_BUNDLE)
dependencies[SCAFFOLD_DEFAULTS_BUNDLE] = `file:${fixtureDir}`
initProfile(profileDir, bundles)
// Process-specific rows load like a `--patch` file, so profile reads see the launcher's overlay layer.
await writeFile(overlayPath, stringifyEntryYaml(processOverlays))
const manifest = readProfileManifest('dsh', profileDir)
manifest.dependencies = dependencies
await writeFile(join(profileDir, 'package.json'), JSON.stringify(manifest, null, 2) + '\n')
@@ -819,7 +824,7 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise<We
...options.profile?.packageManager === undefined ? {} : { packageManager: options.profile.packageManager },
cwd: workspaceCwd, home: harnessHome,
startedBundles: loadProfileDirectory('dsh', profileDir, INSTALL_ANCHOR).layers.map(layer => layer.packageName),
overlays: processOverlays, telemetryDisabledEnv: undefined,
overlayPaths: [overlayPath], telemetryDisabledEnv: undefined,
}
// HMR gates file-driven reloads on application readiness, which the
// launcher commits after boot; this direct harness is ready at once.
@@ -975,7 +980,7 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise<We
}
} catch (error) {
if (process.cwd() !== originalCwd) process.chdir(originalCwd)
const cleanupFailures = await cleanupScaffoldWorld(ctx, workspaceCwd, persistenceRoot)
const cleanupFailures = await cleanupScaffoldWorld(ctx, workspaceCwd, persistenceRoot, overlayPath)
if (publicProxy !== undefined) {
await publicProxy.close().catch((closeError: unknown) => cleanupFailures.push(closeError))
}
@@ -1051,7 +1056,7 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise<We
}
try {
stopObservingSessions()
failures.push(...await cleanupScaffoldWorld(ctx, workspaceCwd, persistenceRoot))
failures.push(...await cleanupScaffoldWorld(ctx, workspaceCwd, persistenceRoot, overlayPath))
if (publicProxy !== undefined) {
try {
await publicProxy.close()
+3 -1
View File
@@ -845,12 +845,14 @@ describe.skipIf(MODE === 'record')('web e2e: active Schedule catalog', () => {
it('manages cross-Session tasks from the sidebar without activating their Sessions', async () => {
const otherSessionId = brandString<SessionId>('schedule-manager-other-session')
await seedSession(scaffold, await readFile(CATALOG_FIXTURE, 'utf8'), otherSessionId, 'standard')
const other = await scaffold.ctx.schedule.create({ prompt: 'Inspect the second workspace deployment', title: 'Second workspace deployment', timing: { kind: 'at', at: '2099-08-25T12:08:00.000Z' }, target: { kind: 'session', sessionId: otherSessionId } }, otherSessionId)
const other = await scaffold.ctx.schedule.create({ prompt: 'Inspect the second workspace deployment', title: 'Second workspace deployment', timing: { kind: 'at', at: '2099-08-25T12:08:00.000Z' }, target: { kind: 'session', sessionId: otherSessionId } }, CATALOG_SESSION_ID)
await page.getByRole('button', { name: 'Automation tasks', exact: true }).click()
const manager = page.getByTestId('task-manager-page')
await manager.getByRole('heading', { name: 'Automation tasks', exact: true }).waitFor()
const tasks = manager.getByRole('list', { name: 'Task catalog' })
await expect.poll(() => tasks.getByRole('listitem').count()).toBe(4)
const creatorMark = page.locator(`[data-row-key="session:${CATALOG_SESSION_ID}"] [data-session-schedule-mark]`)
await expect.poll(() => creatorMark.textContent()).toBe('3 automation tasks')
expect(scaffold.ctx.agents.get(CATALOG_SESSION_ID)).toBeUndefined()
expect(scaffold.ctx.agents.get(otherSessionId)).toBeUndefined()
+94 -3
View File
@@ -1,9 +1,10 @@
/** Schedule creation, prompt prefill, and editing through the shipped Web composition. */
import { chromium } from 'playwright'
import { fileURLToPath } from 'node:url'
import { chromium, type Locator } from 'playwright'
import { expect, it } from 'vitest'
import type { ScheduleTiming } from '@deepseek-ai/dsh-schedule/client'
import { launchWebScaffold, watchConsole } from './scaffold.ts'
import { writeComposerDraft } from './support.ts'
import { captureStableAria, compareOrRefreshGolden, launchWebScaffold, watchConsole, webSnapshotMode } from './scaffold.ts'
import { revealNavigationDrawer, writeComposerDraft } from './support.ts'
it.each([
{ locale: 'en', panel: 'Automation tasks', create: 'New', menu: 'Choose a creation method', chat: 'Create in a session',
@@ -48,6 +49,96 @@ it.each([
}
})
it.each([
{ locale: 'en', panel: 'Automation tasks', heading: 'Recommended', title: 'Daily brief',
prompt: 'Create an automation task named "Daily brief": every weekday at 9:00, review the last 24 hours of changes in the current workspace and list what needs my follow-up and what to do first today; when the workspace is a code repository, also cover new commits, pull requests awaiting my review, and failing CI.' },
{ locale: 'zh', panel: '自动化任务', heading: '推荐', title: '每日简报',
prompt: '创建一个名为「每日简报」的自动化任务:每个工作日 9:00 查看当前工作区过去 24 小时的变化,列出需要我跟进的事和今天先做的事;工作区是代码仓库时,也看新提交、待我评审的 PR 和失败的 CI。' },
])('prefills a recommended task request from the empty task page in $locale', async (copy) => {
const scaffold = await launchWebScaffold({ firstUse: true })
let browser: Awaited<ReturnType<typeof chromium.launch>> | undefined
try {
browser = await chromium.launch()
const page = await browser.newPage({ viewport: { width: 1440, height: 960 }, locale: copy.locale })
await page.addInitScript((locale) => { localStorage.setItem('dsh.locale', locale) }, copy.locale)
const tripwire = watchConsole(page)
await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
const input = page.locator('[data-composer-input][contenteditable="true"]').first()
for (const draft of ['', 'Existing unsent draft']) {
await writeComposerDraft(page, input, draft)
await page.getByRole('button', { name: copy.panel, exact: true }).click()
const manager = page.getByTestId('task-manager-page')
const recommendations = manager.getByRole('region', { name: copy.heading, exact: true })
const recommendation = recommendations.getByRole('button', { name: copy.title, exact: true })
await recommendation.waitFor()
expect(await recommendations.getByRole('button').count()).toBe(7)
if (draft === '') {
expect(await recommendationColumns(recommendations)).toBe(2)
await compareOrRefreshGolden(
fileURLToPath(new URL(`./expected/schedule-recommendations-${copy.locale}.expected.md`, import.meta.url)),
await captureStableAria(page, '[data-testid="schedule-recommendations"]', scaffold.workspaceCwd),
webSnapshotMode(),
)
}
await recommendation.click()
await manager.waitFor({ state: 'detached' })
await input.getByText(copy.prompt, { exact: true }).waitFor()
expect(await input.evaluate(element => [...element.children].map(paragraph => paragraph.textContent).join('\n')))
.toBe(draft === '' ? copy.prompt : `${draft}\n${copy.prompt}`)
const events = scaffold.ctx.agents.list().flatMap(agent => agent.session.snapshotEvents())
expect(events.filter(event => event.type === 'user/message' || event.type === 'turn/start')).toEqual([])
expect(await scaffold.ctx.schedule.catalog()).toEqual([])
}
expect(tripwire.pageErrors).toEqual([])
} finally {
try { await browser?.close() } finally { await scaffold.close() }
}
})
/** Number of grid tracks the recommendation list lays its tiles in. */
async function recommendationColumns(recommendations: Locator): Promise<number> {
return recommendations.getByRole('list').evaluate(list => getComputedStyle(list).gridTemplateColumns.split(' ').length)
}
it.each([
{ locale: 'en', panel: 'Automation tasks', title: 'Daily brief' },
{ locale: 'de', panel: 'Automatisierungsaufgaben', title: 'Tagesüberblick' },
] as const)('shows every recommendation title and description in full on phone and desktop widths in $locale', async (copy) => {
const scaffold = await launchWebScaffold({ firstUse: true })
let browser: Awaited<ReturnType<typeof chromium.launch>> | undefined
try {
browser = await chromium.launch()
// 680px puts the list just above the 600px column breakpoint, where each column is narrowest.
for (const { width, columns } of [{ width: 390, columns: 1 }, { width: 680, columns: 2 }, { width: 1440, columns: 2 }]) {
const phone = width < 600
const page = await browser.newPage({ viewport: { width, height: 900 }, isMobile: phone, hasTouch: phone, locale: copy.locale })
await page.addInitScript((locale) => { localStorage.setItem('dsh.locale', locale) }, copy.locale)
const tripwire = watchConsole(page)
await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
await revealNavigationDrawer(page, copy.locale)
await page.getByRole('button', { name: copy.panel, exact: true }).click()
const recommendations = page.getByTestId('schedule-recommendations')
await recommendations.getByRole('button', { name: copy.title, exact: true }).waitFor()
await page.evaluate(() => document.fonts.ready)
expect(await recommendationColumns(recommendations)).toBe(columns)
// The title carries the button's name and the first description reference is the description; neither clips.
expect(await recommendations.getByRole('button').evaluateAll(buttons => buttons.flatMap((button) => {
const name = button.getAttribute('aria-label')!
const title = [...button.querySelectorAll('span')].find(span => span.textContent === name)!
const description = document.getElementById(button.getAttribute('aria-describedby')!.split(' ')[0]!)!
return [
...title.scrollWidth > title.clientWidth ? [`title: ${name}`] : [],
...description.scrollHeight > description.clientHeight ? [`description: ${name}`] : [],
]
}))).toEqual([])
expect(tripwire.pageErrors).toEqual([])
await page.close()
}
} finally {
try { await browser?.close() } finally { await scaffold.close() }
}
})
it('opens stored timing fields immediately without selecting another repeat option', async () => {
const scaffold = await launchWebScaffold({ firstUse: true })
let browser: Awaited<ReturnType<typeof chromium.launch>> | undefined
+253
View File
@@ -0,0 +1,253 @@
/**
* Session panel layout in the shipped Web composition. The panel's stylesheet
* decides whether the Chat View's end gutter holds the docked panel and tells
* the plugin through a 1px dock probe, and it lays out the rows that
* contributors mark. jsdom cannot evaluate that stylesheet, so this measures
* the probe, the panel, and the toggle around the docking boundary, and the
* working folder row without and with a directory context menu.
*/
import { readFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed, onTestFinished } from 'vitest'
import { createLaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment'
import type { SessionId } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
import { launchWebScaffold, seedSession, watchConsole, webSnapshotMode, type WebScaffold } from './scaffold.ts'
import { newEnglishPage, saveFailureShot } from './support.ts'
const FIXTURE = fileURLToPath(new URL('../../../snapshots/web/fresh-round-trip/session.v3.jsonl', import.meta.url))
const MODE = webSnapshotMode()
const SEED_ID = brandString<SessionId>('session-panel-layout-web-e2e')
/** The default transcript width in a frame wide enough to dock. */
const TRANSCRIPT = 880
/** The gutter that holds the docked panel: 40px clear of the transcript, its 300px minimum width, and the 8px edge inset. */
const DOCK_GUTTER = 348
/** What the layout says about docking: the gutter, the probe, the panel's presentation and insets, and the toggle. */
function docking(page: Page) {
return page.evaluate(() => {
const layer = document.querySelector<HTMLElement>('[data-chat-aside]')
const column = document.querySelector<HTMLElement>('[data-chat-flow]')
const probe = document.querySelector<HTMLElement>('[data-session-panel-probe]')
const toggle = document.querySelector<HTMLElement>('[data-session-panel-toggle]')
if (layer === null || column === null || probe === null || toggle === null) {
throw new Error('aside layer, transcript column, dock probe, or panel toggle is missing')
}
const frame = layer.getBoundingClientRect()
const flow = column.getBoundingClientRect()
const panel = document.querySelector<HTMLElement>('[data-session-panel]')
const box = panel?.getBoundingClientRect()
return {
gutter: (frame.width - flow.width) / 2,
probe: probe.getBoundingClientRect().width,
presentation: panel?.dataset['sessionPanel'] ?? null,
expanded: toggle.getAttribute('aria-expanded'),
panel: box === undefined ? null : { width: box.width, clear: box.left - flow.right, edge: frame.right - box.right },
}
})
}
/** Open the seeded Session through the sidebar and wait for the panel's dock probe. */
async function openSeed(page: Page): Promise<void> {
const session = page.locator(`[data-row-key="session:${SEED_ID}"]`)
await expect.poll(async () => {
if (await session.isVisible()) return true
const group = page.locator('[role="treeitem"][aria-expanded]').first()
if (await group.count() > 0 && await group.getAttribute('aria-expanded') === 'false') await group.click()
return session.isVisible()
}, { timeout: 15_000 }).toBe(true)
await session.click()
await page.locator('[data-session-panel-probe]').waitFor({ state: 'attached', timeout: 30_000 })
}
/** Wait until the panel shows this way (null: not at all) and its entrance has finished. */
async function shows(page: Page, presentation: 'docked' | 'overlay' | null): Promise<void> {
await expect.poll(async () => (await docking(page)).presentation, { timeout: 10_000 }).toBe(presentation)
if (presentation === null) return
await page.locator('[data-session-panel]').evaluate(async (element) => {
await Promise.all(element.getAnimations().map(animation => animation.finished))
})
}
/**
* The working folder row as laid out: its line, how far the centers of its
* icon and menu columns sit from its edges, the room after its text, and what
* the pointer state shows. `menu` is null while the menu part renders nothing.
*/
function rowLayout(page: Page) {
return page.locator('[data-session-panel] [data-session-panel-project]').evaluate((element) => {
const box = element.getBoundingClientRect()
const icon = element.querySelector('[data-row-part="icon"]')!.getBoundingClientRect()
const content = element.querySelector('[data-row-part="content"]')!
const menu = element.querySelector<HTMLElement>('[data-row-part="menu"]')!
const column = menu.getBoundingClientRect()
const button = menu.querySelector('button')?.getBoundingClientRect()
return {
height: box.height,
iconCenter: icon.left + icon.width / 2 - box.left,
iconSize: [icon.width, icon.height],
clipped: getComputedStyle(content).textOverflow,
afterText: box.right - content.getBoundingClientRect().right,
menu: button === undefined
? null
: {
center: box.right - (column.left + column.width / 2),
target: [button.width, button.height],
opacity: getComputedStyle(menu).opacity,
},
hovered: element.matches(':hover'),
highlighted: getComputedStyle(element).backgroundColor !== 'rgba(0, 0, 0, 0)',
}
})
}
describe.skipIf(MODE === 'record')('web e2e: Session panel layout', () => {
let scaffold: WebScaffold
let browser: Browser
let page: Page
let tripwire: ReturnType<typeof watchConsole>
/** Viewport width the application keeps outside the Chat frame. */
let chrome = 0
/** Resize the window so the Chat View's end gutter is exactly `gutter`, and wait for the layout to follow. */
async function setGutter(gutter: number): Promise<void> {
await page.setViewportSize({ width: TRANSCRIPT + 2 * gutter + chrome, height: page.viewportSize()!.height })
await expect.poll(async () => (await docking(page)).gutter, { timeout: 10_000 }).toBe(gutter)
}
beforeAll(async () => {
scaffold = await launchWebScaffold()
await seedSession(scaffold, await readFile(FIXTURE, 'utf8'), SEED_ID)
browser = await chromium.launch()
page = await newEnglishPage(browser)
await page.emulateMedia({ reducedMotion: 'reduce' })
tripwire = watchConsole(page)
await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
}, 120_000)
/** Open the seeded Session and learn how much of the window lies outside the Chat frame. */
async function openSession(): Promise<void> {
if (chrome !== 0) return
await openSeed(page)
const frame = await page.locator('[data-chat-aside]').evaluate(element => element.getBoundingClientRect().width)
chrome = page.viewportSize()!.width - frame
}
afterAll(async () => {
const failures: unknown[] = []
try { await browser?.close() } catch (error) { failures.push(error) }
try { await scaffold?.close() } catch (error) { failures.push(error) }
if (failures.length > 0) throw new AggregateError(failures, 'Session panel layout teardown failed')
})
it('docks exactly from the gutter that holds the panel at its minimum width', async () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-session-panel-dock'))
await openSession()
expect(Number.isInteger(chrome)).toBe(true)
await setGutter(DOCK_GUTTER - 1)
await shows(page, null)
expect(await docking(page)).toEqual({ gutter: DOCK_GUTTER - 1, probe: 0, presentation: null, expanded: 'false', panel: null })
// Half a pixel short, the probe is half a pixel wide and the panel stays hidden.
await setGutter(DOCK_GUTTER - 0.5)
expect(await docking(page)).toEqual({ gutter: DOCK_GUTTER - 0.5, probe: 0.5, presentation: null, expanded: 'false', panel: null })
await setGutter(DOCK_GUTTER)
await shows(page, 'docked')
expect(await docking(page)).toEqual({
gutter: DOCK_GUTTER, probe: 1, presentation: 'docked', expanded: 'true', panel: { width: 300, clear: 40, edge: 8 },
})
// A wider gutter widens the panel to its maximum at the same edge inset; the probe stays 1px.
await setGutter(DOCK_GUTTER + 100)
expect(await docking(page)).toEqual({
gutter: DOCK_GUTTER + 100, probe: 1, presentation: 'docked', expanded: 'true', panel: { width: 360, clear: 80, edge: 8 },
})
await setGutter(DOCK_GUTTER - 1)
await shows(page, null)
expect((await docking(page)).expanded).toBe('false')
expect(tripwire.pageErrors).toEqual([])
})
it('floats narrower than it docks, at the same edge inset, and docks once the gutter holds it', async () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-session-panel-overlay'))
await openSession()
const toggle = page.locator('[data-session-panel-toggle]')
await setGutter(260)
await shows(page, null)
await toggle.click()
await shows(page, 'overlay')
const overlay = await docking(page)
expect(overlay).toMatchObject({ probe: 0, presentation: 'overlay', expanded: 'true', panel: { width: 280, edge: 8 } })
// The overlay covers part of the transcript instead of keeping clear of it.
expect(overlay.panel?.clear).toBeLessThan(0)
await page.keyboard.press('Escape')
await shows(page, null)
expect((await docking(page)).expanded).toBe('false')
// An open overlay gives way to the docked panel when the window widens enough.
await toggle.click()
await shows(page, 'overlay')
await setGutter(DOCK_GUTTER)
await shows(page, 'docked')
expect(await docking(page)).toMatchObject({ probe: 1, expanded: 'true', panel: { width: 300, clear: 40, edge: 8 } })
expect(tripwire.pageErrors).toEqual([])
})
it('lays the working folder row out by its marks, with no room or highlight for a menu that renders nothing', async () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-session-panel-row'))
await openSession()
await setGutter(DOCK_GUTTER + 100)
await shows(page, 'docked')
const row = page.locator('[data-session-panel] [data-session-panel-project]')
await row.waitFor()
await page.mouse.move(5, 5)
// This composition registers no directory menu entries, so the shared More button renders nothing:
// the text runs to the row's 6px padding, and the row has nothing to highlight for.
const resting = { height: 28, iconCenter: 14, iconSize: [16, 16], clipped: 'ellipsis', afterText: 6, menu: null, highlighted: false }
expect(await rowLayout(page)).toEqual({ ...resting, hovered: false })
await row.hover()
expect(await rowLayout(page)).toEqual({ ...resting, hovered: true })
expect(tripwire.pageErrors).toEqual([])
})
it('puts a rendered menu on the panel end column and shows it, with the row highlight, on hover', async () => {
// The directory context menu comes from Open In; SSH facts keep it from probing this runner's native applications.
const withMenu = await launchWebScaffold({ openInAppEnvironment: createLaunchEnvironmentSnapshot([
{ source: 'process', values: { SSH_CONNECTION: '10.0.0.2 55000 10.0.0.9 22' } },
]) })
onTestFinished(() => withMenu.close())
await seedSession(withMenu, await readFile(FIXTURE, 'utf8'), SEED_ID)
const other = await newEnglishPage(browser)
onTestFinished(() => other.close())
onTestFailed(() => saveFailureShot(other, 'web-e2e-session-panel-row-menu'))
await other.emulateMedia({ reducedMotion: 'reduce' })
const errors = watchConsole(other)
// Wide enough for the gutter to hold the docked panel.
await other.setViewportSize({ width: 2200, height: 1000 })
await other.goto(withMenu.authenticatedUrl, { waitUntil: 'load' })
await openSeed(other)
await shows(other, 'docked')
const row = other.locator('[data-session-panel] [data-session-panel-project]')
await row.locator('[data-row-part="menu"] button').waitFor({ state: 'attached' })
await other.mouse.move(5, 5)
// The 16px menu column and the 8px gap before it follow the text; the 24px target reaches past the column.
const resting = { height: 28, iconCenter: 14, iconSize: [16, 16], clipped: 'ellipsis', afterText: 30 }
expect(await rowLayout(other)).toEqual({
...resting, menu: { center: 14, target: [24, 24], opacity: '0' }, hovered: false, highlighted: false,
})
await row.hover()
await expect.poll(async () => (await rowLayout(other)).menu?.opacity).toBe('1')
expect(await rowLayout(other)).toEqual({
...resting, menu: { center: 14, target: [24, 24], opacity: '1' }, hovered: true, highlighted: true,
})
await other.mouse.move(5, 5)
await expect.poll(async () => (await rowLayout(other)).highlighted).toBe(false)
expect(errors.pageErrors).toEqual([])
})
})
@@ -189,12 +189,6 @@ it('shares settings card materials and control sizes in both palettes', async ()
await compareOrRefreshGolden(join(EXPECTED, 'account.expected.md'),
await captureStableAria(page, 'section[aria-label="账号与余额"]', scaffold.workspaceCwd), webSnapshotMode())
await dialog.getByRole('button', { name: '内置插件', exact: true }).click()
await dialog.getByRole('button', { name: /^全局/ }).click()
const plugin = dialog.locator('[data-plugin-scope="global"] [data-plugin-entry]').first()
await plugin.waitFor()
expect(await appearance(plugin)).toMatchObject(material)
await dialog.getByRole('button', { name: 'Agent 预设', exact: true }).click()
const preset = dialog.locator('li').first()
await preset.waitFor()
+26 -93
View File
@@ -24,11 +24,8 @@ import { brandString } from '@deepseek-ai/dsh-brand'
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/settings-chrome', import.meta.url))
const DIALOG_EXPECTED = join(SNAPSHOT_DIR, 'dialog.expected.md')
const PLUGINS_EXPECTED = join(SNAPSHOT_DIR, 'plugins.expected.md')
const PLUGIN_INSTANCES_EXPECTED = join(SNAPSHOT_DIR, 'plugin-instances.expected.md')
// The English fallback surface: a browser naming no shipped language.
const DIALOG_EN_EXPECTED = join(SNAPSHOT_DIR, 'dialog-en.expected.md')
const PLUGIN_ROW_SELECTOR = '[data-plugin-scope="preset"] [data-plugin-entry="tool-subagent"]'
const MODE = webSnapshotMode()
const SCREENSHOTS = 'screenshots/collapse-timing-settings'
const SCREENSHOT_DIR = fileURLToPath(new URL(`../../../.artifacts/${SCREENSHOTS}`, import.meta.url))
@@ -140,84 +137,6 @@ describe('web e2e: settings modal and General preferences', () => {
await dialog.getByRole('button', { name: '模型', exact: true }).click()
await expect.poll(() => dialog.getByRole('button', { name: '模型', exact: true }).getAttribute('aria-current'), { timeout: 5_000 }).toBe('true')
expect(await dialog.getByRole('button', { name: '通用设置' }).getAttribute('aria-current')).toBeNull()
// Built-in plugins: the read-only Plugin list, a projection of the same
// assembled Loader tree, shown as the section's one page; management and
// configuration live on the sidebar's Plugins panel (its own scenario files
// drive that page over a profile runtime). Capture one stable shipped row
// rather than the whole inventory so adding an unrelated plugin does not
// rewrite this surface's golden.
await dialog.getByRole('button', { name: '内置插件', exact: true }).click()
await dialog.getByRole('heading', { name: '内置插件', exact: true }).waitFor({ timeout: 10_000 })
// The preset group starts open under its display-only switcher; the global group starts folded.
const presetSwitcher = dialog.getByRole('button', { name: '选择要查看的 Agent 预设' })
await presetSwitcher.waitFor({ timeout: 10_000 })
// The shipped default's zh display name comes from the zh dictionaries.
expect(await presetSwitcher.textContent()).toBe('标准模式(默认)')
const presetToggle = dialog.getByRole('button', { name: '会话插件', exact: true })
expect(await presetToggle.getAttribute('aria-expanded')).toBe('true')
expect(await dialog.locator('[data-plugin-scope="preset"] [data-plugin-entry]').count()).toBeGreaterThan(0)
const globalToggle = dialog.getByRole('button', { name: /^全局/ })
expect(await globalToggle.getAttribute('aria-expanded')).toBe('false')
await globalToggle.click()
const pluginRow = dialog.locator(PLUGIN_ROW_SELECTOR)
await pluginRow.waitFor({ timeout: 10_000 })
const expectedPluginCount = [...scaffold.ctx.loader.entries()]
.filter(entry => !entry.options.group)
.length
const pluginSearch = dialog.getByRole('searchbox', { name: '搜索插件' })
expect(await pluginSearch.count()).toBe(1)
// Every Loader entry appears exactly once in the global group — rows the
// presets took over included, preset compositions excluded.
expect(await dialog.locator('[data-plugin-scope="global"] [data-plugin-entry]').count())
.toBe(expectedPluginCount)
// A plainly enabled row states its status only in its accessible name: it
// carries no tag, and an active fiber draws no dot, so no global row shows
// either. Guard the assertions against matching nothing because no row is enabled.
const enabledRows = dialog.locator('[data-plugin-scope="global"] [data-plugin-entry] button[aria-label$="已启用"]')
expect(await enabledRows.count()).toBeGreaterThan(0)
expect(await enabledRows.getByText('已启用', { exact: true }).count()).toBe(0)
expect(await dialog.locator('[data-plugin-scope="global"] [role="img"][aria-label="运行中"]').count()).toBe(0)
expect(await dialog.getByText('由 Agent 预设按会话组成', { exact: true }).count()).toBe(1)
expect(await dialog.getByText('系统与所有会话共用', { exact: true }).count()).toBe(1)
expect(await dialog.getByRole('button', { name: '内置插件', exact: true }).getAttribute('aria-current')).toBe('true')
// One contribution shows as the page itself, without a tab row.
expect(await dialog.getByRole('tab').count()).toBe(0)
expect(await dialog.getByRole('button', { name: '模型', exact: true }).getAttribute('aria-current')).toBeNull()
const pluginsSnapshot = await captureStableAria(
page,
PLUGIN_ROW_SELECTOR,
scaffold.workspaceCwd,
)
await compareOrRefreshGolden(PLUGINS_EXPECTED, pluginsSnapshot, MODE)
await pluginSearch.fill('tool-subagent')
const instanceRows = [
['tool-subagent', '已启用'],
['tool-subagent-fork', '已启用'],
] as const
for (const [entryId, status] of instanceRows) {
const row = dialog.locator(`[data-plugin-scope="preset"] [data-plugin-entry="${entryId}"]`)
const name = `子智能体委派工具, ${entryId}, ${status}`
const trigger = row.getByRole('button', { name, exact: true })
await trigger.waitFor({ timeout: 10_000 })
expect(await trigger.getAttribute('aria-expanded')).toBe('false')
const identity = row.locator('code')
expect(await identity.textContent()).toBe(entryId)
expect(await identity.getAttribute('title')).toBe(entryId)
}
expect(await dialog.locator('[data-plugin-entry="tool-subagent-codex"], [data-plugin-entry="tool-subagent-claude-code"]').count()).toBe(0)
const instancesSnapshot = await captureStableAria(
page,
'[data-plugin-scope="preset"] ul',
scaffold.workspaceCwd,
)
await compareOrRefreshGolden(PLUGIN_INSTANCES_EXPECTED, instancesSnapshot, MODE)
await dialog.getByRole('button', {
name: '子智能体委派工具, tool-subagent-fork, 已启用',
exact: true,
}).click()
expect(await dialog.locator('[data-plugin-entry="tool-subagent-fork"] button')
.getAttribute('aria-expanded')).toBe('true')
await pluginSearch.fill('')
// Close path 1: Escape.
await page.keyboard.press('Escape')
await expect.poll(() => page.getByRole('dialog', { name: '设置' }).count(), { timeout: 5_000 }).toBe(0)
@@ -229,6 +148,27 @@ describe('web e2e: settings modal and General preferences', () => {
expect(tripwire.pageErrors).toEqual([])
}, 60_000)
it('leaves Settings for the sidebar Plugins page from the Plugin management entry', async () => {
const linkPage = await browser.newPage({ viewport: { width: 1680, height: 1000 }, locale: ZH_BROWSER_LOCALE })
onTestFinished(() => linkPage.close())
onTestFailed(() => saveSettingsFailureShot(linkPage, 'settings-plugins-link'))
const linkConsole = watchConsole(linkPage)
await linkPage.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
await openSettings(linkPage, 'zh')
const dialog = linkPage.getByRole('dialog', { name: '设置', exact: true })
const sections = await dialog.getByRole('navigation').getByRole('button').allTextContents()
// The entry holds the position between Models and Agent presets.
expect(sections.indexOf('插件管理')).toBe(sections.indexOf('模型') + 1)
expect(sections.indexOf('Agent 预设')).toBe(sections.indexOf('插件管理') + 1)
await dialog.getByRole('button', { name: '插件管理', exact: true }).click()
await expect.poll(() => dialog.count(), { timeout: 5_000 }).toBe(0)
const pluginsEntry = linkPage.getByRole('navigation', { name: '全局面板' }).getByRole('button', { name: '插件', exact: true })
await expect.poll(() => pluginsEntry.getAttribute('aria-current'), { timeout: 10_000 }).toBe('page')
await linkPage.locator('[data-plugin-panel]').getByRole('heading', { name: '插件', exact: true }).waitFor({ timeout: 10_000 })
expect(linkConsole.pageErrors).toEqual([])
expect(linkConsole.warnings).toEqual([])
})
it('scrolls overflowing section navigation independently of the title and settings content', async () => {
const overflowPage = await browser.newPage({ viewport: { width: 1280, height: 768 }, locale: ZH_BROWSER_LOCALE })
onTestFinished(() => overflowPage.close())
@@ -953,17 +893,12 @@ describe('web e2e: settings modal and General preferences', () => {
const dialog = enPage.getByRole('dialog', { name: 'Settings' })
await dialog.waitFor({ timeout: 10_000 })
await dialog.getByRole('button', { name: 'English' }).waitFor({ timeout: 10_000 })
// The plugin list resolves shipped preset names through the en
// dictionaries instead of echoing the preset declarations' Chinese metadata.
await dialog.getByRole('button', { name: 'Built-in plugins', exact: true }).click()
const presetSwitcher = dialog.getByRole('button', { name: 'Choose the agent preset to inspect' })
await presetSwitcher.waitFor({ timeout: 10_000 })
expect(await presetSwitcher.textContent()).toBe('Standard mode (default)')
// The plugin manager speaks the en dictionary too: its sidebar entry
// and the unavailable notice a scaffold without a profile runtime shows.
await enPage.keyboard.press('Escape')
// The plugin manager speaks the en dictionary too: its Settings entry
// leaves Settings for the Plugins page, whose header and the sidebar entry are English.
await dialog.getByRole('button', { name: 'Plugins', exact: true }).click()
await expect.poll(() => enPage.getByRole('dialog', { name: 'Settings' }).count(), { timeout: 5_000 }).toBe(0)
await enPage.getByRole('navigation', { name: 'Global panels' }).getByRole('button', { name: 'Plugins', exact: true }).click()
await expect.poll(() => enPage.getByRole('navigation', { name: 'Global panels' })
.getByRole('button', { name: 'Plugins', exact: true }).getAttribute('aria-current'), { timeout: 10_000 }).toBe('page')
await enPage.getByRole('button', { name: 'Add plugin', exact: true })
.waitFor({ timeout: 10_000 })
// This page has no closing inventory spec to sweep its console, so the
@@ -1042,8 +977,6 @@ describe('web e2e: settings modal and General preferences', () => {
'dialog.expected.md',
'collapse-timing-en.expected.md',
'collapse-timing-zh.expected.md',
'plugin-instances.expected.md',
'plugins.expected.md',
])
})
})
+4 -8
View File
@@ -464,18 +464,14 @@ function assertLeanChildRecord(agent: Agent): void {
}
/**
* The catalog the shipped Web composition puts in front of the model, minus the
* ripgrep-dependent pair below. The absences are deliberate, not incidental
* gaps: the `cordis_*` toolset executes model-written JavaScript that no
* sandbox row confines, `mcp_*` servers spawn outside `ctx.shell`, and `ralph`
* runs unsupervised rounds whose completion is a worker self-report.
* `web_fetch` is present because it adds no network reach beyond the
* mounted shell tools. The composition
* Agent Note owns the rationale and its sources.
* The shipped Standard catalog, minus the ripgrep-dependent pair below.
* Runtime inspection is read-only. Generated-code execution tools, external
* MCP servers, and ralph are not enabled in this preset.
*/
const EXPECTED_TOOLS = [
'ask_user_question',
'bash',
'cordis_inspect',
'create_goal',
'edit',
'exit_plan_mode',
@@ -1,6 +1,7 @@
- banner:
- navigation "Session hierarchy": Stream one TypeScript fence for
- text: Standard mode
- button "Session panel"
- button "More actions"
- button "Open right sidebar"
- tablist:
+1 -2
View File
@@ -38,8 +38,7 @@ it('lists dsh-doc once without loading instructions or calling tools for an ordi
expect(events.filter(event => event.type === 'user/message'
&& event.data.source.kind === 'skill-invocation')).toEqual([])
const names = scaffold.ctx.tools.schemas(agent).map(tool => tool.name)
expect(names).not.toContain('cordis_inspect_list')
expect(names).not.toContain('cordis_inspect_query')
expect(names).toContain('cordis_inspect')
await page.getByText('READY', { exact: true }).waitFor()
await assertFixtureInventory(dirname(FIXTURE), ['session.v4.jsonl'])
} finally {
+2 -2
View File
@@ -308,14 +308,14 @@ export function probeFreePort(): Promise<number> {
* @param page - browser page with the mounted sidebar.
* @param locale - current UI language.
*/
export async function revealNavigationDrawer(page: Page, locale: 'en' | 'zh' | 'ja'): Promise<void> {
export async function revealNavigationDrawer(page: Page, locale: 'en' | 'zh' | 'ja' | 'de'): Promise<void> {
const drawer = await page.evaluate(() => window.innerWidth < 768
&& !document.documentElement.hasAttribute('data-windows-titlebar'))
await page.waitForFunction(expected => Boolean(document.querySelector('[data-sidebar-drawer]')) === expected, drawer)
const closed = page.locator('[data-sidebar-drawer][data-sidebar-collapsed]')
if (await closed.count() === 0) return
await page.locator('[data-shell-leading]').getByRole('button', {
name: { en: 'Open sidebar', zh: '打开侧边栏', ja: 'サイドバーを開く' }[locale], exact: true,
name: { en: 'Open sidebar', zh: '打开侧边栏', ja: 'サイドバーを開く', de: 'Seitenleiste öffnen' }[locale], exact: true,
}).click()
await closed.waitFor({ state: 'detached' })
}
+1
View File
@@ -25,6 +25,7 @@
"exclude": [
"tests/home-whale.e2e.ts",
"tests/sidebar-drawer.e2e.ts",
"tests/session-panel-layout.e2e.ts",
"tests/creation-recommendations.e2e.ts",
"tests/plugin-recommendations.e2e.ts",
"tests/deepseek-chat-import.e2e.ts",
Loaded 100 of 742 files, more files were not shown because too many files have changed in this diff. Show more