Merge branch 'master' into xtr/trajectory-subcall-folding
This commit is contained in:
commit
d8eae171cb
605 files changed
+12793
-2735
No files matched your search
+2
-2
@@ -9,8 +9,8 @@
|
||||
en: edefff7cd986a509
|
||||
zh: a270839fa86976a2
|
||||
/agent-note-guided-plugin-installation/decision:
|
||||
en: 5448b9f8aaa9a569
|
||||
zh: 9024c5328c5da3bd
|
||||
en: ca0224ae08a4b383
|
||||
zh: 780603ca24487949
|
||||
/agent-note-guided-plugin-installation/alternatives-considered:
|
||||
en: be64b541f4d81e7c
|
||||
zh: 8600531c08ab4288
|
||||
|
||||
@@ -14,7 +14,7 @@ The install dialog put a spec straight into `pnpm add` and showed pnpm's termina
|
||||
|
||||
**A failed or cancelled installation restores the profile files.** `installBundle` snapshots `package.json` and `pnpm-lock.yaml` before pnpm runs and puts them back when pnpm fails, when the run is cancelled, or when the package pnpm added declares no bundle patch. This reverses, for installations only, the [manager's decision](2026-09-14-current-profile-plugin-management.md) to retain partial changes: an installation that did not produce a usable bundle must not leave a dependency the page cannot show. Removals keep that decision. Downloaded files can stay under `node_modules` and the pnpm store.
|
||||
|
||||
**A failed run is classified where the facts are.** `classifyInstallFailure` reads how the run ended and what pnpm printed — its `ERR_PNPM_*` codes and Node's errno names — into `packageResult.kind`. A run the manager terminated is classified `timeout` whatever exit status the signal left behind, so installation restores the files and removal reports failure instead of reading it as a success ([run bounds](../../../../packages/boot/plugin-manager/README.md)). The client shows the kind as one line and folds pnpm's output behind the details. Parsing the log is confined to this one function with a fixture-driven test.
|
||||
**A failed run is classified where the facts are.** `classifyInstallFailure` reads how the run ended and what pnpm printed — its `ERR_PNPM_*` codes and Node's errno names — into `packageResult.kind`. A run the manager terminated is classified `timeout` whatever exit status the signal left behind, so installation restores the files and removal reports failure instead of reading it as a success ([run bounds](../../../../packages/boot/plugin-manager/README.md)). The client shows the kind as one line and folds pnpm's output behind the details, which also name the complete log and a failure that stopped before pnpm ran ([details](../bug-fix/2026-10-28-plugin-install-failure-diagnostics.md)). Parsing the log is confined to this one function with a fixture-driven test.
|
||||
|
||||
**GitHub connection failures have a short budget before installation.** The Host runs a read-only `git ls-remote` check with the profile's Git and proxy configuration and a default `githubConnectionTimeoutMs` of 5000 ms. Credential helpers and prompts are disabled for this check, so authentication cannot consume the connection budget. Only network failures and timeouts prevent pnpm from starting; pnpm still owns authentication, HTTPS-to-SSH fallback, ref resolution and the full installation. The budget does not limit downloads or builds. The existing failure kind and `failedAt: 'spec-host'` let the Client show a connection error or timeout and offer a domestic registry for a replacement package spec. Cancellation and manager disposal terminate the check and its descendants before settling.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Status: implemented
|
||||
|
||||
**失败或被取消的安装恢复 profile 文件。** `installBundle` 在 pnpm 运行前快照 `package.json` 与 `pnpm-lock.yaml`,在 pnpm 失败、运行被取消、或 pnpm 装入的包没有声明组合包 patch 时把它们放回去。这只针对安装反转了[管理器的决定](2026-09-14-current-profile-plugin-management.zh.md)中"保留部分改动"的部分:没有产出可用组合包的安装,不能留下一个页面无法显示的依赖。删除仍沿用那个决定。已下载文件可能留在 `node_modules` 与 pnpm 缓存中。
|
||||
|
||||
**失败在事实所在处分类。** `classifyInstallFailure` 依据运行的结束方式和 pnpm 的输出——它的 `ERR_PNPM_*` 码和 Node 的 errno 名——给出 `packageResult.kind`。被管理器终止的运行,不论信号留下什么退出状态都归类为 `timeout`,因此安装会还原文件,删除则报告失败而不会读成成功([运行上界](../../../../packages/boot/plugin-manager/README.zh.md))。客户端把 kind 显示成一句话,把 pnpm 输出折叠进详情。对日志的解析只存在于这一个函数,用夹具驱动的测试钉住。
|
||||
**失败在事实所在处分类。** `classifyInstallFailure` 依据运行的结束方式和 pnpm 的输出——它的 `ERR_PNPM_*` 码和 Node 的 errno 名——给出 `packageResult.kind`。被管理器终止的运行,不论信号留下什么退出状态都归类为 `timeout`,因此安装会还原文件,删除则报告失败而不会读成成功([运行上界](../../../../packages/boot/plugin-manager/README.zh.md))。客户端把 kind 显示成一句话,把 pnpm 输出折叠进详情;详情还会指出完整日志,以及尚未运行 pnpm 就停下的一次失败([详情](../bug-fix/2026-10-28-plugin-install-failure-diagnostics.zh.md))。对日志的解析只存在于这一个函数,用夹具驱动的测试钉住。
|
||||
|
||||
**GitHub 连接失败在安装前有单独的短时限。** 宿主通过只读的 `git ls-remote` 检查连接,沿用 profile 的 Git 与代理配置,`githubConnectionTimeoutMs` 默认为 5000 毫秒。这次检查禁用凭据助手和认证提示,避免认证过程占用连接预算。只有网络失败与超时会阻止 pnpm 启动;认证、HTTPS 到 SSH 的回退、ref 解析及完整安装仍由 pnpm 负责。时限不约束下载或构建。已有的失败类型与 `failedAt: 'spec-host'` 让客户端显示连接失败或超时,并提供国内镜像供用户输入另一个包名。取消安装或销毁管理器会先终止检查及其子进程,再结束操作。
|
||||
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
# Bilingual-pair consistency record for 2026-10-21-context-menu-contributions.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/architecture/2026-10-21-context-menu-contributions.md
|
||||
/agent-note-context-menu-contributions:
|
||||
en: 380bed76b1989558
|
||||
zh: ecbb5c15933431f6
|
||||
/agent-note-context-menu-contributions/problem:
|
||||
en: baf7f6e331fd9f03
|
||||
zh: 8a45faaad34e6b0c
|
||||
/agent-note-context-menu-contributions/decision:
|
||||
en: f04341778de57140
|
||||
zh: 12147060ea28feb1
|
||||
/agent-note-context-menu-contributions/alternatives-considered:
|
||||
en: 1fc419cf3a0642d3
|
||||
zh: f774e64679bed2ab
|
||||
/agent-note-context-menu-contributions/consequences:
|
||||
en: 7a55e405714d598f
|
||||
zh: d7ff74ace672bf22
|
||||
@@ -0,0 +1,29 @@
|
||||
# Agent Note: Context menu contributions
|
||||
|
||||
Status: implemented
|
||||
|
||||
English | [中文](2026-10-21-context-menu-contributions.zh.md)
|
||||
|
||||
## Problem
|
||||
|
||||
Session and tab menus already accept React Slot entries. Reusing only those entries would require external plugins to supply React components and would leave action discovery, target capture, and cancellation coupled to each trigger.
|
||||
|
||||
## Decision
|
||||
|
||||
[Context menus](../../../../packages/client/ui-context-menu/README.md) own typed target families, contribution resolution, and callback lifetime. Feature plugins register actions through the same service available to external Client plugins. Plain presentation fields let a renderer consume resolved actions without loading contributed React components. Existing Session and tab Slots remain in feature-owned adapters, preserving those extension positions.
|
||||
|
||||
[File actions](../../../../packages/client/ui-file-actions/README.md) own original-content transfer separately from menus and image components. Saving retains original encoding; clipboard interoperability may require PNG conversion. A browser download supplies no local path, so reveal requires a verified Host file or the destination returned by a native save.
|
||||
|
||||
The menu plugin contributes `useContextMenu` through the existing Slot root binding. Its ordinary `getTriggerProps` factory centralizes DOM gestures while business owners still provide captured targets. Plain children receive props or existing delegates; a separate React Context or utility package would duplicate the established lifetime and injection mechanism.
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
**React Slots alone.** They preserve arbitrary visual content but cannot supply a presentation-independent action model. They remain available for existing component contributions.
|
||||
|
||||
**A central switch over built-in target kinds.** It would make each new plugin-owned target require changes to the menu implementation. Declaration merging and registered providers instead keep target-specific behavior with its owner.
|
||||
|
||||
**Native menus first.** It would duplicate the existing keyboard, placement, and dismissal implementation while excluding component-only legacy entries. The shared Web renderer serves Desktop too; another renderer can consume the plain action view independently.
|
||||
|
||||
## Consequences
|
||||
|
||||
An opening captures its target and contribution set. Dismissal cancels metadata work; unloading withdraws that provider's actions. Selected actions own execution and must recheck mutable resources. Legacy React entries are absent from plain-data resolution, so native rendering cannot assume complete parity. These lifetimes are covered by registry tests; browser scenarios cover unchanged selection, original bytes, and nested-overlay dismissal.
|
||||
@@ -0,0 +1,29 @@
|
||||
# Agent Note: 右键菜单贡献
|
||||
|
||||
Status: implemented
|
||||
|
||||
[English](2026-10-21-context-menu-contributions.md) | 中文
|
||||
|
||||
## 问题
|
||||
|
||||
Session 和标签页菜单已经支持 React Slot 条目。仅复用这些条目会要求外部插件提供 React 组件,并使动作发现、目标捕获和取消逻辑继续耦合到各个触发位置。
|
||||
|
||||
## 决策
|
||||
|
||||
[右键菜单](../../../../packages/client/ui-context-menu/README.zh.md)负责类型化目标类别、贡献解析和回调生命周期。功能插件通过与外部 Client 插件相同的服务注册动作。纯数据展示字段让渲染器无需加载贡献方的 React 组件即可消费已解析动作。现有 Session 和标签页 Slot 保留在各功能所属的适配器中,从而保留这些扩展位置。
|
||||
|
||||
[文件动作](../../../../packages/client/ui-file-actions/README.zh.md)独立于菜单和图片组件负责原始内容传输。保存保留原始编码;剪贴板互操作可能需要转换为 PNG。浏览器下载不提供本机路径,因此在文件夹显示要求已验证的 Host 文件,或原生保存返回的目标路径。
|
||||
|
||||
菜单插件通过现有 Slot root 绑定贡献 `useContextMenu`。普通函数 `getTriggerProps` 统一处理 DOM 手势,业务所有者继续提供捕获的目标。普通子组件通过 props 或现有 delegate 接收能力;独立 React Context 或工具包会重复已有生命周期与注入机制。
|
||||
|
||||
## 考虑过的替代方案
|
||||
|
||||
**仅使用 React Slot。** 它们支持任意视觉内容,但无法提供独立于展示方式的动作模型。现有组件贡献仍可使用它们。
|
||||
|
||||
**在中心位置按内置目标类型分支。** 这种方式会使每个新增的插件目标都要求修改菜单实现。声明合并与注册式提供方让目标特有行为保留在其所属插件。
|
||||
|
||||
**优先实现原生菜单。** 这会重复已有的键盘、定位和关闭实现,同时无法容纳仅提供组件的旧条目。Desktop 同样使用共享 Web 渲染器;其他渲染器可以独立消费纯数据动作视图。
|
||||
|
||||
## 影响
|
||||
|
||||
打开菜单时捕获目标和贡献集合。关闭取消元数据任务;插件卸载撤回该提供方的动作。已选动作自行负责执行,并须重新检查可变资源。旧 React 条目不参与纯数据解析,因此原生渲染不能假定功能完全一致。注册表测试覆盖这些生命周期;浏览器场景覆盖选择不变、原始字节以及嵌套浮层关闭。
|
||||
@@ -0,0 +1,19 @@
|
||||
# Bilingual-pair consistency record for 2026-10-28-forge-git-session-permissions.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/bug-fix/2026-10-28-forge-git-session-permissions.md
|
||||
/agent-note-session-permissions-for-forge-git-queries:
|
||||
en: a06c42342d1f0bad
|
||||
zh: 88b063883336cb0b
|
||||
/agent-note-session-permissions-for-forge-git-queries/problem:
|
||||
en: ee1e5ba8190a9419
|
||||
zh: 88d6c35a3a400eb0
|
||||
/agent-note-session-permissions-for-forge-git-queries/decision:
|
||||
en: 77d7706b2577e552
|
||||
zh: a4538a19656d5945
|
||||
/agent-note-session-permissions-for-forge-git-queries/alternatives-considered:
|
||||
en: 69f0bbbc412a546f
|
||||
zh: 9527e87b5adfc7c3
|
||||
/agent-note-session-permissions-for-forge-git-queries/consequences:
|
||||
en: acf5249a959ac14c
|
||||
zh: 268fc51ec3278dcb
|
||||
@@ -0,0 +1,31 @@
|
||||
# Agent Note: Session permissions for Forge Git queries
|
||||
|
||||
Status: implemented
|
||||
|
||||
English | [中文](2026-10-28-forge-git-session-permissions.zh.md)
|
||||
|
||||
## Problem
|
||||
|
||||
The [Forge panel](../feature/2026-10-09-forge-panel.md) forces read-only confinement even when a Session grants full access. On hosts without a usable sandbox, its checkout and local changes remain unavailable while the Session's shell works. Background queries also reach repository-configured executable helpers through working-tree comparisons.
|
||||
|
||||
## Decision
|
||||
|
||||
Git inspection uses the Session's resolved sandbox mode and subprocess provider. Full access requires no sandbox backend; confined modes retain their enforcement and never retry unconfined. The Session remains the authority for filesystem permissions, including workspace-write access. Query commands do not request repository mutations.
|
||||
|
||||
Local patches and statistics apply command-local Git configuration to disable clean/process filters without changing user configuration. Environment entries preserve subsection names containing equals signs. Existing hook, fsmonitor, external-diff, textconv, optional-lock, and lazy-fetch restrictions remain; submodule queries show commit changes without scanning internal dirty files. Configuration read failure stops the comparison; the changes view reports the filter configuration failure separately from oversized diffs and offers a retry. These restrictions follow the informational-diff approach in Codex while retaining DSH's execution-world and cancellation ownership.
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
**Force read-only for every query.** This makes an explicitly unconfined Session depend on an unavailable backend. Using the Session mode keeps tool and panel permission behavior consistent.
|
||||
|
||||
**Retry without confinement after failure.** This would silently grant authority that a restricted Session does not have.
|
||||
|
||||
**Run configured content converters.** They can execute programs and write files during automatic refresh. Disabling them trades converted-content equivalence for predictable query behavior.
|
||||
|
||||
## Consequences
|
||||
|
||||
Operating-system write protection follows the Session mode rather than a separate panel policy. With clean/process filters disabled, comparisons still apply Git's built-in newline, ident, and encoding conversions: materialized LFS and other filtered files can appear changed even when ordinary Git considers them clean. Pointer-only checkouts compare normally. Uncommitted submodule contents are omitted. The original Forge note remains active for panel ownership and worktree lifecycle; this note supersedes only its unconditional read-only policy.
|
||||
|
||||
Filter overrides require Git 2.31 or newer; older Git can ignore them and execute configured helpers under Session permissions. Enumeration and diff run in separate processes, so a concurrently added driver can escape the overrides. These restrictions limit incidental helper execution; the Session sandbox determines the permissions of every process that runs.
|
||||
|
||||
Real-repository tests cover permission modes, unavailable confinement, unchanged index/configuration, configured helper markers, submodule commits, filtered bytes, and failed filter enumeration. The Web replay covers permission changes through the picker and the resulting checkout and local-change view.
|
||||
@@ -0,0 +1,31 @@
|
||||
# Agent Note: Forge Git 查询的 Session 权限
|
||||
|
||||
Status: implemented
|
||||
|
||||
[English](2026-10-28-forge-git-session-permissions.md) | 中文
|
||||
|
||||
## 问题
|
||||
|
||||
[Forge 面板](../feature/2026-10-09-forge-panel.zh.md)即使在 Session 授予完全权限时也强制使用只读沙箱。在没有可用沙箱的主机上,Session 的 shell 可以工作,检出信息与本地变更却持续不可用。后台查询还会通过工作区比较执行仓库配置的辅助程序。
|
||||
|
||||
## 决策
|
||||
|
||||
Git 检查使用 Session 解析出的沙箱模式与子进程提供方。完全权限无需沙箱后端;受限模式保留强制约束,绝不以无沙箱方式重试。Session 统一决定文件系统权限,包括工作区写入权限。查询命令不请求修改仓库。
|
||||
|
||||
本地补丁与统计应用命令级 Git 配置以禁用 clean/process filter,不修改用户配置。环境项保留包含等号的子节名称。现有钩子、fsmonitor、外部 diff、textconv、可选锁与延迟获取限制继续生效;子模块查询展示提交变化,不扫描内部脏文件。配置读取失败时停止比较;变更视图区分过滤器配置失败与 diff 过大,并提供重试。这些限制参考 Codex 的信息展示型 diff,同时保留 DSH 对执行环境与取消过程的管理。
|
||||
|
||||
## 考虑过的替代方案
|
||||
|
||||
**所有查询强制只读。** 这让已明确取消限制的 Session 依赖不可用的后端。使用 Session 模式使工具与面板的权限行为一致。
|
||||
|
||||
**失败后无沙箱重试。** 这会静默授予受限 Session 原本没有的权限。
|
||||
|
||||
**运行已配置的内容转换器。** 它们可能在自动刷新时执行程序并写入文件。禁用它们以放弃转换后内容等价性为代价,换取可预测的查询行为。
|
||||
|
||||
## 后果
|
||||
|
||||
操作系统的写入保护跟随 Session 模式,而非独立的面板策略。禁用 clean/process filter 后,比较仍应用 Git 内置的换行、ident 与编码转换:已物化的 LFS 文件及其他过滤文件可能显示为变更,即使普通 Git 认为它们未变。仅保留指针的检出可正常比较。子模块内部未提交内容不显示。原 Forge 记录仍保留面板所有权与工作树生命周期的决策;本记录仅替代其无条件只读策略。
|
||||
|
||||
过滤器覆盖需要 Git 2.31 或更新版本;旧 Git 可能忽略覆盖,按 Session 权限执行已配置的辅助程序。枚举与 diff 在独立进程中执行,因此并发新增的驱动可能绕过覆盖。这些限制减少附带的辅助程序执行;所有实际运行进程的权限由 Session 沙箱决定。
|
||||
|
||||
真实仓库测试覆盖权限模式、沙箱不可用、索引与配置不变、辅助程序标记、子模块提交、过滤文件字节和过滤器枚举失败。Web 回放覆盖通过选择器切换权限及相应的检出信息与本地变更视图。
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
# Bilingual-pair consistency record for 2026-10-28-plugin-install-failure-diagnostics.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/bug-fix/2026-10-28-plugin-install-failure-diagnostics.md
|
||||
/agent-note-install-failures-keep-their-diagnostics-in-the-dialog:
|
||||
en: dc13db49685fee98
|
||||
zh: 65896465ceaba16a
|
||||
/agent-note-install-failures-keep-their-diagnostics-in-the-dialog/problem:
|
||||
en: 34c85dbc0fdaeeaf
|
||||
zh: b11042edb1eb8e3b
|
||||
/agent-note-install-failures-keep-their-diagnostics-in-the-dialog/decision:
|
||||
en: fa3f10f9d7502077
|
||||
zh: c6b83153a0f5e324
|
||||
/agent-note-install-failures-keep-their-diagnostics-in-the-dialog/alternatives-considered:
|
||||
en: 2616d060183a7a74
|
||||
zh: 15179fd42ea2b6dc
|
||||
/agent-note-install-failures-keep-their-diagnostics-in-the-dialog/consequences:
|
||||
en: 246d2a60f856c631
|
||||
zh: d7a552af3ad32b6f
|
||||
/agent-note-install-failures-keep-their-diagnostics-in-the-dialog/related:
|
||||
en: e0709383c16148e9
|
||||
zh: 00765408d0ad25f1
|
||||
/agent-note-install-failures-keep-their-diagnostics-in-the-dialog/testing:
|
||||
en: 336df2ffde183519
|
||||
zh: 86e62a8a052c1f91
|
||||
@@ -0,0 +1,47 @@
|
||||
# Agent Note: Install failures keep their diagnostics in the dialog
|
||||
|
||||
Status: implemented
|
||||
|
||||
English | [中文](2026-10-28-plugin-install-failure-diagnostics.zh.md)
|
||||
|
||||
## Problem
|
||||
|
||||
A failed plugin installation could show the generic sentence "Something went wrong during the install; the details say what" while its expanded details showed only "No output". The dialog rendered the live install-log stream and the failure kind, and the two Host diagnostics that explain such a failure never entered that stream. A pnpm run that printed nothing had its diagnostic (`result.shortMessage`, or `pnpm failed` as the fallback) written to the complete log and the returned result but never streamed, so the dialog's terminal stayed empty. The GitHub connection check that stops an installation before pnpm runs kept its captured output only in `packageResult.output`. The Client also ignored the settled result's `packageResult.logPath` and `stage`, so a failure with recorded diagnostics offered no path to the complete log and could not say that a finished installation failed while the bundle was being activated.
|
||||
|
||||
## Decision
|
||||
|
||||
**The install-log stream carries the Host diagnostic of every run the dialog shows.** A pnpm run that fails without printing anything streams the diagnostic the Host records for it, so the complete log and the dialog show the same text. The GitHub connection check reports the `git … ls-remote` command line it ran, with the user information of an http(s) repository URL removed; when its network failure or timeout stops the installation, `installBundle` emits that command, the captured output, and the failure's exit status as the installation's only install-log run under the caller's request id. A check failure the installation survives streams nothing. A timed-out check's Git returned no exit status, so that run settles without one; the returned result records the coerced status 1, because `PackageResult.exitCode` is a number, and `PackageResult.timedOut` states that the status is the one the failure is read as. The command line itself stays module-local: `installBundle` strips it off the plain `PackageResult` it returns, so no second wire field appears.
|
||||
|
||||
**The failed screen keeps what the settled result reports, not only the live stream.** `InstallState` holds the settled `packageResult.logPath` — the run that settled the dialog, on the Host's filesystem — and the details name it as the complete log. `InstallState['failure'].stage` and `ChangeResult.enabled` add the sentence that the installation finished and enabling the bundle failed, only when that change did ask to enable it; an install that left activation to **Enable now** never claims it failed enabling. Details on a settled screen without a streamed run say the dialog received no terminal output, never that the run printed none, and a running install makes no such claim. The generic sentence names the failed install command, except when the failed step is applying an enabled bundle, where the enabling sentence stands alone. The answer and the log travel over separate transports, so a run whose first chunk arrives after the answer is kept in the settled dialog as a settled run rather than dropped or shown as running.
|
||||
|
||||
No wire type, public export, or config key is added: `ChangeResult.packageResult.logPath`, `ChangeResult.stage`, `ChangeResult.enabled`, and `packageResult.timedOut` already carry these facts to every consumer. The check's command line is a module-local `GithubConnectionFailure` in `github-connection.ts`.
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
**Have the Client synthesize a terminal run from `packageResult.output`.** Rejected: the install-log stream would stay incomplete for every other reader, including the agent tool and the complete Host log, and the dialog would carry two notions of a run — one streamed, one rebuilt from the result.
|
||||
|
||||
**Render `packageResult.output` as a separate Host-diagnostic block.** Rejected: it duplicates the terminal surface with a second styling and copy path, and the failing check's command line would still be missing.
|
||||
|
||||
**Add a failure-stage field to `ChangeResult`.** Rejected: `stage` already names installation and activation, and only activation needed its own sentence; a second stage vocabulary would make every consumer learn two fields for one fact.
|
||||
|
||||
**Keep the generic sentence and rely on the details.** Rejected: the empty details panel this fixes was exactly what the sentence pointed at, so the sentence must not promise diagnostics the dialog does not show.
|
||||
|
||||
**Report the check's coerced exit code in the streamed run too.** Rejected: the stream describes what the process did, and a Git the deadline killed returned no status; the result keeps the coerced status only because its exit code is a number, which the JSDoc states.
|
||||
|
||||
## Consequences
|
||||
|
||||
- A failed installation always offers something to act on: a pnpm diagnostic for a silent failure, the failing Git command and its output for a GitHub connection failure, the complete log of the settled run, and a sentence naming the failed step when an enabled installation could not be applied.
|
||||
- The generic sentence becomes "The install command failed; the details say why" in every dictionary; the details' no-run note says the dialog received no terminal output.
|
||||
- A GitHub connection failure reports `timedOut` and returns the coerced exit status 1, while its streamed run settles without an exit code; the displayed command line omits URL user information, and no `argv` field joins the Remote answer.
|
||||
- The details' log path covers the run that settled the dialog and is a Host path, so earlier registry attempts and a remote browser may not reach it.
|
||||
- No new configuration, wire field, or public package export.
|
||||
|
||||
## Related
|
||||
|
||||
[Guided plugin installation](../architecture/2026-09-15-guided-plugin-installation.md) owns the install dialog's screens, the pre-install spec check, and the failure classification; this note extends its failed screen and install-log stream.
|
||||
|
||||
## Testing
|
||||
|
||||
- `packages/boot/plugin-manager/tests/operations.spec.ts` pins the no-output diagnostic stream; `github-connection.spec.ts` pins the recorded command line without URL user information and the timeout state, including the coerced status in the result; `manager.spec.ts` pins the single streamed check run under the request id, its absent exit code on timeout, that the returned `packageResult` carries no command line, and that a check failure pnpm may resolve streams nothing.
|
||||
- `packages/client/ui-plugin-manager/tests/manager-store.client.spec.ts` pins the settled log path, stage and enablement fact, the run kept when its first chunk arrives after the answer, and the reset on retry; `components.client.spec.tsx` pins the enabling sentence (only for an install that asked to enable), the complete-log line, and the settled no-output sentence.
|
||||
- `apps/web/tests/plugin-install-github.e2e.ts` expands the details of a real GitHub connection failure and finds the Git command, its output, and the log path; `apps/web/tests/plugin-install-silent-failure.e2e.ts` fails a real installation through a package manager that prints nothing and finds the run's command line, its diagnostic, and the complete log in the details.
|
||||
@@ -0,0 +1,47 @@
|
||||
# Agent Note: Install failures keep their diagnostics in the dialog
|
||||
|
||||
Status: implemented
|
||||
|
||||
[English](2026-10-28-plugin-install-failure-diagnostics.md) | 中文
|
||||
|
||||
## Problem
|
||||
|
||||
一次插件安装失败时,界面可能显示通用的“安装过程中出错,原因见安装详情”,而展开后的详情只有“无输出”。对话框渲染的是实时的 install-log 流和失败 kind,而解释这类失败的 Host 诊断从未进入该流。打印了空输出的 pnpm 运行,其诊断(`result.shortMessage`,缺省为 `pnpm failed`)只写进完整日志和返回结果,从未被流式发送,因此对话框的终端一直是空的。在 pnpm 运行前就中止安装的 GitHub 连接检查,其捕获的输出只留在 `packageResult.output` 里。客户端同时也忽略了已结束结果中的 `packageResult.logPath` 和 `stage`,所以即使诊断已被记录,失败界面也没有指向完整日志的入口,也无法说明安装其实已经完成、失败发生在启用 bundle 时。
|
||||
|
||||
## Decision
|
||||
|
||||
**install-log 流携带对话框所展示的每一次运行的 Host 诊断。** 没有打印任何内容就失败的 pnpm 运行,会把 Host 为其记录的那条诊断流式发送出来,于是完整日志和对话框显示同样的文本。GitHub 连接检查会报告它实际执行的 `git … ls-remote` 命令行,并去掉 http(s) 仓库 URL 中的用户信息;当它的网络失败或超时中止安装时,`installBundle` 把该命令、捕获的输出和这次失败的退出状态作为该次安装唯一的 install-log 运行、以调用方的 request id 发出。安装仍能继续进行的检查失败不发送任何内容。超时的检查里 Git 没有返回退出状态,所以该运行不带退出码结束;返回结果记录强制填入的状态 1,因为 `PackageResult.exitCode` 是数字,而 `PackageResult.timedOut` 说明该状态只是失败被读取成的状态。命令行本身仍只在模块内:`installBundle` 在返回的普通 `PackageResult` 上剥掉它,因此不会多出 wire 字段。
|
||||
|
||||
**失败界面保留已结束结果所报告的内容,而不只是实时流。** `InstallState` 持有已结束的 `packageResult.logPath`——结束对话框的那次运行,位于 Host 文件系统——详情把它标为完整日志。`InstallState['failure'].stage` 与 `ChangeResult.enabled` 补充一句话:安装已完成,启用 bundle 时失败;只有当这次变更确实要求启用时才出现,把启用留给**立即启用**的安装不会声称启用失败。已结束界面里没有任何流式运行的详情会说明对话框没有收到终端输出,而不会断言运行本身没有输出;安装进行中也不会这样说。通用提示句点明失败的是安装命令,但失败步骤是应用已启用的 bundle 时,只使用启用阶段的那句话。安装应答与日志走不同传输,因此首个 chunk 晚于应答到达的运行会作为已结束的运行保留在已结束的对话框里,既不会被丢弃,也不会显示成运行中。
|
||||
|
||||
不新增 wire 类型、公开导出或配置键:`ChangeResult.packageResult.logPath`、`ChangeResult.stage`、`ChangeResult.enabled` 和 `packageResult.timedOut` 本来就把这些事实带给每个消费方。检查的命令行是 `github-connection.ts` 内模块级的 `GithubConnectionFailure`。
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
**让客户端从 `packageResult.output` 合成一次终端运行。** 否决:对其他读取方(agent 工具和完整的 Host 日志)来说 install-log 流仍然不完整,而且对话框会出现两种“运行”的概念——一种来自流,一种从结果重建。
|
||||
|
||||
**把 `packageResult.output` 渲染成单独的 Host 诊断块。** 否决:它会以第二套样式和文案路径重复终端界面,而且失败检查的命令行仍然缺失。
|
||||
|
||||
**给 `ChangeResult` 新增失败阶段字段。** 否决:`stage` 已经区分安装和启用,而且只有启用需要自己的提示句;第二套阶段词汇会让每个消费方为一个事实学两个字段。
|
||||
|
||||
**保留通用提示句、只依赖详情。** 否决:这次要修的正是被该提示句指向的空详情面板,因此提示句不能承诺对话框并不显示的诊断。
|
||||
|
||||
**在流式运行里也报告检查被强制的退出码。** 否决:流描述的是进程实际做了什么,而被期限终止的 Git 没有返回任何状态;结果保留强制状态只是因为它的退出码字段是数字,JSDoc 已写明这一点。
|
||||
|
||||
## Consequences
|
||||
|
||||
- 安装失败后总有可行动的信息:静默失败时的 pnpm 诊断、GitHub 连接失败时出错的 Git 命令及其输出、结束对话框那次运行的完整日志,以及已启用的安装在应用阶段失败时点名失败步骤的一句话。
|
||||
- 通用提示句在所有词典中变为“安装命令失败,原因见安装详情”;详情里的无运行提示改为说明对话框没有收到终端输出。
|
||||
- GitHub 连接失败会报告 `timedOut` 并返回强制状态 1,而它的流式运行不带退出码结束;展示的命令行去掉 URL 用户信息,Remote 应答里也不会多出 `argv` 字段。
|
||||
- 详情里的日志路径只覆盖结束对话框的那次运行,且是 Host 路径,因此更早的换源尝试与远端浏览器可能都够不到它。
|
||||
- 不新增配置、wire 字段或公开包导出。
|
||||
|
||||
## Related
|
||||
|
||||
[Guided plugin installation](../architecture/2026-09-15-guided-plugin-installation.zh.md) 拥有安装对话框的各个界面、安装前的 spec 检查和失败分类;本记录扩展了它的失败界面和 install-log 流。
|
||||
|
||||
## Testing
|
||||
|
||||
- `packages/boot/plugin-manager/tests/operations.spec.ts` 钉住无输出诊断的流式发送;`github-connection.spec.ts` 钉住去掉 URL 用户信息的记录命令行与超时状态(含结果里的强制状态);`manager.spec.ts` 钉住以 request id 发送的唯一检查运行、超时下缺失的退出码、返回的 `packageResult` 不含命令行,以及 pnpm 可能自行解决的检查失败不发送任何运行。
|
||||
- `packages/client/ui-plugin-manager/tests/manager-store.client.spec.ts` 钉住已结束的日志路径、stage 与启用事实、首个 chunk 晚于应答到达时保留的运行,以及重试时的重置;`components.client.spec.tsx` 钉住启用阶段的提示句(只对要求启用的安装)、完整日志行,以及已结束界面的无输出提示句。
|
||||
- `apps/web/tests/plugin-install-github.e2e.ts` 展开一次真实 GitHub 连接失败的详情,找到 Git 命令、它的输出和日志路径;`apps/web/tests/plugin-install-silent-failure.e2e.ts` 让一次真实安装通过不打印任何内容的包管理器失败,并在详情中找到该运行的命令行、诊断和完整日志。
|
||||
@@ -9,8 +9,8 @@
|
||||
en: 344bcc7e9825bbc8
|
||||
zh: c1d0f4b54f5b3786
|
||||
/agent-note-change-request-panel-and-worktree-sessions/decision:
|
||||
en: 0b159e4e33409515
|
||||
zh: 2bf1eafd644f2d26
|
||||
en: 6a0dc836205863ba
|
||||
zh: 3d4feb0385953dda
|
||||
/agent-note-change-request-panel-and-worktree-sessions/deferred:
|
||||
en: 32ef8af85f4d2f66
|
||||
zh: b82b67f94346399e
|
||||
@@ -18,5 +18,5 @@
|
||||
en: e471e16b6b6450ca
|
||||
zh: 5fbc9242edc8d112
|
||||
/agent-note-change-request-panel-and-worktree-sessions/consequences:
|
||||
en: 97976f073b9f65e0
|
||||
zh: 95be3f7f375b0876
|
||||
en: 81790c448f0a7d3b
|
||||
zh: ec63ccb2ad315ff8
|
||||
@@ -12,7 +12,7 @@ English | [中文](2026-10-09-forge-panel.zh.md)
|
||||
|
||||
[`dsh-experimental-client-ui-forge`](../../../../packages/experimental/client-ui-forge/README.md) is a two-face package. Its Host half, the `forgePanel` Remote, assembles everything the panel shows for one Session into one streamed state; the forge registry and the binding service keep only their domain operations. Its Client half is a right-sidebar tab, a Session header button that shows or hides it, a New Session option, a creation card above the composer, a toast, and the [Session list icons and hover card section](2026-10-20-forge-session-list.md). Every surface calls a bound item a change request, the forge registry's term, whatever its code host calls it. The [forge bundle](../../../../packages/experimental/forge-bundle/README.md) ships the panel, the forge registry, the GitHub provider, the bindings, and an isolated worktree service as one default-disabled Plugins page entry.
|
||||
|
||||
The Remote inspects the checkout through the Session's subprocess provider under the Session's read-only sandbox policy, so it reads what the Session's commands see and cannot write. Inspection reads the top-level, Git, and common Git directories, the branch or the abbreviated HEAD commit, the upstream, the remotes, and the size of the branch's changes against its fork point. It runs when a Session is followed, after each `working-directory/change`, `tool/result`, and `sandbox/mode` event, and on refresh, one at a time with one trailing rerun.
|
||||
The Remote inspects the checkout through the Session's subprocess provider under its [resolved permissions and query restrictions](../bug-fix/2026-10-28-forge-git-session-permissions.md), so it reads what the Session's commands see. Inspection reads the top-level, Git, and common Git directories, the branch or the abbreviated HEAD commit, the upstream, the remotes, and the size of the branch's changes against its fork point. It runs when a Session is followed, after each `working-directory/change`, `tool/result`, and `sandbox/mode` event, and on refresh, one at a time with one trailing rerun.
|
||||
|
||||
Status polling follows panel subscriptions: a Session's bindings are watched only while one of its surfaces is mounted, and the registry stops polling change requests nobody watches. Each card keeps the last snapshot a poll returned, so a transient failure keeps the title and number visible. A Session's only open change request starts expanded, and with several every card starts collapsed; the user's first toggle replaces this default.
|
||||
|
||||
@@ -24,7 +24,7 @@ The worktree a Session works in can be removed outside it. Each inspection check
|
||||
|
||||
The panel does not move a Session between existing worktrees. Removing a change request appends a `dismiss` record, and its toast offers Undo through `track`.
|
||||
|
||||
The panel also shows the changes behind a Session's work in a changes view, a resource tab type of this package. The Remote parses every diff on the Host into files and hunks, so the browser draws them without a patch parser, and bounds each read with `maxDiffBytes` and `maxUntrackedFiles`. Local changes come from confined `git diff` in the Session's execution world, in a scope the user picks: the branch against its fork point by default, or the uncommitted, unstaged, or staged changes; untracked files are read through the Session's filesystem and shown as new files. A change request's changes come from its code host at the head of the binding's latest status, through two provider reads the forge seam gained, `diff` and `fileText`. The Host keeps the patch it read last for each change request, keyed by the head commit and base branch and bounded by `maxCachedDiffBytes`, so reopening, refreshing, and navigating at the same head download nothing again; a host or provider that refuses an answer over its size limit reports the forge failure `too-large`, and the view then offers the change request's web page instead of a retry. Unchanged lines between hunks expand from the file's new side, which is the working tree, the index, or the head commit, and only while that text still matches the hunks. Each inspection also sizes the branch's changes for a local changes card, shown while no open change request carries the checked-out branch; its Create change request sends the Session a user message, so the Agent creates the change request with its own tools and the binding follows from `gh pr create` as for any other.
|
||||
The panel also shows the changes behind a Session's work in a changes view, a resource tab type of this package. The Remote parses every diff on the Host into files and hunks, so the browser draws them without a patch parser, and bounds each read with `maxDiffBytes` and `maxUntrackedFiles`. Local changes come from `git diff` using the Session's permissions and execution world, in a scope the user picks: the branch against its fork point by default, or the uncommitted, unstaged, or staged changes; untracked files are read through the Session's filesystem and shown as new files. A change request's changes come from its code host at the head of the binding's latest status, through two provider reads the forge seam gained, `diff` and `fileText`. The Host keeps the patch it read last for each change request, keyed by the head commit and base branch and bounded by `maxCachedDiffBytes`, so reopening, refreshing, and navigating at the same head download nothing again; a host or provider that refuses an answer over its size limit reports the forge failure `too-large`, and the view then offers the change request's web page instead of a retry. Unchanged lines between hunks expand from the file's new side, which is the working tree, the index, or the head commit, and only while that text still matches the hunks. Each inspection also sizes the branch's changes for a local changes card, shown while no open change request carries the checked-out branch; its Create change request sends the Session a user message, so the Agent creates the change request with its own tools and the binding follows from `gh pr create` as for any other.
|
||||
|
||||
Review comments capture the file, side, range, complete hunk, and reviewed head when the user selects code. Agent references enter the existing composer quote mechanism, so the user controls batching and the sent message records exactly what the model receives. GitHub writes belong to the optional forge provider operation: preflight checks the current head, the write addresses that commit, and an ambiguous outcome blocks another write until the user reconciles it. Review drafts and inline records belong to a browser tab occurrence, not to the Session log or a GitHub pending review. Switching Sessions retains that occurrence; closing it discards the local state and rejects late write completions. Published GitHub comments remain external records.
|
||||
|
||||
@@ -89,4 +89,4 @@ The changes view offers no scope for one commit or for the last turn yet; both w
|
||||
|
||||
## Consequences
|
||||
|
||||
The panel shows current status only while it is open; checks that finish while nothing is mounted produce no notification. Changes made outside the Session appear after Refresh or the next tool result. Every inspection spawns up to eleven short Git processes in the Session's execution world with one remote, and two more for each further remote it tries for a fork point. A worktree exists only for a Session that requested it before its first step, and a failed or cancelled attempt can leave its branch or checkout behind. A message that enters while the Agent runs a turn or other maintenance gets no hold, so its worktree is created within the first turn and a removed worktree is not checked. While a message waits, the Agent stays idle in maintenance: the composer offers no stop, and callers waiting for the Agent to become idle wait as well. Restoring loses changes that were never committed. A base branch that requires a merge queue cannot merge from the panel. With Git Worktrees also enabled, two independent worktree services exist; the model's tool never sees the panel's service. A local or change request diff over `maxDiffBytes`, or one the host refuses, shows no files. Expanding unchanged lines of a change request reads each file from the code host once.
|
||||
The panel shows current status only while it is open; checks that finish while nothing is mounted produce no notification. Changes made outside the Session appear after Refresh or the next tool result. Every inspection spawns up to twelve short Git processes in the Session's execution world with one remote, and two more for each further remote it tries for a fork point. A worktree exists only for a Session that requested it before its first step, and a failed or cancelled attempt can leave its branch or checkout behind. A message that enters while the Agent runs a turn or other maintenance gets no hold, so its worktree is created within the first turn and a removed worktree is not checked. While a message waits, the Agent stays idle in maintenance: the composer offers no stop, and callers waiting for the Agent to become idle wait as well. Restoring loses changes that were never committed. A base branch that requires a merge queue cannot merge from the panel. With Git Worktrees also enabled, two independent worktree services exist; the model's tool never sees the panel's service. A local or change request diff over `maxDiffBytes`, or one the host refuses, shows no files. Expanding unchanged lines of a change request reads each file from the code host once.
|
||||
@@ -12,7 +12,7 @@ Status: implemented
|
||||
|
||||
[`dsh-experimental-client-ui-forge`](../../../../packages/experimental/client-ui-forge/README.zh.md) 是一个双端包。宿主端的 `forgePanel` Remote 把面板为一个 Session 展示的全部内容组装成一条流式状态;forge 注册表与绑定服务只保留各自的领域操作。客户端包括一个右侧边栏标签页、一个显示或隐藏它的 Session 标题栏按钮、一个新会话选项、一张位于输入框上方的创建卡片、一个 toast,以及[会话列表中的图标与悬浮卡片部分](2026-10-20-forge-session-list.zh.md)。所有界面都把已绑定的条目称为变更请求(forge 注册表的术语),不随代码托管平台的叫法变化。[forge 套件](../../../../packages/experimental/forge-bundle/README.zh.md)把面板、forge 注册表、GitHub 提供方、绑定服务与一个隔离的 worktree 服务作为插件页中默认禁用的一个条目发布。
|
||||
|
||||
Remote 通过 Session 的子进程提供方、在 Session 的只读沙箱策略下检查检出,因此它读到的与 Session 命令看到的相同,且无法写入。检查读取顶层目录、Git 目录与公共 Git 目录、分支或缩写的 HEAD 提交、上游与远端,以及分支相对于其分叉点的变更规模。它在 Session 被关注时、每个 `working-directory/change`、`tool/result` 与 `sandbox/mode` 事件之后以及刷新时运行,一次只运行一个,最多再追加一次。
|
||||
Remote 通过 Session 的子进程提供方,按其[解析出的权限与查询限制](../bug-fix/2026-10-28-forge-git-session-permissions.zh.md)检查检出,因此它读到的与 Session 命令看到的相同。检查读取顶层目录、Git 目录与公共 Git 目录、分支或缩写的 HEAD 提交、上游与远端,以及分支相对于其分叉点的变更规模。它在 Session 被关注时、每个 `working-directory/change`、`tool/result` 与 `sandbox/mode` 事件之后以及刷新时运行,一次只运行一个,最多再追加一次。
|
||||
|
||||
状态轮询跟随面板订阅:只有该 Session 的某个界面挂载时才监听其绑定,注册表停止轮询无人监听的变更请求。每张卡片保留最近一次轮询得到的快照,因此短暂的失败不会让标题与编号消失。Session 只有一个打开的变更请求时,它的卡片默认展开;有多个时全部折叠;用户第一次展开或收起卡片后,以用户的选择为准。
|
||||
|
||||
@@ -24,7 +24,7 @@ Session 所在的 worktree 可能在 Session 之外被删除。每次检查都
|
||||
|
||||
面板不在现有 worktree 之间移动 Session。移除变更请求会追加一条 `dismiss` 记录,它的 toast 通过 `track` 提供“撤销”。
|
||||
|
||||
面板还通过变更视图展示 Session 工作背后的变更;变更视图是本包的一个资源标签页类型。Remote 在宿主上把每个 diff 解析成文件与 hunk,因此浏览器无需补丁解析器即可绘制,每次读取都受 `maxDiffBytes` 与 `maxUntrackedFiles` 约束。本地变更来自 Session 执行环境中受限的 `git diff`,范围由用户选择:默认是分支相对于分叉点的变更,也可以是未提交、未暂存或已暂存的变更;未跟踪文件经 Session 的文件系统读取,显示为新文件。变更请求的变更来自代码托管平台,取自绑定最新状态中的 head,经 forge seam 新增的两个提供方读取操作 `diff` 与 `fileText` 获得。Host 为每个变更请求保留最近读到的补丁,按 head 提交与目标分支区分,总量受 `maxCachedDiffBytes` 约束,因此在同一 head 下重新打开、刷新与导航都不会再次下载;托管平台或提供方因结果超过其大小上限而拒绝时报告 forge 失败 `too-large`,视图随之提供变更请求的网页而不是重试。hunk 之间未变更的行从文件的新版本展开,即工作树、暂存区或 head 提交,并且只在该文本仍与 hunk 吻合时展开。每次检查还会为变更卡片统计分支的变更规模;没有打开中的变更请求以当前检出分支为源分支时才显示该卡片。卡片上的“创建变更请求”向 Session 发送一条用户消息,由 Agent 用自己的工具创建变更请求,绑定像其他变更请求一样来自 `gh pr create`。
|
||||
面板还通过变更视图展示 Session 工作背后的变更;变更视图是本包的一个资源标签页类型。Remote 在宿主上把每个 diff 解析成文件与 hunk,因此浏览器无需补丁解析器即可绘制,每次读取都受 `maxDiffBytes` 与 `maxUntrackedFiles` 约束。本地变更来自使用 Session 权限与执行环境的 `git diff`,范围由用户选择:默认是分支相对于分叉点的变更,也可以是未提交、未暂存或已暂存的变更;未跟踪文件经 Session 的文件系统读取,显示为新文件。变更请求的变更来自代码托管平台,取自绑定最新状态中的 head,经 forge seam 新增的两个提供方读取操作 `diff` 与 `fileText` 获得。Host 为每个变更请求保留最近读到的补丁,按 head 提交与目标分支区分,总量受 `maxCachedDiffBytes` 约束,因此在同一 head 下重新打开、刷新与导航都不会再次下载;托管平台或提供方因结果超过其大小上限而拒绝时报告 forge 失败 `too-large`,视图随之提供变更请求的网页而不是重试。hunk 之间未变更的行从文件的新版本展开,即工作树、暂存区或 head 提交,并且只在该文本仍与 hunk 吻合时展开。每次检查还会为变更卡片统计分支的变更规模;没有打开中的变更请求以当前检出分支为源分支时才显示该卡片。卡片上的“创建变更请求”向 Session 发送一条用户消息,由 Agent 用自己的工具创建变更请求,绑定像其他变更请求一样来自 `gh pr create`。
|
||||
|
||||
评审评论在用户选择代码时固定文件、侧、行范围、完整 hunk 与所评审的 head。Agent 引用进入既有输入框引用机制,由用户决定批量发送,发送后的消息记录模型实际收到的内容。GitHub 写入属于 forge 提供方的可选操作:预检核对当前 head,写入明确指向该提交;结果不明时阻止再次写入,直到用户核对。评审草稿与行内记录归浏览器页签实例所有,不进入 Session 日志,也不创建 GitHub 待提交评审。切换 Session 保留该实例;关闭时丢弃本地状态并拒绝迟到的写入结果。已发布的 GitHub 评论仍保留在外部平台。
|
||||
|
||||
@@ -89,4 +89,4 @@ Session 所在的 worktree 可能在 Session 之外被删除。每次检查都
|
||||
|
||||
## Consequences
|
||||
|
||||
面板只在打开时显示当前状态;没有任何界面挂载时检查结束不会有通知。Session 之外的改动要等到刷新或下一个工具结果才会出现。只有一个远端时,每次检查最多在 Session 的执行环境中启动十一个短暂的 Git 进程;为寻找分叉点每多尝试一个远端,就多启动两个。只有在第一步之前提出请求的 Session 才会有 worktree,失败或被取消的尝试可能留下它的分支或检出。Agent 正在运行一轮或其他维护任务时进入的消息不会被暂留,因此它的 worktree 在第一轮之内创建,已删除的 worktree 也不会被检查。消息等待期间,Agent 以空闲状态处于维护任务中:输入框不提供停止,等待 Agent 空闲的调用方也会一并等待。恢复会丢失从未提交的修改。要求合并队列的基准分支无法从面板合并。同时启用 Git Worktrees 时会存在两个互不影响的 worktree 服务;模型的工具看不到面板的服务。本地或变更请求的 diff 超过 `maxDiffBytes`,或被托管平台拒绝时,不显示任何文件。展开变更请求中未变更的行时,每个文件只从托管平台读取一次。
|
||||
面板只在打开时显示当前状态;没有任何界面挂载时检查结束不会有通知。Session 之外的改动要等到刷新或下一个工具结果才会出现。只有一个远端时,每次检查最多在 Session 的执行环境中启动十二个短暂的 Git 进程;为寻找分叉点每多尝试一个远端,就多启动两个。只有在第一步之前提出请求的 Session 才会有 worktree,失败或被取消的尝试可能留下它的分支或检出。Agent 正在运行一轮或其他维护任务时进入的消息不会被暂留,因此它的 worktree 在第一轮之内创建,已删除的 worktree 也不会被检查。消息等待期间,Agent 以空闲状态处于维护任务中:输入框不提供停止,等待 Agent 空闲的调用方也会一并等待。恢复会丢失从未提交的修改。要求合并队列的基准分支无法从面板合并。同时启用 Git Worktrees 时会存在两个互不影响的 worktree 服务;模型的工具看不到面板的服务。本地或变更请求的 diff 超过 `maxDiffBytes`,或被托管平台拒绝时,不显示任何文件。展开变更请求中未变更的行时,每个文件只从托管平台读取一次。
|
||||
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* 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
|
||||
* are outside this fixed standard/PTC, top-level-session comparison.
|
||||
*/
|
||||
import { createServer } from 'node:http'
|
||||
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { execa } from 'execa'
|
||||
import { z } from 'zod'
|
||||
import { DeepSeekHarness } from '@deepseek-ai/dsh-sdk-client'
|
||||
import { expect, it, type TestContext } from 'vitest'
|
||||
import { profileEnvironment } from './fixtures/profile-environment.ts'
|
||||
import { messagesResponse } from './fixtures/messages-response.ts'
|
||||
import { assertToolParity, type ToolMode } from './tool-parity.ts'
|
||||
|
||||
const repo = fileURLToPath(new URL('../../../../../', import.meta.url))
|
||||
const observer = new URL('./fixtures/tool-parity.mjs', import.meta.url).href
|
||||
const probe = new URL('./fixtures/parity-probe.mjs', import.meta.url).href
|
||||
const inventorySchema = z.object({ names: z.array(z.string()).min(1), hmr: z.boolean() })
|
||||
type Inventory = z.infer<typeof inventorySchema>
|
||||
|
||||
async function fixture(test: TestContext) {
|
||||
const root = await mkdtemp(join(tmpdir(), 'sdk-desktop-tools-'))
|
||||
const requests: { tools: { name: string }[] }[] = []
|
||||
const server = createServer((request, response) => {
|
||||
let body = ''
|
||||
request.setEncoding('utf8')
|
||||
request.on('data', (chunk: string) => { body += chunk })
|
||||
request.on('end', () => {
|
||||
requests.push(JSON.parse(body) as { tools: { name: string }[] })
|
||||
response.writeHead(200, { 'content-type': 'text/event-stream' })
|
||||
response.end(messagesResponse({ type: 'text', text: 'tools inspected' }, 'end_turn'))
|
||||
})
|
||||
})
|
||||
test.onTestFinished(async () => {
|
||||
try {
|
||||
await new Promise<void>((resolve, reject) => server.close((error) => {
|
||||
if (error === undefined) resolve()
|
||||
else reject(error)
|
||||
}))
|
||||
}
|
||||
finally { await rm(root, { recursive: true, force: true }) }
|
||||
})
|
||||
await new Promise<void>(resolve => server.listen(0, '127.0.0.1', resolve))
|
||||
const address = server.address()
|
||||
if (address === null || typeof address === 'string') throw new Error('model fixture has no TCP address')
|
||||
const env = profileEnvironment(root, `http://127.0.0.1:${address.port}`)
|
||||
|
||||
async function collect(side: 'sdk' | 'desktop', mode: ToolMode, mutations: object[] = []): Promise<Inventory> {
|
||||
const cwd = await mkdtemp(join(root, `${side}-${mode}-`))
|
||||
const output = join(cwd, 'tools.json')
|
||||
const patch = join(cwd, 'observer.patch.yml')
|
||||
await writeFile(patch, JSON.stringify([
|
||||
{ id: 'session-title-llm', disabled: true },
|
||||
{ insert: [{ id: 'tool-parity-observer', name: observer,
|
||||
config: { output, cwd, ...(side === 'desktop' ? { preset: mode } : {}) } }] },
|
||||
...mutations,
|
||||
]))
|
||||
const before = requests.length
|
||||
let inventory: Inventory
|
||||
if (side === 'sdk') {
|
||||
const harness = new DeepSeekHarness({
|
||||
cwd, processCwd: cwd, dshHome: join(cwd, 'home'), env, model: 'deepseek-v4-pro',
|
||||
patches: [...mode === 'ptc' ? [join(repo, 'apps/cli/config/examples/ptc.yml')] : [], patch],
|
||||
})
|
||||
const abort = (): void => { void harness.close() }
|
||||
test.signal.addEventListener('abort', abort, { once: true })
|
||||
try {
|
||||
const result = await harness.session('tool-parity').run('Inspect tools')
|
||||
expect(result.finalResponse).toBe('tools inspected')
|
||||
inventory = inventorySchema.parse(JSON.parse(await readFile(output, 'utf8')))
|
||||
} finally {
|
||||
await harness.close()
|
||||
test.signal.removeEventListener('abort', abort)
|
||||
}
|
||||
expect(inventory.hmr).toBe(false)
|
||||
} else {
|
||||
const child = execa(process.execPath, [join(repo, 'apps/cli/lib/bin.js'), '--profile', 'web',
|
||||
'--patch', patch, '--host', '127.0.0.1', '--port', '0', '--no-open'], {
|
||||
cwd, env: { ...env, DSH_HOME: join(cwd, 'home') }, extendEnv: false,
|
||||
ipc: true, stdin: 'ignore', reject: false, cancelSignal: test.signal, forceKillAfterDelay: 10_000,
|
||||
})
|
||||
let stdout = ''
|
||||
let stderr = ''
|
||||
const ready = Promise.withResolvers<true>()
|
||||
child.stdout.on('data', (chunk: Buffer) => {
|
||||
stdout += chunk.toString()
|
||||
if (stdout.includes('dsh web: http://')) ready.resolve(true)
|
||||
})
|
||||
child.stderr.on('data', (chunk: Buffer) => { stderr += chunk.toString() })
|
||||
void child.then((result) => { ready.reject(new Error(`Web exited: ${result.exitCode}\n${stderr}`)) })
|
||||
try {
|
||||
await ready.promise
|
||||
const reply = child.getOneMessage()
|
||||
await child.sendMessage('collect-tool-parity')
|
||||
const message = z.object({ result: inventorySchema.optional(), error: z.string().optional() }).parse(await reply)
|
||||
if (message.error !== undefined) throw new Error(message.error)
|
||||
inventory = inventorySchema.parse(message.result)
|
||||
} catch (error) {
|
||||
throw new Error(`Web collection failed\n${stdout}\n${stderr}`, { cause: error })
|
||||
} finally {
|
||||
// Ask the CLI to drain on Windows too, where an OS signal kills immediately.
|
||||
const watchdog = setTimeout(() => { child.kill('SIGKILL') }, 10_000)
|
||||
try {
|
||||
try { await child.sendMessage('stop-tool-parity') }
|
||||
catch (_closedChannel: unknown) {
|
||||
// A closed IPC channel cannot request graceful shutdown; fall back to the OS signal.
|
||||
child.kill('SIGTERM')
|
||||
}
|
||||
const result = await child
|
||||
expect(result.exitCode, result.stderr).toBe(0)
|
||||
expect(result.signal, result.stderr).toBeUndefined()
|
||||
} finally { clearTimeout(watchdog) }
|
||||
}
|
||||
expect(inventory.hmr).toBe(true)
|
||||
}
|
||||
expect(requests.length).toBeGreaterThan(before)
|
||||
const presented = requests[before]!.tools.map(tool => tool.name).sort()
|
||||
if (mode === 'ptc') expect(presented).toEqual(['run_code'])
|
||||
else expect(presented).toEqual(inventory.names)
|
||||
return inventory
|
||||
}
|
||||
return collect
|
||||
}
|
||||
|
||||
it.for(['standard', 'ptc'] as const)('compares the shipped %s tool sets and permits explicit opt-out', async (mode, test) => {
|
||||
const collect = await fixture(test)
|
||||
const sdk = await collect('sdk', mode)
|
||||
const desktop = await collect('desktop', mode)
|
||||
assertToolParity(mode, sdk.names, desktop.names)
|
||||
expect(sdk.names).toContain('plugin_manager')
|
||||
const optOut = await collect('sdk', mode, [{ id: 'tool-plugin-manager', disabled: true }])
|
||||
expect(optOut.names).not.toContain('plugin_manager')
|
||||
expect(() => { assertToolParity(mode, optOut.names, desktop.names) }).toThrow(
|
||||
mode === 'ptc' ? 'Stale exceptions: sdk:plugin_manager' : 'Missing from SDK: plugin_manager')
|
||||
})
|
||||
|
||||
it.for(['standard', 'ptc'] as const)('detects missing shared tools in %s', async (mode, test) => {
|
||||
const collect = await fixture(test)
|
||||
const desktop = await collect('desktop', mode)
|
||||
for (const [id, tool] of [['present', 'present'], ['tool-ask-user', 'ask_user_question'], ['tool-schedule', 'schedule_create']]) {
|
||||
const missing = await collect('sdk', mode, [{ id, disabled: true }])
|
||||
expect(() => { assertToolParity(mode, missing.names, desktop.names) }).toThrow(new RegExp(`Missing from SDK:.*${tool}`))
|
||||
}
|
||||
})
|
||||
|
||||
it.for(['standard', 'ptc'] as const)('detects one-sided additions in %s', async (mode, test) => {
|
||||
const collect = await fixture(test)
|
||||
const sdk = await collect('sdk', mode)
|
||||
const desktop = await collect('desktop', mode)
|
||||
const addition = [{ insert: [{ id: 'parity-probe', name: probe }] }]
|
||||
const desktopExtra = await collect('desktop', mode, addition)
|
||||
expect(() => { assertToolParity(mode, sdk.names, desktopExtra.names) }).toThrow('Missing from SDK: parity_probe')
|
||||
const sdkExtra = await collect('sdk', mode, addition)
|
||||
expect(() => { assertToolParity(mode, sdkExtra.names, desktop.names) }).toThrow('Only in SDK: parity_probe')
|
||||
assertToolParity(mode, sdkExtra.names, desktopExtra.names)
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
/** A real extra registration used to detect one-sided profile additions. */
|
||||
import { defineTool } from '@deepseek-ai/dsh-tools'
|
||||
|
||||
export const inject = ['tools']
|
||||
|
||||
export function apply(ctx) {
|
||||
ctx.tools.register(defineTool({
|
||||
name: 'parity_probe', description: 'Test profile addition.', parameters: {},
|
||||
output: { schema: { type: 'string' }, render: (_args, value) => [{ type: 'text', text: value }] },
|
||||
async execute() { return 'probe' },
|
||||
}))
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { join } from 'node:path'
|
||||
import { clearAmbientProxyEnv } from '../../../../../../scripts/test-proxy-environment.ts'
|
||||
|
||||
/** Isolate SDK profile processes from ambient profile, runtime and Node loader settings. */
|
||||
export function profileEnvironment(root: string, baseUrl: string): NodeJS.ProcessEnv {
|
||||
const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => !key.startsWith('DSH_')))
|
||||
Object.assign(env, {
|
||||
DSH_PERMISSION_MODE: 'danger-full-access', DSH_TELEMETRY_DISABLED: '1',
|
||||
DSH_AGENTS_HOME: join(root, 'agents'), DSH_PRIMARY_RUNTIME: '',
|
||||
DEEPSEEK_API_KEY: 'keyless-profile-test', DEEPSEEK_BASE_URL: baseUrl,
|
||||
NODE_OPTIONS: '', NODE_PATH: '',
|
||||
})
|
||||
clearAmbientProxyEnv(env)
|
||||
return env
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/** Observe step-admitted capabilities without changing either shipped tool executor. */
|
||||
import { writeFile } from 'node:fs/promises'
|
||||
import { createUserMessage } from '@deepseek-ai/dsh-llm'
|
||||
|
||||
export const inject = ['tools', 'agents', 'loader']
|
||||
|
||||
export function apply(ctx, config) {
|
||||
let observed
|
||||
ctx.on('system-prompt/assemble', async (_assembly, context, next) => {
|
||||
if (context.toolSet !== undefined) {
|
||||
observed = {
|
||||
names: ctx.tools.definitions(context.scope, context.toolSet).map(tool => tool.name).sort(),
|
||||
hmr: ctx.get('hmr') !== undefined,
|
||||
}
|
||||
await writeFile(config.output, JSON.stringify(observed))
|
||||
}
|
||||
return next()
|
||||
})
|
||||
if (config.preset === undefined) return
|
||||
const receive = message => {
|
||||
if (message === 'stop-tool-parity') {
|
||||
// Run the CLI shutdown handler: Windows OS signals terminate before its cleanup.
|
||||
process.emit('SIGTERM')
|
||||
return
|
||||
}
|
||||
if (message !== 'collect-tool-parity') return
|
||||
void collect().then(
|
||||
result => process.send({ result }),
|
||||
error => process.send({ error: String(error.stack ?? error) }),
|
||||
)
|
||||
}
|
||||
ctx.effect(() => {
|
||||
process.on('message', receive)
|
||||
return () => process.off('message', receive)
|
||||
})
|
||||
async function collect() {
|
||||
await ctx.loader.await()
|
||||
const presets = ctx.get('agentPresets')
|
||||
if (presets === undefined) throw new Error('Web tool parity requires the shipped presets')
|
||||
const handle = await ctx.agents.create({
|
||||
sessionId: 'tool-parity', cwd: config.cwd,
|
||||
agentOptions: { provider: 'deepseek-official', model: 'deepseek-v4-pro' },
|
||||
setup: scope => presets.mount(scope, config.preset).then(() => undefined),
|
||||
})
|
||||
try {
|
||||
handle.agent.followup(createUserMessage({ content: [{ type: 'text', text: 'Inspect tools' }], source: { kind: 'user' } }))
|
||||
await handle.agent.whenIdle()
|
||||
if (observed === undefined) throw new Error('Web did not assemble a model step')
|
||||
return observed
|
||||
} finally {
|
||||
await handle.dispose()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,7 @@ describe('Python SDK dsh profile keyless smoke', () => {
|
||||
expect(modelRequests[0]?.output_config).toEqual({ effort: 'max' })
|
||||
expect(modelRequests[0]?.max_tokens).toBe(1234)
|
||||
const expectedTools = ['read', 'write', 'edit', 'web_fetch', 'web_search', 'subagent', 'subagent_fork',
|
||||
'present', 'ask_user_question', 'schedule_create', 'schedule_delete', 'schedule_list', 'schedule_update']
|
||||
'present', 'ask_user_question', 'schedule_create', 'schedule_delete', 'schedule_list', 'schedule_update', 'plugin_manager']
|
||||
const requestText = JSON.stringify(modelRequests[0])
|
||||
if (ptc) {
|
||||
expect(toolNames).toEqual(['run_code'])
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
/** SDK plugin management persists changes while the live stdio process keeps its original composition. */
|
||||
import { createServer } from 'node:http'
|
||||
import { mkdtemp, readFile, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { DeepSeekHarness } from '@deepseek-ai/dsh-sdk-client'
|
||||
import { expect, it } from 'vitest'
|
||||
import { z } from 'zod'
|
||||
import { profileEnvironment } from './fixtures/profile-environment.ts'
|
||||
import { messagesResponse } from './fixtures/messages-response.ts'
|
||||
|
||||
it.for(['standard', 'ptc'] as const)('keeps %s plugin changes pending until the SDK runtime restarts', async (mode, test) => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'sdk-plugin-manager-'))
|
||||
const requests: Record<string, unknown>[] = []
|
||||
let phase: 'list' | 'set' | 'done' = 'list'
|
||||
let changedAt = 0
|
||||
let fixtureError: unknown
|
||||
const listPage = z.object({
|
||||
entries: z.array(z.object({ entryId: z.string(), moduleName: z.string() })), nextOffset: z.number().nullable(),
|
||||
})
|
||||
const server = createServer((request, response) => {
|
||||
let body = ''
|
||||
request.setEncoding('utf8')
|
||||
request.on('data', (chunk: string) => { body += chunk })
|
||||
request.on('end', () => {
|
||||
let args: Record<string, unknown> | undefined
|
||||
try {
|
||||
const current = JSON.parse(body) as Record<string, unknown>
|
||||
requests.push(current)
|
||||
if (requests.length === 1) args = { action: 'list_plugins', limit: 100 }
|
||||
else if (phase === 'list') {
|
||||
const messages = current.messages as { content: { type: string; content?: { text: string }[] }[] }[]
|
||||
const result = messages.flatMap(message => message.content).findLast(block => block.type === 'tool_result')
|
||||
const page = listPage.parse(JSON.parse(result!.content![0]!.text))
|
||||
const row = page.entries.find(entry => entry.moduleName === '@deepseek-ai/dsh-tool-web')
|
||||
if (row !== undefined) {
|
||||
args = { action: 'set_plugin', target: row.entryId, enabled: false }
|
||||
phase = 'set'
|
||||
} else if (page.nextOffset !== null) args = { action: 'list_plugins', offset: page.nextOffset, limit: 100 }
|
||||
else throw new Error('SDK plugin inventory omitted tool-web')
|
||||
} else if (phase === 'set') {
|
||||
changedAt = requests.length - 1
|
||||
phase = 'done'
|
||||
}
|
||||
} catch (error) { fixtureError = error }
|
||||
const call = mode === 'ptc'
|
||||
? { type: 'tool_use', id: `manage-${requests.length}`, name: 'run_code', input: {
|
||||
code: `return await tools.plugin_manager(${JSON.stringify(args)});`, description: 'Disable web tools after restart',
|
||||
} }
|
||||
: { type: 'tool_use', id: `manage-${requests.length}`, name: 'plugin_manager', input: args }
|
||||
response.writeHead(200, { 'content-type': 'text/event-stream' })
|
||||
response.end(messagesResponse(args !== undefined ? call : { type: 'text', text: 'done' },
|
||||
args !== undefined ? 'tool_use' : 'end_turn'))
|
||||
})
|
||||
})
|
||||
test.onTestFinished(async () => {
|
||||
try {
|
||||
await new Promise<void>((resolve, reject) => server.close((error) => {
|
||||
if (error === undefined) resolve()
|
||||
else reject(error)
|
||||
}))
|
||||
}
|
||||
finally { await rm(root, { recursive: true, force: true }) }
|
||||
})
|
||||
await new Promise<void>(resolve => server.listen(0, '127.0.0.1', resolve))
|
||||
const address = server.address()
|
||||
if (address === null || typeof address === 'string') throw new Error('model fixture has no TCP address')
|
||||
const env = profileEnvironment(root, `http://127.0.0.1:${address.port}`)
|
||||
const options = {
|
||||
cwd: root, processCwd: root, dshHome: join(root, 'home'), env, model: 'deepseek-v4-pro',
|
||||
patches: mode === 'ptc' ? [fileURLToPath(new URL('../../../config/examples/ptc.yml', import.meta.url))] : [],
|
||||
}
|
||||
async function run(restarted: boolean): Promise<void> {
|
||||
const harness = new DeepSeekHarness(options)
|
||||
const abort = (): void => { void harness.close() }
|
||||
test.signal.addEventListener('abort', abort, { once: true })
|
||||
try {
|
||||
const session = harness.session(restarted ? 'restarted' : 'original')
|
||||
expect((await session.run('Disable web tools after restart')).finalResponse).toBe('done')
|
||||
if (!restarted) {
|
||||
expect((await session.run('Continue on the same connection')).finalResponse).toBe('done')
|
||||
}
|
||||
} finally {
|
||||
await harness.close()
|
||||
test.signal.removeEventListener('abort', abort)
|
||||
}
|
||||
}
|
||||
const advertises = (request: Record<string, unknown>, name: string): boolean => mode === 'ptc'
|
||||
? JSON.stringify(request.system).includes(`${name}:`)
|
||||
: (request.tools as { name: string }[]).some(tool => tool.name === name)
|
||||
await run(false)
|
||||
expect(fixtureError).toBeUndefined()
|
||||
expect(changedAt).toBeGreaterThan(0)
|
||||
expect(advertises(requests[0]!, 'plugin_manager')).toBe(true)
|
||||
expect(JSON.stringify(requests[changedAt]!.messages)).toContain('restart-required')
|
||||
expect(JSON.stringify(requests[changedAt]!.messages)).toContain('no-hmr')
|
||||
expect(JSON.stringify(requests[changedAt]!.messages)).toContain('restart DSH')
|
||||
expect(advertises(requests.at(-1)!, 'web_fetch')).toBe(true)
|
||||
const saved = await readFile(join(root, 'home/profiles/sdk/cordis.patch.yml'), 'utf8')
|
||||
expect(saved).toContain('tool-web')
|
||||
expect(saved).toContain('disabled: true')
|
||||
await run(true)
|
||||
expect(advertises(requests.at(-1)!, 'web_fetch')).toBe(false)
|
||||
expect(advertises(requests.at(-1)!, 'plugin_manager')).toBe(true)
|
||||
})
|
||||
|
||||
it.for(['unavailable', 'approved', 'missing-pnpm'] as const)('reports the %s plugin-management prerequisite', async (scenario, test) => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'sdk-plugin-prerequisite-'))
|
||||
const requests: Record<string, unknown>[] = []
|
||||
let fixtureError: unknown
|
||||
const server = createServer((request, response) => {
|
||||
let body = ''
|
||||
request.setEncoding('utf8')
|
||||
request.on('data', (chunk: string) => { body += chunk })
|
||||
request.on('end', () => {
|
||||
try { requests.push(JSON.parse(body) as Record<string, unknown>) }
|
||||
catch (error) { fixtureError = error }
|
||||
const args = scenario === 'missing-pnpm'
|
||||
? { action: 'install_bundle', target: '@deepseek-ai/dsh-subagent-codex' }
|
||||
: { action: 'list_plugins', limit: 1 }
|
||||
const call = { type: 'tool_use', id: 'prerequisite', name: 'plugin_manager', input: args }
|
||||
response.writeHead(200, { 'content-type': 'text/event-stream' })
|
||||
response.end(messagesResponse(requests.length === 1 ? call : { type: 'text', text: 'done' },
|
||||
requests.length === 1 ? 'tool_use' : 'end_turn'))
|
||||
})
|
||||
})
|
||||
test.onTestFinished(async () => {
|
||||
try { await new Promise<void>((resolve, reject) => server.close((error) => { if (error) reject(error); else resolve() })) }
|
||||
finally { await rm(root, { recursive: true, force: true }) }
|
||||
})
|
||||
await new Promise<void>(resolve => server.listen(0, '127.0.0.1', resolve))
|
||||
const address = server.address()
|
||||
if (address === null || typeof address === 'string') throw new Error('model fixture has no TCP address')
|
||||
const env = profileEnvironment(root, `http://127.0.0.1:${address.port}`)
|
||||
env.DSH_PERMISSION_MODE = scenario === 'missing-pnpm' ? 'danger-full-access' : 'workspace-write'
|
||||
if (scenario === 'missing-pnpm') {
|
||||
for (const key of Object.keys(env)) if (key.toLowerCase() === 'path') Reflect.deleteProperty(env, key)
|
||||
env.PATH = root
|
||||
}
|
||||
const harness = new DeepSeekHarness({ cwd: root, processCwd: root, dshHome: join(root, 'home'),
|
||||
env, model: 'deepseek-v4-pro', approvalRequests: scenario === 'approved' })
|
||||
let approvals = 0
|
||||
const abort = (): void => { void harness.close() }
|
||||
test.signal.addEventListener('abort', abort, { once: true })
|
||||
try {
|
||||
harness.client.start()
|
||||
harness.client.onRequest(async (method) => {
|
||||
expect(method).toBe('approval/request')
|
||||
approvals++
|
||||
return { outcome: 'allowed-once' }
|
||||
})
|
||||
expect((await harness.run('Check plugin prerequisites')).finalResponse).toBe('done')
|
||||
expect(fixtureError).toBeUndefined()
|
||||
const result = JSON.stringify(requests.at(-1)?.messages)
|
||||
if (scenario === 'unavailable') expect(result).toContain('unavailable')
|
||||
else if (scenario === 'missing-pnpm') {
|
||||
const messages = requests.at(-1)!.messages as { content: { type: string; content?: { text: string }[] }[] }[]
|
||||
const toolResult = messages.flatMap(message => message.content).findLast(block => block.type === 'tool_result')
|
||||
const failure = z.object({
|
||||
changed: z.literal(false), application: z.literal('failed'),
|
||||
packageResult: z.object({ exitCode: z.number(), output: z.string().min(1) }),
|
||||
error: z.object({ code: z.literal('operation-error'), diagnostic: z.string().min(1) }),
|
||||
}).parse(JSON.parse(toolResult!.content![0]!.text))
|
||||
// cmd.exe reports 1 for a missing command; POSIX spawn reports 127.
|
||||
expect(failure.packageResult.exitCode).toBe(process.platform === 'win32' ? 1 : 127)
|
||||
expect(failure.error.diagnostic).toContain('pnpm')
|
||||
expect(failure.packageResult.output).toContain(failure.error.diagnostic)
|
||||
} else { expect(approvals).toBe(1); expect(result).toContain('entries') }
|
||||
const manifest = JSON.parse(await readFile(join(root, 'home/profiles/sdk/package.json'), 'utf8')) as { dependencies: object }
|
||||
expect(Object.keys(manifest.dependencies ?? {})).toEqual([])
|
||||
} finally {
|
||||
await harness.close()
|
||||
test.signal.removeEventListener('abort', abort)
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,26 @@
|
||||
/** Diagnostics and exact exception consumption for cross-profile tool comparison. */
|
||||
import { expect, it } from 'vitest'
|
||||
import { assertToolParity } from './tool-parity.ts'
|
||||
|
||||
it('accepts an exact directional exception and rejects it after the profiles converge', () => {
|
||||
const exceptions = [{ tool: 'desktop_only', side: 'desktop' as const, reason: 'Requires a graphical client.' }]
|
||||
expect(() => { assertToolParity('standard', ['read'], ['read', 'desktop_only'], exceptions) }).not.toThrow()
|
||||
expect(() => { assertToolParity('standard', ['read'], ['read'], exceptions) }).toThrow('Stale exceptions: desktop:desktop_only')
|
||||
expect(() => { assertToolParity('standard', ['read', 'desktop_only'], ['read'], exceptions) }).toThrow('Only in SDK: desktop_only')
|
||||
})
|
||||
|
||||
it('reports unexpected differences in both directions without hiding shared additions', () => {
|
||||
expect(() => { assertToolParity('standard', ['read', 'new_shared'], ['new_shared', 'read'], []) }).not.toThrow()
|
||||
expect(() => { assertToolParity('ptc', ['read', 'sdk_extra'], ['read', 'present'], []) }).toThrow(
|
||||
'Missing from SDK: present\nOnly in SDK: sdk_extra',
|
||||
)
|
||||
})
|
||||
|
||||
it('rejects empty observations, undocumented exceptions and duplicate exceptions', () => {
|
||||
expect(() => { assertToolParity('standard', [], [], []) }).toThrow('Empty tool inventory')
|
||||
expect(() => { assertToolParity('standard', ['read'], ['read'], [
|
||||
{ tool: 'extra', side: 'sdk', reason: ' ' },
|
||||
]) }).toThrow('requires a reason')
|
||||
const exception = { tool: 'extra', side: 'sdk' as const, reason: 'Intentional.' }
|
||||
expect(() => { assertToolParity('standard', ['read', 'extra'], ['read'], [exception, exception]) }).toThrow('Stale exceptions: sdk:extra')
|
||||
})
|
||||
@@ -0,0 +1,53 @@
|
||||
/** Exact, directional exceptions to the shipped SDK/Desktop capability comparison. */
|
||||
export type ToolMode = 'standard' | 'ptc'
|
||||
|
||||
interface Exception {
|
||||
tool: string
|
||||
side: 'sdk' | 'desktop'
|
||||
reason: string
|
||||
}
|
||||
|
||||
/** 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.' }],
|
||||
ptc: [
|
||||
{ tool: 'list_subagent_models', side: 'desktop',
|
||||
reason: 'Desktop enables subagent model discovery; SDK delegation inherits the caller model by default.' },
|
||||
{ tool: 'plugin_manager', side: 'sdk',
|
||||
reason: 'SDK PTC changes are persisted for restart without replacing active bindings because HMR is disabled; Desktop PTC excludes management in its HMR-enabled preset.' },
|
||||
{ tool: 'workflow', side: 'sdk',
|
||||
reason: 'The SDK PTC overlay changes only the executor so existing base workflow callers keep working; Desktop PTC uses run_code orchestration and omits the separate workflow surface.' },
|
||||
],
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare actual step-admitted sets, rejecting both drift and unused exceptions.
|
||||
* @param mode - matching SDK executor and Desktop preset.
|
||||
* @param sdk - SDK capability names.
|
||||
* @param desktop - Desktop capability names.
|
||||
* @param exceptions - exact one-sided product differences with their rationale.
|
||||
*/
|
||||
export function assertToolParity(
|
||||
mode: ToolMode, sdk: readonly string[], desktop: readonly string[],
|
||||
exceptions = toolParityExceptions[mode],
|
||||
): void {
|
||||
if (sdk.length === 0 || desktop.length === 0) throw new Error(`Empty tool inventory: ${mode}`)
|
||||
const only = {
|
||||
sdk: new Set(sdk.filter(name => !desktop.includes(name))),
|
||||
desktop: new Set(desktop.filter(name => !sdk.includes(name))),
|
||||
}
|
||||
const stale: string[] = []
|
||||
for (const exception of exceptions) {
|
||||
if (!exception.reason.trim()) throw new Error(`Tool exception requires a reason: ${exception.tool}`)
|
||||
if (!only[exception.side].delete(exception.tool)) stale.push(`${exception.side}:${exception.tool}`)
|
||||
}
|
||||
if (only.sdk.size || only.desktop.size || stale.length) {
|
||||
throw new Error([
|
||||
`SDK/Desktop tool mismatch: ${mode}`,
|
||||
`Missing from SDK: ${[...only.desktop].sort().join(', ') || '(none)'}`,
|
||||
`Only in SDK: ${[...only.sdk].sort().join(', ') || '(none)'}`,
|
||||
`Stale exceptions: ${stale.sort().join(', ') || '(none)'}`,
|
||||
].join('\n'))
|
||||
}
|
||||
}
|
||||
@@ -66,8 +66,8 @@
|
||||
en: 182a9c6705213e13
|
||||
zh: 681762f83490f4c6
|
||||
/deepseek-harness-desktop/updates/local-updater-qualification:
|
||||
en: 68ec2f8bd5763ea6
|
||||
zh: 23b932dfe8503602
|
||||
en: db5e898140a73d53
|
||||
zh: 80a9d58c74b4bb24
|
||||
/deepseek-harness-desktop/low-level-development-overrides:
|
||||
en: 8264b135871e8978
|
||||
zh: 0939aafb1b2961fc
|
||||
|
||||
@@ -353,6 +353,8 @@ The command builds the Desktop shell and runs its coordinator with real Electron
|
||||
|
||||
The downloaded bytes are inert, and the installation call is recorded rather than executed. The test substitutes browser opening and clipboard writing to avoid external navigation and clipboard changes. It does not boot the full product workspace, qualify a real installer or restart, verify publisher signatures, or exercise differential updates or macOS. Stalled policy requests, feed requests, and payload transfers exercise real deadlines and recovery. The actual ordinary dialog verifies isolated preload loading, card geometry, an unfiltered parent page, cancellation, task-warning choices, and explicit installation approval; account-row component tests provide separate evidence. The [local qualification decision](../../.agents/notes/implemented/testing/2026-09-10-desktop-local-updater-qualification.md) and [verification record](tests/README.md) preserve these limits; production release requirements remain unchanged.
|
||||
|
||||
Native original-file operations accept only the trusted application frame. Completion returns the destination path to that frame; revealing it uses the existing Host path-opening API without a separate reveal IPC or saved-file history. Downloads use Chromium’s URL download and native save-dialog APIs; `DSH_DESKTOP_FILE_DOWNLOAD_TIMEOUT_MS` bounds startup until Chromium creates the download (300000 ms); the native save dialog has no application deadline. Clipboard-only remote image reads omit credentials, validate every redirect, reject the application Host and its loopback aliases, stop on main-frame navigation, and use `DSH_DESKTOP_IMAGE_READ_TIMEOUT_MS` (30000 ms) and `DSH_DESKTOP_IMAGE_READ_MAX_BYTES` (67108864 bytes). Image copying uses the renderer Clipboard API after PNG conversion. Other reachable HTTP(S) destinations follow deployment network isolation. [File actions](../../packages/client/ui-file-actions/README.md) defines saving and clipboard behavior.
|
||||
|
||||
<a id="low-level-development-overrides"></a>
|
||||
|
||||
## Low-level development overrides
|
||||
|
||||
@@ -353,6 +353,8 @@ node apps/desktop/node_modules/pnpm/bin/pnpm.mjs --dir apps/desktop run test:upd
|
||||
|
||||
下载内容是不可执行的测试字节,安装调用仅记录而不执行。测试替换浏览器打开与剪贴板写入,避免外部导航和剪贴板修改。它不启动完整产品工作区,不验证真实安装器或重启,不验证发布者签名,也不覆盖差分更新或 macOS。停滞的策略请求、清单请求和负载传输会执行真实截止时间及恢复。真实常规弹窗验证隔离预加载、卡片尺寸、未施加模糊的父页面、取消、任务警告选项与显式安装批准;账户行组件测试另行提供证据。[本地验证决策](../../.agents/notes/implemented/testing/2026-09-10-desktop-local-updater-qualification.zh.md)和[验证记录](tests/README.zh.md)保留这些限制;生产发布要求保持不变。
|
||||
|
||||
原生原始文件操作仅接受可信应用页面。完成后向该页面返回目标路径;显示位置复用现有 Host 路径打开 API,不提供独立 reveal IPC,也不保留已保存文件历史。下载使用 Chromium URL 下载和原生保存对话框 API;`DSH_DESKTOP_FILE_DOWNLOAD_TIMEOUT_MS` 限定 Chromium 创建下载前的启动期限(300000 毫秒),不限制原生保存对话框的停留时间。仅剪贴板使用的远程图片读取不携带凭据,逐次校验重定向,拒绝应用 Host 及其回环别名,在主框架导航时终止,并使用 `DSH_DESKTOP_IMAGE_READ_TIMEOUT_MS`(30000 毫秒)与 `DSH_DESKTOP_IMAGE_READ_MAX_BYTES`(67108864 字节)。图片复制在转换为 PNG 后使用渲染进程的 Clipboard API。其他可达的 HTTP(S) 目标遵循部署侧网络隔离。[文件操作](../../packages/client/ui-file-actions/README.zh.md) 定义保存和剪贴板行为。
|
||||
|
||||
<a id="low-level-development-overrides"></a>
|
||||
|
||||
## 底层开发覆盖项
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
"@deepseek-ai/dsh-plugin-manager": "workspace:*",
|
||||
"zod": "4.4.3",
|
||||
"@deepseek-ai/dsh-util-file-drag": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-file-actions": "workspace:*",
|
||||
"tencentcloud-sdk-nodejs-teo": "4.1.330"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
/** Trusted-window Chromium downloads and clipboard fallback reads. */
|
||||
import { app, ipcMain, session } from 'electron'
|
||||
import type { BrowserWindow, IpcMainInvokeEvent } from 'electron'
|
||||
import { closeSync, openSync, rmSync } from 'node:fs'
|
||||
import { extname, join } from 'node:path'
|
||||
import { resolveDragFileName } from '@deepseek-ai/dsh-util-file-drag'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import type { FileSaveResult } from '@deepseek-ai/dsh-client-ui-file-actions/types'
|
||||
import { DESKTOP_IPC } from './ipc.ts'
|
||||
import { resolveDurationMs } from './duration-env.ts'
|
||||
|
||||
/** @param value - untrusted IPC input. @returns captured URL and destination policy. */
|
||||
function saveRequest(value: unknown): { url: URL; name?: string; mediaType?: string; mode: 'download' | 'saveAs' } {
|
||||
if (typeof value !== 'object' || value === null
|
||||
|| !('url' in value) || typeof value.url !== 'string'
|
||||
|| ('name' in value && typeof value.name !== 'string')
|
||||
|| ('mediaType' in value && typeof value.mediaType !== 'string')
|
||||
|| !('mode' in value) || (value.mode !== 'download' && value.mode !== 'saveAs')) throw new Error('Invalid file save request')
|
||||
const url = new URL(value.url)
|
||||
if (!['https:', 'http:', 'blob:', 'data:'].includes(url.protocol) || url.username || url.password) throw new Error('Unsupported file source')
|
||||
return { url, mode: value.mode,
|
||||
...'name' in value ? { name: value.name as string } : {},
|
||||
...'mediaType' in value ? { mediaType: value.mediaType as string } : {},
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install trusted-window original-file operations.
|
||||
* @param assertOwner - rejects shell pages, subframes, and unowned windows.
|
||||
* @param hostUrl - current application Host excluded from image reads.
|
||||
*/
|
||||
export function installFileActions(
|
||||
assertOwner: (event: IpcMainInvokeEvent) => BrowserWindow, hostUrl: () => string | undefined = () => undefined,
|
||||
): void {
|
||||
const timeoutMs = resolveDurationMs(process.env, 'DSH_DESKTOP_IMAGE_READ_TIMEOUT_MS', 30_000)
|
||||
const maxBytes = Number(process.env.DSH_DESKTOP_IMAGE_READ_MAX_BYTES ?? 64 * 1024 * 1024)
|
||||
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1) throw new Error('DSH_DESKTOP_IMAGE_READ_MAX_BYTES must be a positive integer')
|
||||
const pending = new Map<string, {
|
||||
event: IpcMainInvokeEvent
|
||||
owner: BrowserWindow
|
||||
request: ReturnType<typeof saveRequest>
|
||||
finish: (result: FileSaveResult | Error) => void
|
||||
started: () => void
|
||||
item?: Electron.DownloadItem
|
||||
}>()
|
||||
session.defaultSession.on('will-download', (_event, item, contents) => {
|
||||
const url = item.getURLChain()[0]
|
||||
if (url === undefined || !new URL(url).hash.startsWith('#dsh-download=')) return
|
||||
const entry = pending.get(url)
|
||||
if (entry === undefined || entry.owner.webContents !== contents) { item.cancel(); return }
|
||||
entry.started()
|
||||
entry.item = item
|
||||
let reserved: string | undefined
|
||||
try {
|
||||
assertOwner(entry.event)
|
||||
const name = resolveDragFileName({
|
||||
name: entry.request.name ?? item.getFilename(),
|
||||
mediaType: item.getMimeType() || entry.request.mediaType || '',
|
||||
})
|
||||
let destination = join(app.getPath('downloads'), name)
|
||||
if (entry.request.mode === 'saveAs') {
|
||||
item.setSaveDialogOptions({ defaultPath: destination, properties: ['showOverwriteConfirmation', 'createDirectory'] })
|
||||
} else {
|
||||
const extension = extname(destination)
|
||||
const stem = destination.slice(0, destination.length - extension.length)
|
||||
for (let index = 0; ; index++) {
|
||||
destination = index === 0 ? `${stem}${extension}` : `${stem} (${index})${extension}`
|
||||
try { closeSync(openSync(destination, 'wx')); break }
|
||||
catch (error) {
|
||||
if (typeof error === 'object' && error !== null && 'code' in error && error.code === 'EEXIST') continue
|
||||
throw error
|
||||
}
|
||||
}
|
||||
reserved = destination
|
||||
item.setSavePath(destination)
|
||||
}
|
||||
item.once('done', (_event, state) => {
|
||||
try {
|
||||
if (state !== 'completed') {
|
||||
if (reserved !== undefined) rmSync(reserved, { force: true })
|
||||
entry.finish(state === 'cancelled' ? { status: 'cancelled' } : new Error('File download interrupted'))
|
||||
return
|
||||
}
|
||||
if (!pending.has(url)) return
|
||||
assertOwner(entry.event)
|
||||
entry.finish({ status: 'saved', path: item.getSavePath() })
|
||||
} catch (error) { entry.finish(error instanceof Error ? error : new Error('File download unavailable')) }
|
||||
})
|
||||
} catch (error) {
|
||||
item.cancel()
|
||||
try { if (reserved !== undefined) rmSync(reserved, { force: true }) }
|
||||
catch (cleanupError) {
|
||||
entry.finish(new AggregateError([error, cleanupError], 'File download failed and its partial file could not be removed'))
|
||||
return
|
||||
}
|
||||
entry.finish(error instanceof Error ? error : new Error('File download unavailable'))
|
||||
}
|
||||
})
|
||||
const downloadTimeoutMs = resolveDurationMs(process.env, 'DSH_DESKTOP_FILE_DOWNLOAD_TIMEOUT_MS', 300_000)
|
||||
ipcMain.handle(DESKTOP_IPC.fileSave, (event, value: unknown): Promise<FileSaveResult> => {
|
||||
const owner = assertOwner(event)
|
||||
const request = saveRequest(value)
|
||||
// Fragments do not change the fetched resource; each native request has its own completion identity.
|
||||
request.url.hash = `dsh-download=${randomUUID()}`
|
||||
const url = request.url.href
|
||||
return new Promise((resolve, reject) => {
|
||||
const contents = owner.webContents
|
||||
const finish = (result: FileSaveResult | Error): void => {
|
||||
if (!pending.delete(url)) return
|
||||
clearTimeout(timer)
|
||||
owner.removeListener('closed', cancel)
|
||||
contents.removeListener('did-start-navigation', navigate)
|
||||
if (result instanceof Error) reject(result)
|
||||
else resolve(result)
|
||||
}
|
||||
const cancel = (): void => {
|
||||
const item = pending.get(url)?.item
|
||||
finish({ status: 'cancelled' })
|
||||
item?.cancel()
|
||||
}
|
||||
const navigate = (_event: Electron.Event, _url: string, inPlace: boolean, mainFrame: boolean): void => {
|
||||
if (mainFrame && !inPlace) cancel()
|
||||
}
|
||||
const timer = setTimeout(() => {
|
||||
const item = pending.get(url)?.item
|
||||
finish(new Error('File download timed out'))
|
||||
item?.cancel()
|
||||
}, downloadTimeoutMs)
|
||||
pending.set(url, { event, owner, request, finish, started: () => { clearTimeout(timer) } })
|
||||
owner.once('closed', cancel)
|
||||
contents.on('did-start-navigation', navigate)
|
||||
try { contents.downloadURL(url) }
|
||||
catch (error) { finish(error instanceof Error ? error : new Error('File download unavailable')) }
|
||||
})
|
||||
})
|
||||
ipcMain.handle(DESKTOP_IPC.clipboardImageRead, async (event, value: unknown) => {
|
||||
const owner = assertOwner(event)
|
||||
if (typeof value !== 'string') throw new Error('Invalid image URL')
|
||||
const checkedUrl = (value: string): URL => {
|
||||
const url = new URL(value)
|
||||
const host = hostUrl()
|
||||
const application = host === undefined ? undefined : new URL(host)
|
||||
if (!['https:', 'http:'].includes(url.protocol) || url.username || url.password
|
||||
|| application !== undefined && url.port === application.port
|
||||
&& (url.hostname === application.hostname || ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname))) {
|
||||
throw new Error('Invalid image URL')
|
||||
}
|
||||
return url
|
||||
}
|
||||
let url = checkedUrl(value)
|
||||
const contents = owner.webContents
|
||||
const lifetime = new AbortController()
|
||||
const abort = (): void => { lifetime.abort() }
|
||||
owner.once('closed', abort)
|
||||
const navigate = (_event: Electron.Event, _url: string, inPlace: boolean, mainFrame: boolean): void => {
|
||||
if (mainFrame && !inPlace) abort()
|
||||
}
|
||||
contents.on('did-start-navigation', navigate)
|
||||
try {
|
||||
const signal = AbortSignal.any([lifetime.signal, AbortSignal.timeout(timeoutMs)])
|
||||
let response: Response
|
||||
for (let redirects = 0; ; redirects++) {
|
||||
response = await fetch(url, { signal, redirect: 'manual', credentials: 'omit', referrerPolicy: 'no-referrer' })
|
||||
if (![301, 302, 303, 307, 308].includes(response.status)) break
|
||||
await response.body?.cancel()
|
||||
const location = response.headers.get('location')
|
||||
if (redirects >= 20 || location === null) throw new Error('Invalid image redirect')
|
||||
url = checkedUrl(new URL(location, url).href)
|
||||
}
|
||||
if (!response.ok) throw new Error('Original image unavailable')
|
||||
const reader = response.body?.getReader()
|
||||
if (reader === undefined) throw new Error('Original image unavailable')
|
||||
const chunks: Uint8Array[] = []
|
||||
let size = 0
|
||||
try {
|
||||
for (;;) {
|
||||
const chunk = await reader.read()
|
||||
if (chunk.done) break
|
||||
size += chunk.value.byteLength
|
||||
if (size > maxBytes) throw new Error('Original image exceeds the download limit')
|
||||
chunks.push(chunk.value)
|
||||
}
|
||||
} finally { await reader.cancel(); reader.releaseLock() }
|
||||
assertOwner(event)
|
||||
lifetime.signal.throwIfAborted()
|
||||
return { bytes: new Uint8Array(Buffer.concat(chunks)), mediaType: response.headers.get('content-type') ?? '' }
|
||||
} finally {
|
||||
owner.removeListener('closed', abort)
|
||||
contents.removeListener('did-start-navigation', navigate)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { DesktopFileActions } from '@deepseek-ai/dsh-client-ui-file-actions/types'
|
||||
/** Typed preload operations exposed only by the Electron shell. */
|
||||
|
||||
import type { DesktopKeyboardApi, DesktopShortcutsApi } from '@deepseek-ai/dsh-client-shortcuts/protocol'
|
||||
@@ -7,6 +8,8 @@ import type { DesktopFileDrag } from '@deepseek-ai/dsh-util-file-drag'
|
||||
|
||||
/** IPC channel names kept private to the desktop application bundle. */
|
||||
export const DESKTOP_IPC = {
|
||||
fileSave: 'dsh-desktop:file-save',
|
||||
clipboardImageRead: 'dsh-desktop:clipboard-image-read',
|
||||
shortcutsInput: 'dsh-desktop:shortcuts-input',
|
||||
shortcutsCloseWindow: 'dsh-desktop:shortcuts-close-window',
|
||||
shortcutsGet: 'dsh-desktop:shortcuts-get',
|
||||
@@ -76,6 +79,7 @@ export interface DesktopUpdatePresentation {
|
||||
|
||||
/** Product documents cannot supply update versions, package URLs, or installation authorization. */
|
||||
export interface DshDesktopProductApi {
|
||||
readonly fileActions: DesktopFileActions
|
||||
readonly protocolVersion: 1
|
||||
readonly browser: DesktopBrowserBridge
|
||||
readonly fileDrag: DesktopFileDrag
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { installFileActions } from './file-actions.ts'
|
||||
import type { ProductEventMap, ProductEvent } from '@deepseek-ai/dsh-client-product-analytics/types'
|
||||
import { WINDOWS_TITLEBAR_HEIGHT } from './windows-layout.ts'
|
||||
/** Electron shell: desktop project ownership, custom protocol, windows, and lifecycle. */
|
||||
@@ -826,6 +827,7 @@ async function main(): Promise<void> {
|
||||
|| !event.senderFrame.url.startsWith('dsh-app://app/')) throw new Error('Rejected Platform command')
|
||||
return owner
|
||||
}
|
||||
installFileActions(assertMainApplication, () => hostUrl)
|
||||
ipcMain.on(PLATFORM_IPC.bootstrap, (event) => {
|
||||
try { event.returnValue = platformView.bootstrap(event) }
|
||||
catch { event.returnValue = null }
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { FileSaveResult } from '@deepseek-ai/dsh-client-ui-file-actions/types'
|
||||
/** Origin-scoped boot, native directory selection, host paths of picked files, and update presentation with native confirmation actions. */
|
||||
|
||||
import type { DesktopShortcutInput, ShortcutConfigSnapshot, ShortcutSaveResult } from '@deepseek-ai/dsh-client-shortcuts/protocol'
|
||||
@@ -14,6 +15,11 @@ import type { FileDragHandle } from '@deepseek-ai/dsh-util-file-drag'
|
||||
function createProductApi(): DshDesktopProductApi {
|
||||
return {
|
||||
protocolVersion: 1,
|
||||
fileActions: {
|
||||
save: request => ipcRenderer.invoke(DESKTOP_IPC.fileSave, request) as Promise<FileSaveResult>,
|
||||
readClipboardImage: url => ipcRenderer.invoke(DESKTOP_IPC.clipboardImageRead, url) as
|
||||
Promise<{ bytes: Uint8Array; mediaType: string }>,
|
||||
},
|
||||
browser: createDesktopBrowserBridge(),
|
||||
fileDrag: {
|
||||
prepare: (source, requestId) => ipcRenderer.invoke(DESKTOP_IPC.fileDragPrepare, source, requestId) as
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
/** Native original-byte saves and window-scoped IPC ownership. */
|
||||
import { EventEmitter } from 'node:events'
|
||||
import { mkdtemp, readFile, readdir, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import type { IpcMainInvokeEvent } from 'electron'
|
||||
import { afterEach, expect, it, vi } from 'vitest'
|
||||
import { installFileActions } from '../src/file-actions.ts'
|
||||
import { DESKTOP_IPC } from '../src/ipc.ts'
|
||||
|
||||
const electron = vi.hoisted(() => ({
|
||||
app: { getPath: vi.fn() }, ipcMain: { handle: vi.fn() }, session: { defaultSession: { on: vi.fn() } },
|
||||
}))
|
||||
vi.mock('electron', () => electron)
|
||||
const roots: string[] = []
|
||||
const owners: EventEmitter[] = []
|
||||
afterEach(async () => {
|
||||
for (const owner of owners.splice(0)) owner.emit('closed')
|
||||
vi.useRealTimers(); vi.unstubAllEnvs()
|
||||
await Promise.all(roots.splice(0).map(path => rm(path, { recursive: true, force: true }))); vi.clearAllMocks(); vi.unstubAllGlobals()
|
||||
})
|
||||
async function directory() { const path = await mkdtemp(join(tmpdir(), 'dsh-file-actions-')); roots.push(path); return path }
|
||||
|
||||
function harness(root: string) {
|
||||
const owner = Object.assign(new EventEmitter(), {
|
||||
webContents: Object.assign(new EventEmitter(), { downloadURL: vi.fn<(url: string) => void>() }), isDestroyed: () => false,
|
||||
})
|
||||
owners.push(owner)
|
||||
const assertOwner = vi.fn(() => owner as never)
|
||||
electron.app.getPath.mockReturnValue(root)
|
||||
installFileActions(assertOwner)
|
||||
const event = {} as IpcMainInvokeEvent
|
||||
const invoke = async (channel: string, value: unknown): Promise<unknown> => {
|
||||
const handler = electron.ipcMain.handle.mock.calls.find(([name]) => name === channel)?.[1] as
|
||||
(event: IpcMainInvokeEvent, value: unknown) => Promise<unknown>
|
||||
return handler(event, value)
|
||||
}
|
||||
const item = (mime = 'image/gif', url = owner.webContents.downloadURL.mock.lastCall![0]) => {
|
||||
let destination = ''
|
||||
const download = Object.assign(new EventEmitter(), {
|
||||
getURLChain: () => [url],
|
||||
getFilename: () => 'original.gif', getMimeType: () => mime, getSavePath: () => destination,
|
||||
setSavePath: vi.fn((path: string) => { destination = path }),
|
||||
setSaveDialogOptions: vi.fn(), cancel: vi.fn(),
|
||||
})
|
||||
const willDownload = electron.session.defaultSession.on.mock.calls[0]![1] as
|
||||
(event: object, item: object, contents: object) => void
|
||||
willDownload({}, download, owner.webContents)
|
||||
return download
|
||||
}
|
||||
const save = async (mode: 'download' | 'saveAs' = 'download') => {
|
||||
const pending = invoke(DESKTOP_IPC.fileSave, { url: 'https://images.example/original.gif', name: 'image.gif', mode })
|
||||
const download = item()
|
||||
if (mode === 'download') await writeFile(download.getSavePath(), new Uint8Array([0, 128, 255]))
|
||||
download.emit('done', {}, 'completed')
|
||||
return pending
|
||||
}
|
||||
return { owner, assertOwner, invoke, item, save }
|
||||
}
|
||||
|
||||
it('returns the completed destination and releases download listeners', async () => {
|
||||
const root = await directory(), f = harness(root)
|
||||
await expect(f.save()).resolves.toEqual({ status: 'saved', path: join(root, 'image.gif') })
|
||||
expect(f.owner.listenerCount('closed')).toBe(0)
|
||||
expect(f.owner.webContents.listenerCount('did-start-navigation')).toBe(0)
|
||||
})
|
||||
|
||||
it.each(['file:///private/data', 'dsh-app://app/api/private', 'javascript:alert(1)'])('rejects unsupported URL %s', async (url) => {
|
||||
const root = await directory(), f = harness(root)
|
||||
await expect(f.invoke(DESKTOP_IPC.fileSave, { url, mode: 'download' })).rejects.toThrow('Unsupported')
|
||||
expect(await readdir(root)).toEqual([])
|
||||
})
|
||||
|
||||
it('retains original downloads and reserves distinct paths until Chromium finishes', async () => {
|
||||
const root = await directory(), f = harness(root)
|
||||
await writeFile(join(root, 'image.gif'), 'previous')
|
||||
await f.save()
|
||||
expect(await readFile(join(root, 'image.gif'), 'utf8')).toBe('previous')
|
||||
expect(await readFile(join(root, 'image (1).gif'))).toEqual(Buffer.from([0, 128, 255]))
|
||||
})
|
||||
|
||||
it.each(['cancelled', 'interrupted'] as const)('reports native %s without a completed path', async (state) => {
|
||||
const root = await directory(), f = harness(root)
|
||||
const pending = f.invoke(DESKTOP_IPC.fileSave, { url: 'https://images.example/a', name: 'wrong.png', mode: 'download' })
|
||||
const download = f.item('image/webp')
|
||||
expect(download.setSavePath).toHaveBeenCalledWith(join(root, 'wrong.webp'))
|
||||
download.emit('done', {}, state)
|
||||
if (state === 'cancelled') await expect(pending).resolves.toEqual({ status: 'cancelled' })
|
||||
else await expect(pending).rejects.toThrow('interrupted')
|
||||
expect(await readdir(root)).toEqual([])
|
||||
})
|
||||
|
||||
it('uses the native save dialog and waits for completion before reporting success', async () => {
|
||||
const root = await directory(), f = harness(root)
|
||||
const pending = f.invoke(DESKTOP_IPC.fileSave, { url: 'https://images.example/a', name: 'photo.png', mode: 'saveAs' })
|
||||
const download = f.item('image/jpeg')
|
||||
expect(download.setSavePath).not.toHaveBeenCalled()
|
||||
expect(download.setSaveDialogOptions).toHaveBeenCalledWith({ defaultPath: join(root, 'photo.jpg'), properties: ['showOverwriteConfirmation', 'createDirectory'] })
|
||||
download.emit('done', {}, 'cancelled')
|
||||
await expect(pending).resolves.toEqual({ status: 'cancelled' })
|
||||
f.assertOwner.mockImplementation(() => { throw new Error('Rejected owner') })
|
||||
await expect(f.invoke(DESKTOP_IPC.fileSave, {})).rejects.toThrow('Rejected owner')
|
||||
})
|
||||
|
||||
it('cancels pending downloads when the owning document changes', async () => {
|
||||
const f = harness(await directory())
|
||||
const pending = f.invoke(DESKTOP_IPC.fileSave, { url: 'https://images.example/a', mode: 'download' })
|
||||
const download = f.item()
|
||||
f.owner.webContents.emit('did-start-navigation', {}, 'dsh-app://app/', false, true)
|
||||
await expect(pending).resolves.toEqual({ status: 'cancelled' })
|
||||
expect(download.cancel).toHaveBeenCalledOnce()
|
||||
download.emit('done', {}, 'cancelled')
|
||||
expect(f.owner.listenerCount('closed')).toBe(0)
|
||||
})
|
||||
|
||||
it('matches overlapping downloads of the same source to their captured requests', async () => {
|
||||
const root = await directory(), f = harness(root)
|
||||
const first = f.invoke(DESKTOP_IPC.fileSave, { url: 'https://images.example/a', name: 'first.gif', mode: 'download' })
|
||||
const firstUrl = f.owner.webContents.downloadURL.mock.lastCall![0]
|
||||
const second = f.invoke(DESKTOP_IPC.fileSave, { url: 'https://images.example/a', name: 'second.gif', mode: 'saveAs' })
|
||||
const secondItem = f.item()
|
||||
const firstItem = f.item('image/gif', firstUrl)
|
||||
expect(firstItem.setSavePath).toHaveBeenCalledWith(join(root, 'first.gif'))
|
||||
expect(secondItem.setSaveDialogOptions.mock.lastCall?.[0]).toMatchObject({ defaultPath: join(root, 'second.gif') })
|
||||
secondItem.emit('done', {}, 'cancelled')
|
||||
firstItem.emit('done', {}, 'completed')
|
||||
await expect(first).resolves.toMatchObject({ status: 'saved' })
|
||||
await expect(second).resolves.toEqual({ status: 'cancelled' })
|
||||
})
|
||||
|
||||
it('retires timed-out downloads and cancels items arriving after their window closes', async () => {
|
||||
vi.useFakeTimers(); vi.stubEnv('DSH_DESKTOP_FILE_DOWNLOAD_TIMEOUT_MS', '1000')
|
||||
const root = await directory(), f = harness(root)
|
||||
const pending = f.invoke(DESKTOP_IPC.fileSave, { url: 'https://images.example/a', mode: 'download' })
|
||||
const rejected = expect(pending).rejects.toThrow('timed out')
|
||||
await vi.advanceTimersByTimeAsync(1000)
|
||||
await rejected
|
||||
const download = f.item()
|
||||
expect(download.cancel).toHaveBeenCalledOnce()
|
||||
download.emit('done', {}, 'cancelled')
|
||||
expect(await readdir(root)).toEqual([])
|
||||
expect(f.owner.listenerCount('closed')).toBe(0)
|
||||
expect(f.owner.webContents.listenerCount('did-start-navigation')).toBe(0)
|
||||
|
||||
const late = f.invoke(DESKTOP_IPC.fileSave, { url: 'https://images.example/a', mode: 'download' })
|
||||
f.owner.emit('closed')
|
||||
await expect(late).resolves.toEqual({ status: 'cancelled' })
|
||||
const stale = f.item()
|
||||
expect(stale.cancel).toHaveBeenCalledOnce()
|
||||
expect(stale.setSavePath).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('allows the native save dialog to remain open beyond the download startup deadline', async () => {
|
||||
vi.useFakeTimers(); vi.stubEnv('DSH_DESKTOP_FILE_DOWNLOAD_TIMEOUT_MS', '1000')
|
||||
const f = harness(await directory())
|
||||
const pending = f.invoke(DESKTOP_IPC.fileSave, { url: 'https://images.example/a', mode: 'saveAs' })
|
||||
const download = f.item()
|
||||
await vi.advanceTimersByTimeAsync(2000)
|
||||
expect(download.cancel).not.toHaveBeenCalled()
|
||||
download.emit('done', {}, 'completed')
|
||||
await expect(pending).resolves.toMatchObject({ status: 'saved' })
|
||||
})
|
||||
|
||||
it('reports a synchronous Chromium launch failure and releases pending listeners', async () => {
|
||||
const f = harness(await directory())
|
||||
f.owner.webContents.downloadURL.mockImplementation(() => { throw new Error('Download unavailable') })
|
||||
await expect(f.invoke(DESKTOP_IPC.fileSave, { url: 'https://images.example/a', mode: 'download' })).rejects.toThrow('Download unavailable')
|
||||
expect(f.owner.listenerCount('closed')).toBe(0)
|
||||
expect(f.owner.webContents.listenerCount('did-start-navigation')).toBe(0)
|
||||
})
|
||||
|
||||
it('aborts original-image reads on window navigation and releases lifecycle listeners', async () => {
|
||||
const f = harness(await directory())
|
||||
let signal!: AbortSignal
|
||||
vi.stubGlobal('fetch', vi.fn((_url: URL, options: RequestInit) => new Promise<Response>((_resolve, reject) => {
|
||||
signal = options.signal!
|
||||
signal.addEventListener('abort', () => { reject(new DOMException('Aborted', 'AbortError')) }, { once: true })
|
||||
})))
|
||||
const reading = f.invoke(DESKTOP_IPC.clipboardImageRead, 'https://images.example/original.gif')
|
||||
f.owner.webContents.emit('did-start-navigation', {}, 'dsh-app://app/', false, true)
|
||||
await expect(reading).rejects.toThrow('Aborted')
|
||||
expect(signal.aborted).toBe(true)
|
||||
expect(f.owner.listenerCount('closed')).toBe(0)
|
||||
expect(f.owner.webContents.listenerCount('did-start-navigation')).toBe(0)
|
||||
})
|
||||
|
||||
it('preserves pending downloads across iframe and same-document navigation', async () => {
|
||||
const root = await directory(), f = harness(root)
|
||||
const pending = f.invoke(DESKTOP_IPC.fileSave, { url: 'https://images.example/a', mode: 'saveAs' })
|
||||
const download = f.item()
|
||||
f.owner.webContents.emit('did-start-navigation', {}, 'https://example.org', false, false)
|
||||
f.owner.webContents.emit('did-start-navigation', {}, 'dsh-app://app/#tab', true, true)
|
||||
download.setSavePath(join(root, 'chosen.gif'))
|
||||
download.emit('done', {}, 'completed')
|
||||
await expect(pending).resolves.toEqual({ status: 'saved', path: join(root, 'chosen.gif') })
|
||||
expect(download.cancel).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects redirects to the application Host', async () => {
|
||||
const root = await directory()
|
||||
const owner = Object.assign(new EventEmitter(), {
|
||||
webContents: Object.assign(new EventEmitter(), { downloadURL: vi.fn<(url: string) => void>() }), isDestroyed: () => false,
|
||||
})
|
||||
installFileActions(() => owner as never, () => 'http://127.0.0.1:19321')
|
||||
const handler = (name: string) => electron.ipcMain.handle.mock.calls.find(([channel]) => channel === name)![1] as
|
||||
(event: IpcMainInvokeEvent, value: unknown) => Promise<unknown>
|
||||
const fetchImage = vi.fn(async () => new Response(null, { status: 302, headers: { location: 'http://localhost:19321/api/private' } }))
|
||||
vi.stubGlobal('fetch', fetchImage)
|
||||
const event = {} as IpcMainInvokeEvent
|
||||
await expect(handler(DESKTOP_IPC.clipboardImageRead)(event, 'https://images.example/photo')).rejects.toThrow('Invalid image URL')
|
||||
expect(fetchImage).toHaveBeenCalledOnce()
|
||||
expect(await readdir(root)).toEqual([])
|
||||
})
|
||||
@@ -317,6 +317,7 @@ vi.mock('electron', () => ({
|
||||
},
|
||||
Menu: { setApplicationMenu: harness.menu.setApplicationMenu, buildFromTemplate: harness.menu },
|
||||
session: { defaultSession: {
|
||||
on: vi.fn(),
|
||||
setPermissionCheckHandler: vi.fn(), setPermissionRequestHandler: vi.fn(), webRequest: { onBeforeSendHeaders: harness.socketHeaders },
|
||||
} },
|
||||
protocol: { registerSchemesAsPrivileged: vi.fn(), handle: harness.protocolHandle },
|
||||
|
||||
@@ -38,6 +38,19 @@ it('exposes onboarding size activation to the application document', async () =>
|
||||
expect(electron.ipcRenderer.send.mock.calls).toEqual([[DESKTOP_IPC.onboardingActive, true], [DESKTOP_IPC.onboardingActive, false]])
|
||||
})
|
||||
|
||||
it('routes original-file requests through the trusted application bridge', async () => {
|
||||
vi.stubGlobal('location', new URL('dsh-app://app/'))
|
||||
await import('../src/preload-app.ts')
|
||||
const api = electron.contextBridge.exposeInMainWorld.mock.calls.find(([name]) => name === 'dshDesktop')?.[1] as DshDesktopProductApi
|
||||
const request = { url: 'https://images.example/original.gif', name: 'image.gif', mode: 'download' as const }
|
||||
await api.fileActions.save(request)
|
||||
await api.fileActions.readClipboardImage('https://images.example/original.gif')
|
||||
expect(electron.ipcRenderer.invoke.mock.calls).toEqual([
|
||||
[DESKTOP_IPC.fileSave, request],
|
||||
[DESKTOP_IPC.clipboardImageRead, 'https://images.example/original.gif'],
|
||||
])
|
||||
})
|
||||
|
||||
it('limits product documents to update status and a native confirmation action', async () => {
|
||||
vi.stubGlobal('location', new URL('dsh-app://app/index.html'))
|
||||
await import('../src/preload-app.ts')
|
||||
|
||||
@@ -87,6 +87,7 @@ vi.mock('electron', () => ({
|
||||
net: { fetch: vi.fn() },
|
||||
nativeTheme: state.nativeTheme,
|
||||
session: { defaultSession: {
|
||||
on: vi.fn(),
|
||||
setPermissionCheckHandler: vi.fn(), setPermissionRequestHandler: vi.fn(), webRequest: { onBeforeSendHeaders: vi.fn() },
|
||||
} },
|
||||
protocol: { registerSchemesAsPrivileged: vi.fn(), handle: vi.fn() },
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
},
|
||||
{
|
||||
"path": "../../packages/client/product-analytics/tsconfig.client.json"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/client/ui-file-actions"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -40,6 +40,9 @@
|
||||
},
|
||||
{
|
||||
"path": "../../packages/util/file-drag"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/client/ui-file-actions"
|
||||
}
|
||||
],
|
||||
"exclude": [
|
||||
|
||||
@@ -26,7 +26,7 @@ async function openInventory(page: Page, url: string) {
|
||||
return dialog
|
||||
}
|
||||
|
||||
it('places dynamic Session menu rows by order among the shipped ones and removes them with their fiber', async () => {
|
||||
it('keeps ordered legacy Session menu rows before Archive and removes them with their fiber', async () => {
|
||||
const scaffold = await launchWebScaffold({ extraInstallAnchors: [join(FIXTURE, 'package.json')] })
|
||||
onTestFinished(() => scaffold.close())
|
||||
const workspace = await scaffold.ctx.workspaceRegistry.create(scaffold.workspaceCwd)
|
||||
@@ -46,12 +46,13 @@ it('places dynamic Session menu rows by order among the shipped ones and removes
|
||||
|
||||
const trailing = row.locator('[data-session-trailing]')
|
||||
const observations: { stage: string; icons: string[]; time: boolean; pinned: boolean; actions: boolean }[] = []
|
||||
const observe = async (stage: string, iconsVisible: boolean, actionsVisible: boolean, target = row): Promise<void> => {
|
||||
const observe = async (stage: string, iconsVisible: boolean, actionsVisible: boolean, target = row,
|
||||
timeVisible = iconsVisible): Promise<void> => {
|
||||
const icons = target.locator('[data-session-trailing]')
|
||||
const actions = target.getByRole('button', { name: `Session actions for ${SESSION_TITLE}` })
|
||||
const time = target.locator('[class*="time"]')
|
||||
await expect.poll(() => icons.first().isVisible()).toBe(iconsVisible)
|
||||
await expect.poll(() => time.isVisible()).toBe(iconsVisible)
|
||||
await expect.poll(() => time.isVisible()).toBe(timeVisible)
|
||||
await expect.poll(() => actions.isVisible()).toBe(actionsVisible)
|
||||
observations.push({
|
||||
stage,
|
||||
@@ -94,14 +95,16 @@ it('places dynamic Session menu rows by order among the shipped ones and removes
|
||||
await observe('menu-open', false, true)
|
||||
const menu = page.getByRole('menu')
|
||||
await menu.waitFor()
|
||||
expect(await menu.getByRole('separator').count()).toBe(1)
|
||||
expect(await menu.getByRole('separator').count()).toBe(3)
|
||||
const exportRow = menu.getByRole('menuitem', { name: 'Export session', exact: true })
|
||||
expect(await exportRow.locator('..').getByRole('separator').isVisible()).toBe(true)
|
||||
await compareOrRefreshGolden(
|
||||
SESSION_ACTION_EXPECTED,
|
||||
await captureStableAria(page, '[role="menu"]', scaffold.workspaceCwd),
|
||||
webSnapshotMode(),
|
||||
)
|
||||
|
||||
await menu.getByRole('menuitem', { name: 'Export session' }).press('Enter')
|
||||
await exportRow.press('Enter')
|
||||
await expect.poll(() => menu.count()).toBe(0)
|
||||
expect(await page.evaluate(() => ({
|
||||
action: document.documentElement.dataset.sessionAction,
|
||||
@@ -138,18 +141,18 @@ it('places dynamic Session menu rows by order among the shipped ones and removes
|
||||
const touchTrigger = touchRow.getByRole('button', { name: `Session actions for ${SESSION_TITLE}` })
|
||||
await touchTrigger.waitFor()
|
||||
expect(await touchPage.evaluate(() => matchMedia('(hover: hover)').matches)).toBe(false)
|
||||
await observe('touch', true, true, touchRow)
|
||||
await observe('touch', true, true, touchRow, false)
|
||||
expect(await touchRow.getByRole('button', { name: 'Archive session', exact: true }).isVisible()).toBe(false)
|
||||
expect(await touchRow.getByRole('button', { name: 'Pin session', exact: true }).isVisible()).toBe(false)
|
||||
await touchTrigger.tap()
|
||||
await touchPage.getByRole('menu').waitFor()
|
||||
await observe('touch-menu-open', true, true, touchRow)
|
||||
await observe('touch-menu-open', true, true, touchRow, false)
|
||||
await touchPage.keyboard.press('Escape')
|
||||
await observe('touch-menu-closed', true, true, touchRow)
|
||||
await observe('touch-menu-closed', true, true, touchRow, false)
|
||||
await touchTrigger.tap()
|
||||
await touchPage.getByRole('menuitem', { name: 'Pin session', exact: true }).tap()
|
||||
await touchRow.getByRole('img', { name: 'Pinned', exact: true }).waitFor()
|
||||
await observe('touch-pinned', true, true, touchRow)
|
||||
await touchRow.getByRole('button', { name: 'Unpin session', exact: true }).waitFor()
|
||||
await observe('touch-pinned', true, true, touchRow, false)
|
||||
const touchBounds = await touchRow.evaluate((element) => {
|
||||
const title = element.querySelector('[class*="title"]')!.getBoundingClientRect()
|
||||
const resting = element.querySelector('[class*="rowResting"]')!.getBoundingClientRect()
|
||||
@@ -173,7 +176,7 @@ it('places dynamic Session menu rows by order among the shipped ones and removes
|
||||
expect(await row.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
await observe('clicked-archived-row', true, false)
|
||||
await scaffold.ctx.workspaceRegistry.unarchiveSession(sessionId)
|
||||
await observe('touch-unarchived', true, true, touchRow)
|
||||
await observe('touch-unarchived', true, true, touchRow, false)
|
||||
expect(touchConsole.pageErrors).toEqual([])
|
||||
} finally {
|
||||
await touchPage.close()
|
||||
@@ -193,13 +196,13 @@ it('places dynamic Session menu rows by order among the shipped ones and removes
|
||||
await row.hover()
|
||||
await trigger.click()
|
||||
await menu.waitFor()
|
||||
const remainingNames = ['Pin session', 'Rename', 'Fork session', 'Archive session', 'Copy Session ID']
|
||||
const remainingNames = ['Pin session', 'Rename', 'Fork session', 'Copy Session ID', 'Archive session']
|
||||
const remainingItems = menu.getByRole('menuitem')
|
||||
expect(await remainingItems.count()).toBe(remainingNames.length)
|
||||
for (const [index, name] of remainingNames.entries()) {
|
||||
expect(await remainingItems.nth(index).and(menu.getByRole('menuitem', { name, exact: true })).count()).toBe(1)
|
||||
}
|
||||
expect(await menu.getByRole('separator').count()).toBe(0)
|
||||
expect(await menu.getByRole('separator').count()).toBe(2)
|
||||
await page.context().grantPermissions(['clipboard-read', 'clipboard-write'])
|
||||
await menu.getByRole('menuitem', { name: 'Copy Session ID', exact: true }).click()
|
||||
await expect.poll(() => menu.count()).toBe(0)
|
||||
|
||||
@@ -0,0 +1,386 @@
|
||||
/** Context gestures against built plugins, seeded Sessions, and original files. */
|
||||
import { mkdir, readFile, writeFile } from 'node:fs/promises'
|
||||
import { join } from 'node:path'
|
||||
import { chromium, type Browser, type Locator, type Page } from 'playwright'
|
||||
import { afterAll, beforeAll, describe, expect, it, onTestFailed, vi } from 'vitest'
|
||||
import { createLaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment'
|
||||
import { createAssistantMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
|
||||
import { SESSION_FORMAT_VERSION, Session, SessionId } from '@deepseek-ai/dsh-session'
|
||||
import type {} from '@deepseek-ai/dsh-session-title'
|
||||
import { launchWebScaffold, seedSession, watchConsole, type WebScaffold } from './scaffold.ts'
|
||||
import { saveFailureShot } from './support.ts'
|
||||
|
||||
const GIF = Buffer.from('R0lGODdhMAAgAIEAAEtu5gAAAAAAAAAAACwAAAAAMAAgAEAIQQABCBxIsKDBgwgTKlzIsKHDhxAjSpxIsaLFixgzatzIsaPHjyBDihxJsqTJkyhTqlzJsqXLlzBjypxJs6bNmQEBADs=', 'base64')
|
||||
async function menuLabels(menu: Locator): Promise<string[]> {
|
||||
return menu.getByRole('menuitem').evaluateAll(items => items.map((item) => {
|
||||
const copy = item.cloneNode(true) as HTMLElement
|
||||
for (const decoration of copy.querySelectorAll('[aria-hidden="true"]')) decoration.remove()
|
||||
return copy.textContent ?? ''
|
||||
}))
|
||||
}
|
||||
function fixture(title: string): string {
|
||||
const session = Session.create(SessionId('context-menus-source'))
|
||||
session.append('turn/start', { turn: 1 })
|
||||
const user = session.append('user/message', createUserMessage({ content: [{ type: 'text', text: 'Show the output.' }], source: { kind: 'user' } }), { surfaceOp: 'append' })
|
||||
session.append('session/title', { title, messageSeqs: [user.seq], source: { kind: 'fallback' } })
|
||||
session.append('step/start', { turn: 1, step: 1 })
|
||||
session.append('assistant/message', { stream: [], turn: 1, step: 1, message: createAssistantMessage({
|
||||
content: [{ type: 'text', text: '[First file](first.txt#L2) [Second file](second.txt) [Website](https://example.com/path?q=1#fragment)\n\n \n\nCONTEXT_MENU_READY' }],
|
||||
source: { provider: 'deepseek-official', model: 'deepseek-v4-flash' },
|
||||
}) }, { surfaceOp: 'append' })
|
||||
session.append('step/end', { turn: 1, step: 1 })
|
||||
session.append('turn/end', { turn: 1, reason: { kind: 'completed' } })
|
||||
return [JSON.stringify({ type: 'session', version: SESSION_FORMAT_VERSION, id: '{{sessionId}}', createdAt: 0, cwd: '{{cwd}}', isSeeded: false, delegationDepth: 0 }),
|
||||
...session.snapshotEvents().map(event => JSON.stringify({ ...event, time: 1_000 + event.seq * 1_000 })), ''].join('\n')
|
||||
}
|
||||
|
||||
describe.each(['MacIntel', 'Win32', 'Linux x86_64'])('web context menus on %s', (platform) => {
|
||||
let scaffold: WebScaffold, browser: Browser, page: Page
|
||||
let tripwire: ReturnType<typeof watchConsole>
|
||||
beforeAll(async () => {
|
||||
scaffold = await launchWebScaffold({ openInAppEnvironment: createLaunchEnvironmentSnapshot([{ source: 'process', values: { SSH_CONNECTION: '10.0.0.2 55000 10.0.0.9 22' } }]) })
|
||||
await mkdir(join(scaffold.workspaceCwd, 'folder'))
|
||||
await scaffold.ctx.workspaceRegistry.create(join(scaffold.workspaceCwd, 'folder'), 'Menu workspace')
|
||||
await writeFile(join(scaffold.workspaceCwd, 'first.txt'), 'FIRST\nSECOND\nTHIRD\n')
|
||||
await writeFile(join(scaffold.workspaceCwd, 'second.txt'), 'SECOND FILE\n')
|
||||
await writeFile(join(scaffold.workspaceCwd, 'original.gif'), GIF)
|
||||
await seedSession(scaffold, fixture('Menu foreground'), 'context-menu-first')
|
||||
await seedSession(scaffold, fixture('Menu background'), 'context-menu-other')
|
||||
browser = await chromium.launch()
|
||||
const context = await browser.newContext({ viewport: { width: 1680, height: 1000 }, locale: 'en-US', timezoneId: 'Asia/Shanghai' })
|
||||
await context.addInitScript((value) => { Object.defineProperty(navigator, 'platform', { value }) }, platform)
|
||||
page = await context.newPage()
|
||||
await page.setViewportSize({ width: 1291, height: 768 })
|
||||
tripwire = watchConsole(page)
|
||||
await page.route('https://images.example/original.gif', route => route.fulfill({ body: GIF, contentType: 'image/gif', headers: { 'access-control-allow-origin': '*' } }))
|
||||
await page.context().grantPermissions(['clipboard-read', 'clipboard-write'])
|
||||
await page.goto(scaffold.authenticatedUrl)
|
||||
await page.locator('[data-row-key^="workspace:"]').filter({ hasText: 'Ungrouped' }).click()
|
||||
await page.locator('[data-row-key="session:context-menu-other"]').click()
|
||||
await page.locator('[data-row-key="session:context-menu-other"]').getByText('Menu background', { exact: true }).waitFor()
|
||||
await page.locator('[data-row-key="session:context-menu-first"]').click()
|
||||
await page.getByText('CONTEXT_MENU_READY', { exact: true }).waitFor()
|
||||
})
|
||||
afterAll(async () => { await browser?.close(); await scaffold?.close() })
|
||||
|
||||
it('shares Session entries without selecting the background Session, and dismisses at viewport edges', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'context-menus-session'))
|
||||
const background = page.locator('[data-row-key="session:context-menu-other"]')
|
||||
await background.click({ button: 'right' })
|
||||
const menu = page.getByRole('menu')
|
||||
await menu.getByRole('menuitem', { name: /Copy.*[Ii][Dd]/ }).waitFor()
|
||||
const names = await menuLabels(menu)
|
||||
expect(names.slice(0, 5)).toEqual(['Pin session', 'Rename', 'Fork session', 'Copy Session ID', 'Show in folder'])
|
||||
expect(names.at(-1)).toBe('Archive session')
|
||||
expect(await menu.getByRole('menuitem').evaluateAll(rows => rows.every(row => row.querySelector('svg[data-icon]')))).toBe(true)
|
||||
expect(await menu.getByRole('separator').count()).toBe(2)
|
||||
expect(await menu.getByRole('menuitem', { name: 'Archive session', exact: true }).evaluate(row =>
|
||||
getComputedStyle(row.parentElement!.parentElement!).borderTopWidth)).toBe('0px')
|
||||
const alignedSeparators = async () => {
|
||||
const bounds = await menu.evaluate((node) => {
|
||||
const row = node.querySelector<HTMLElement>('[role="menuitem"]')!
|
||||
const rect = row.getBoundingClientRect()
|
||||
const style = getComputedStyle(row)
|
||||
return {
|
||||
left: rect.left + Number.parseFloat(style.paddingLeft),
|
||||
right: rect.right - Number.parseFloat(style.paddingRight),
|
||||
lines: [...node.querySelectorAll('[role="separator"]')].map((line) => {
|
||||
const rect = line.getBoundingClientRect()
|
||||
return { left: rect.left, right: rect.right }
|
||||
}),
|
||||
}
|
||||
})
|
||||
for (const line of bounds.lines) {
|
||||
expect(line.left).toBeCloseTo(bounds.left, 1)
|
||||
expect(line.right).toBeCloseTo(bounds.right, 1)
|
||||
}
|
||||
}
|
||||
await alignedSeparators()
|
||||
await expect(names.join('\n') + '\n').toMatchFileSnapshot(join(import.meta.dirname, 'expected/context-menus/session.txt'))
|
||||
expect(names.some(name => name.includes('Rename'))).toBe(true)
|
||||
expect(await background.getAttribute('aria-selected')).toBe('false')
|
||||
await page.keyboard.press('Escape')
|
||||
await background.getByRole('button', { name: /actions/i }).click()
|
||||
await menu.getByRole('menuitem', { name: /Copy.*[Ii][Dd]/ }).waitFor()
|
||||
expect(await menuLabels(menu)).toEqual(names)
|
||||
await alignedSeparators()
|
||||
await background.getByRole('button', { name: /actions/i }).click()
|
||||
expect(await menu.count()).toBe(0)
|
||||
expect(await background.getAttribute('aria-selected')).toBe('false')
|
||||
})
|
||||
|
||||
it('updates an open Session menu from another window’s shortcut preferences and still renames the captured row', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'context-menus-live-shortcuts'))
|
||||
const other = await page.context().newPage()
|
||||
const key = 'dsh.keybindings.v1'
|
||||
const original = await page.evaluate(key => localStorage.getItem(key), key)
|
||||
try {
|
||||
await other.goto(scaffold.authenticatedUrl)
|
||||
await other.getByRole('button', { name: 'Search sessions', exact: true }).waitFor()
|
||||
const background = page.locator('[data-row-key="session:context-menu-other"]')
|
||||
await background.click({ button: 'right' })
|
||||
const item = page.getByRole('menuitem', { name: 'Rename', exact: true })
|
||||
await item.waitFor()
|
||||
const popup = await page.getByRole('menu').elementHandle()
|
||||
const initial = await item.getAttribute('aria-keyshortcuts')
|
||||
await other.evaluate((key) => {
|
||||
localStorage.setItem(key, JSON.stringify({ schemaVersion: 2, profiles: {
|
||||
'web:macos': { 'session.rename': { code: 'Comma', modifiers: ['primary', 'shift'] } },
|
||||
'web:windows': { 'session.rename': { code: 'Comma', modifiers: ['primary', 'shift'] } },
|
||||
'web:linux': { 'session.rename': { code: 'Comma', modifiers: ['primary', 'shift'] } },
|
||||
} }))
|
||||
}, key)
|
||||
await expect.poll(() => item.getAttribute('aria-keyshortcuts')).toBe(platform === 'MacIntel' ? 'Shift+Meta+,' : 'Control+Shift+,')
|
||||
expect(await item.getAttribute('aria-keyshortcuts')).not.toBe(initial)
|
||||
expect(await popup!.evaluate(element => element.isConnected)).toBe(true)
|
||||
expect(await background.getAttribute('aria-selected')).toBe('false')
|
||||
await item.click()
|
||||
const rename = page.getByRole('dialog', { name: 'Rename session', exact: true })
|
||||
expect(await rename.getByLabel('Session name').inputValue()).toBe('Menu background')
|
||||
await rename.getByRole('button', { name: 'Cancel', exact: true }).click()
|
||||
expect(await background.getAttribute('aria-selected')).toBe('false')
|
||||
await background.click({ button: 'right' })
|
||||
await item.waitFor()
|
||||
await other.evaluate((key) => {
|
||||
localStorage.setItem(key, JSON.stringify({ schemaVersion: 2, profiles: {
|
||||
'web:macos': { 'session.rename': null }, 'web:windows': { 'session.rename': null }, 'web:linux': { 'session.rename': null },
|
||||
} }))
|
||||
}, key)
|
||||
await expect.poll(() => item.getAttribute('aria-keyshortcuts')).toBeNull()
|
||||
await other.evaluate(({ key, original }) => {
|
||||
if (original === null) localStorage.removeItem(key)
|
||||
else localStorage.setItem(key, original)
|
||||
}, { key, original })
|
||||
await expect.poll(() => item.getAttribute('aria-keyshortcuts')).toBe(initial)
|
||||
await page.keyboard.press('Escape')
|
||||
} finally {
|
||||
const cancel = page.getByRole('dialog', { name: 'Rename session', exact: true }).getByRole('button', { name: 'Cancel', exact: true })
|
||||
if (await cancel.isVisible()) await cancel.click()
|
||||
await page.keyboard.press('Escape')
|
||||
await other.evaluate(({ key, original }) => {
|
||||
if (original === null) localStorage.removeItem(key)
|
||||
else localStorage.setItem(key, original)
|
||||
}, { key, original })
|
||||
await other.close()
|
||||
}
|
||||
})
|
||||
|
||||
it('shares Workspace menus and keeps folder gestures independent from expansion', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'context-menus-workspace'))
|
||||
const workspace = page.locator('[data-row-key^="workspace:"]').filter({ hasText: 'Menu workspace' })
|
||||
const expanded = await workspace.getAttribute('aria-expanded')
|
||||
await workspace.click({ button: 'right' })
|
||||
const menu = page.getByRole('menu')
|
||||
await menu.getByRole('menuitem', { name: 'Rename', exact: true }).waitFor()
|
||||
const names = await menuLabels(menu)
|
||||
expect(names).toEqual(['Rename', 'Show in folder', 'Delete workspace'])
|
||||
expect(await menu.locator('svg[data-icon]').count()).toBe(3)
|
||||
expect(await workspace.getAttribute('aria-expanded')).toBe(expanded)
|
||||
await page.keyboard.press('Escape')
|
||||
await workspace.getByRole('button', { name: /actions/i }).click()
|
||||
await menu.getByRole('menuitem', { name: 'Rename', exact: true }).waitFor()
|
||||
expect(await menuLabels(menu)).toEqual(names)
|
||||
await menu.getByRole('menuitem', { name: 'Rename', exact: true }).click()
|
||||
await page.getByRole('dialog').waitFor()
|
||||
await page.getByRole('button', { name: 'Cancel', exact: true }).click()
|
||||
await workspace.click({ button: 'right' })
|
||||
await menu.getByRole('menuitem', { name: 'Delete workspace', exact: true }).click()
|
||||
await page.getByRole('dialog', { name: 'Delete workspace', exact: true }).waitFor()
|
||||
await page.getByRole('button', { name: 'Cancel', exact: true }).click()
|
||||
await page.locator('[data-sidebar-right-expand]').click()
|
||||
await page.locator('[data-sidebar-right-guide-entry="files"]').click()
|
||||
await page.locator('[data-files-state="tree"]').waitFor()
|
||||
const folder = page.locator('[data-files-entry="directory"]').filter({ hasText: 'folder' }).getByRole('button').first()
|
||||
await folder.click({ button: 'right' })
|
||||
await menu.getByRole('menuitem', { name: 'Copy folder path', exact: true }).waitFor()
|
||||
expect(await menuLabels(menu)).toEqual(['Show in folder', 'Copy folder path'])
|
||||
expect(await folder.getAttribute('aria-expanded')).toBe('false')
|
||||
await menu.getByRole('menuitem', { name: 'Copy folder path', exact: true }).click()
|
||||
expect(await page.evaluate(() => navigator.clipboard.readText())).toBe(join(scaffold.workspaceCwd, 'folder'))
|
||||
await page.getByText('Copied', { exact: true }).waitFor()
|
||||
await expect(names.join('\n') + '\n').toMatchFileSnapshot(join(import.meta.dirname, 'expected/context-menus/workspace.txt'))
|
||||
})
|
||||
|
||||
it('prepares complete menus, anchors above the frame inset, and treats repeated gestures as separate occurrences', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'context-menus-gestures'))
|
||||
const file = page.getByRole('button', { name: 'First file', exact: true })
|
||||
await file.focus()
|
||||
await page.keyboard.press('Shift+F10')
|
||||
await page.getByRole('menuitem', { name: 'Copy file path', exact: true }).waitFor()
|
||||
await page.keyboard.press('End')
|
||||
expect(await page.getByRole('menuitem', { name: 'Save as…', exact: true }).count()).toBe(0)
|
||||
expect(await page.getByRole('menuitem', { name: 'Download', exact: true }).evaluate(element => element === document.activeElement)).toBe(true)
|
||||
await page.keyboard.press('ArrowUp')
|
||||
expect(await page.getByRole('menuitem', { name: 'Copy file path', exact: true }).evaluate(element => element === document.activeElement)).toBe(true)
|
||||
await page.keyboard.press('Enter')
|
||||
await expect.poll(() => page.evaluate(() => navigator.clipboard.readText())).toBe(join(scaffold.workspaceCwd, 'first.txt'))
|
||||
expect(await file.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
await page.evaluate(() => {
|
||||
document.documentElement.style.setProperty('--dsh-frame-overlay-top', '100px')
|
||||
const frames: number[] = []
|
||||
const observer = new MutationObserver(() => {
|
||||
for (const menu of document.querySelectorAll('[role="menu"]')) frames.push(menu.querySelectorAll('[role="menuitem"]').length)
|
||||
})
|
||||
observer.observe(document.body, { subtree: true, childList: true })
|
||||
Object.assign(window, { menuObservation: { frames, observer } })
|
||||
})
|
||||
const header = page.locator('[data-session-title]').first()
|
||||
const target = await header.count() > 0 ? header : page.getByText('Menu foreground', { exact: true }).last()
|
||||
const box = (await target.boundingBox())!
|
||||
const point = { x: box.x + box.width / 2, y: box.y + box.height / 2 }
|
||||
await page.mouse.click(point.x, point.y, { button: 'right' })
|
||||
await page.getByRole('menuitem', { name: /Copy.*[Ii][Dd]/ }).waitFor()
|
||||
expect((await page.getByRole('menu').boundingBox())!.y).toBeLessThan(100)
|
||||
await page.mouse.click(point.x + 1, point.y, { button: 'right' })
|
||||
expect(await page.getByRole('menu').count()).toBe(0)
|
||||
await file.click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Copy file path', exact: true }).waitFor()
|
||||
const previous = await page.getByRole('menu').elementHandle()
|
||||
await page.getByRole('link', { name: 'Website', exact: true }).click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Copy link address', exact: true }).waitFor()
|
||||
expect(await previous!.evaluate(element => element.isConnected)).toBe(false)
|
||||
await page.keyboard.press('Escape')
|
||||
const counts = await page.evaluate(() => {
|
||||
const observed = (window as Window & { menuObservation?: { frames: number[]; observer: MutationObserver } }).menuObservation
|
||||
if (observed === undefined) throw new Error('Menu observer not installed')
|
||||
observed.observer.disconnect()
|
||||
document.documentElement.style.removeProperty('--dsh-frame-overlay-top')
|
||||
return observed.frames
|
||||
})
|
||||
expect(counts.length).toBeGreaterThan(0)
|
||||
expect(counts.every(count => count > 0)).toBe(true)
|
||||
})
|
||||
|
||||
it('preserves file line navigation, URL text, image format, and existing tab close actions', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'context-menus-content'))
|
||||
const file = page.getByRole('button', { name: 'First file', exact: true })
|
||||
await file.click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Download', exact: true }).waitFor()
|
||||
expect(await page.getByRole('menuitem', { name: 'Save as…', exact: true }).count()).toBe(0)
|
||||
const fileDownloadPromise = page.waitForEvent('download')
|
||||
await page.getByRole('menuitem', { name: 'Download', exact: true }).click()
|
||||
const fileDownload = await fileDownloadPromise
|
||||
expect(fileDownload.suggestedFilename()).toBe('first.txt')
|
||||
expect(await readFile(await fileDownload.path(), 'utf8')).toBe('FIRST\nSECOND\nTHIRD\n')
|
||||
const started = page.getByRole('alert').filter({ hasText: 'Download started' })
|
||||
await started.waitFor()
|
||||
expect(await started.getByRole('button', { name: /Show in/ }).count()).toBe(0)
|
||||
await file.click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Open in sidebar', exact: true }).click()
|
||||
await page.locator('[data-document-preview]').getByText('SECOND', { exact: true }).waitFor()
|
||||
await page.getByRole('link', { name: 'Website', exact: true }).click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Copy link address', exact: true }).click()
|
||||
expect(await page.evaluate(() => navigator.clipboard.readText())).toBe('https://example.com/path?q=1#fragment')
|
||||
await page.getByRole('img', { name: 'Original', exact: true }).click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Download', exact: true }).waitFor()
|
||||
await expect((await menuLabels(page.getByRole('menu'))).join('\n') + '\n')
|
||||
.toMatchFileSnapshot(join(import.meta.dirname, 'expected/context-menus/image.txt'))
|
||||
expect(await page.getByRole('menuitem', { name: 'Show in folder', exact: true }).count()).toBe(1)
|
||||
const downloadPromise = page.waitForEvent('download')
|
||||
await page.getByRole('menuitem', { name: 'Download', exact: true }).click()
|
||||
const download = await downloadPromise
|
||||
expect(download.suggestedFilename().endsWith('.gif')).toBe(true)
|
||||
await page.getByRole('alert').filter({ hasText: 'Download started' }).waitFor()
|
||||
const path = await download.path()
|
||||
expect(path).not.toBeNull()
|
||||
if (path === null) throw new Error('Browser download unavailable')
|
||||
expect(await readFile(path)).toEqual(GIF)
|
||||
await page.getByRole('img', { name: 'Original', exact: true }).click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Copy image', exact: true }).click()
|
||||
await page.getByText('Copied', { exact: true }).waitFor()
|
||||
expect(await page.evaluate(async () => (await navigator.clipboard.read()).some(item => item.types.includes('image/png')))).toBe(true)
|
||||
await page.getByRole('img', { name: 'Remote', exact: true }).click({ button: 'right' })
|
||||
expect(await page.getByRole('menuitem', { name: 'Show in folder', exact: true }).isDisabled()).toBe(true)
|
||||
const remoteDownloadPromise = page.waitForEvent('download')
|
||||
await page.getByRole('menuitem', { name: 'Download', exact: true }).click()
|
||||
const remoteDownload = await remoteDownloadPromise
|
||||
expect(await readFile((await remoteDownload.path()))).toEqual(GIF)
|
||||
await page.getByRole('img', { name: 'Remote', exact: true }).click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Copy image', exact: true }).click()
|
||||
await page.getByText('Copied', { exact: true }).waitFor()
|
||||
expect(await page.evaluate(async () => (await navigator.clipboard.read()).some(item => item.types.includes('image/png')))).toBe(true)
|
||||
await page.getByRole('button', { name: 'Second file', exact: true }).click()
|
||||
await page.locator('[data-document-preview]').getByText('SECOND FILE', { exact: true }).waitFor()
|
||||
const firstTab = page.locator('[role="tab"]').filter({ hasText: 'first.txt' }).first()
|
||||
await firstTab.click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Close', exact: true }).waitFor()
|
||||
expect(await page.getByRole('menuitem', { name: 'Close', exact: true }).locator('svg[data-icon]').count()).toBe(1)
|
||||
await page.getByRole('menuitem', { name: 'Close', exact: true }).click()
|
||||
expect(await firstTab.count()).toBe(0)
|
||||
expect(await page.locator('[data-document-preview]').getByText('SECOND FILE', { exact: true }).count()).toBe(1)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
})
|
||||
it('keeps original preview open when dismissing its menu and fits both themes at the viewport edge', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'context-menus-preview'))
|
||||
await page.getByRole('button', { name: 'View full image: Original', exact: true }).click()
|
||||
const preview = page.getByRole('dialog')
|
||||
await preview.waitFor()
|
||||
for (const colorScheme of ['light', 'dark'] as const) {
|
||||
await page.emulateMedia({ colorScheme })
|
||||
await preview.getByRole('img').evaluate(element => element.dispatchEvent(new MouseEvent('contextmenu', { clientX: 1270, clientY: 735, bubbles: true })))
|
||||
const menu = page.getByRole('menu')
|
||||
await menu.getByRole('menuitem', { name: 'Copy image', exact: true }).waitFor()
|
||||
expect(await menu.getByRole('menuitem').evaluateAll(rows => rows.every(row => row.querySelector('svg[data-icon]')))).toBe(true)
|
||||
const box = await menu.boundingBox()
|
||||
expect(box).not.toBeNull()
|
||||
expect(box!.x).toBeGreaterThan(1000)
|
||||
expect(box!.y).toBeGreaterThan(500)
|
||||
expect(box!.x + box!.width).toBeLessThanOrEqual(1291)
|
||||
expect(box!.y + box!.height).toBeLessThanOrEqual(768)
|
||||
await saveFailureShot(page, `context-menus-${colorScheme}`)
|
||||
await page.keyboard.press('Escape')
|
||||
expect(await menu.count()).toBe(0)
|
||||
expect(await preview.count()).toBe(1)
|
||||
}
|
||||
await page.keyboard.press('Escape')
|
||||
expect(await preview.count()).toBe(0)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
})
|
||||
|
||||
it('offers completed Desktop destinations as toast text actions without enabling remote-image menu reveal', async () => {
|
||||
const native = await browser.newPage({ viewport: { width: 1291, height: 768 }, locale: 'en-US' })
|
||||
const opened = vi.spyOn(scaffold.ctx.sessionController, 'openWorkspacePath').mockResolvedValue({ opened: true })
|
||||
try {
|
||||
const destinations = { download: join(scaffold.workspaceCwd, 'downloaded.gif'), saveAs: join(scaffold.workspaceCwd, 'saved.txt') }
|
||||
await native.addInitScript(({ platform, destinations }) => {
|
||||
Object.defineProperty(navigator, 'platform', { value: platform })
|
||||
Object.defineProperty(globalThis, 'dshDesktop', { value: { protocolVersion: 1, fileActions: {
|
||||
save: async ({ mode }: { mode: 'download' | 'saveAs' }) => ({ status: 'saved', path: destinations[mode] }),
|
||||
} } })
|
||||
}, { platform, destinations })
|
||||
await native.route('https://images.example/original.gif', route => route.fulfill({ body: GIF, contentType: 'image/gif' }))
|
||||
await native.goto(scaffold.authenticatedUrl)
|
||||
await native.evaluate((platform) => {
|
||||
document.documentElement.dataset.platform = platform === 'MacIntel' ? 'darwin' : platform === 'Win32' ? 'win32' : 'linux'
|
||||
}, platform)
|
||||
const group = native.locator('[data-row-key^="workspace:"]').filter({ hasText: 'Ungrouped' })
|
||||
if (await group.getAttribute('aria-expanded') !== 'true') await group.click()
|
||||
await native.locator('[data-row-key="session:context-menu-first"]').click()
|
||||
await native.getByText('CONTEXT_MENU_READY', { exact: true }).waitFor()
|
||||
for (const [mode, label, text, theme] of [
|
||||
['download', 'Download', 'Download complete', 'light'],
|
||||
['saveAs', 'Save as…', 'Saved', 'dark'],
|
||||
] as const) {
|
||||
await native.emulateMedia({ colorScheme: theme })
|
||||
const trigger = mode === 'download'
|
||||
? native.getByRole('img', { name: 'Remote', exact: true })
|
||||
: native.getByRole('button', { name: 'First file', exact: true })
|
||||
await trigger.click({ button: 'right' })
|
||||
await native.getByRole('menuitem', { name: label, exact: true }).click()
|
||||
const notice = native.getByRole('alert').filter({ hasText: text })
|
||||
const action = notice.getByRole('button', { name: platform === 'MacIntel' ? 'Show in Finder' : 'Show in folder', exact: true })
|
||||
await action.click()
|
||||
await notice.waitFor({ state: 'hidden' })
|
||||
await expect.poll(() => opened.mock.calls.at(-1)?.[0]).toEqual({ path: destinations[mode], action: 'reveal' })
|
||||
}
|
||||
expect(opened).toHaveBeenCalledTimes(2)
|
||||
await native.getByRole('img', { name: 'Remote', exact: true }).click({ button: 'right' })
|
||||
const reveal = native.getByRole('menuitem', { name: 'Show in folder', exact: true })
|
||||
await reveal.waitFor()
|
||||
expect(await reveal.isDisabled()).toBe(true)
|
||||
} finally {
|
||||
await native.close()
|
||||
opened.mockRestore()
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -563,7 +563,7 @@ describe('web e2e: the composer model switch is the default for later sessions',
|
||||
for (const palette of headingPalettes) {
|
||||
expect(palette.headingFills, `${palette.platform}, dark=${String(palette.dark)}`)
|
||||
.toEqual(['rgba(0, 0, 0, 0)'])
|
||||
expect(palette.menuFill).toBe(palette.dark ? 'rgba(67, 69, 74, 0.45)' : 'rgba(248, 249, 250, 0.58)')
|
||||
expect(palette.menuFill).toBe(palette.dark ? 'rgba(48, 49, 54, 0.64)' : 'rgba(252, 253, 254, 0.7)')
|
||||
expect(palette.searchBorder).toBe('rgba(0, 0, 0, 0)')
|
||||
expect(palette.positions).toEqual(['sticky'])
|
||||
expect(palette.headingRadii).toEqual([palette.platform === 'darwin' ? '0px' : palette.optionRadius])
|
||||
|
||||
@@ -714,7 +714,7 @@ else process.exit(1);
|
||||
const initialFilesClose = await filesTab.locator('[data-dockkit-tab-close]').count()
|
||||
expect(initialFilesClose).toBe(1)
|
||||
await filesTab.click({ button: 'right' })
|
||||
expect(await page.locator('[data-dockkit-tab-menu]:visible').count()).toBe(1)
|
||||
await page.locator('[data-context-menu][role="menu"]').waitFor()
|
||||
await page.keyboard.press('Escape')
|
||||
await addTab.waitFor({ state: 'visible' })
|
||||
const initialAdd = await addTab.count()
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
- menuitem "Pin session"
|
||||
- menuitem "Rename"
|
||||
- menuitem "Fork session"
|
||||
- menuitem "Archive session"
|
||||
- separator
|
||||
- menuitem "Copy Session ID"
|
||||
- separator
|
||||
- menuitem "Export session"
|
||||
- menuitem "Copy session ID"
|
||||
- separator
|
||||
- menuitem "Archive session"
|
||||
@@ -86,7 +86,7 @@
|
||||
"Fixture badge",
|
||||
"Fixture section"
|
||||
],
|
||||
"time": true,
|
||||
"time": false,
|
||||
"pinned": false,
|
||||
"actions": true
|
||||
},
|
||||
@@ -96,7 +96,7 @@
|
||||
"Fixture badge",
|
||||
"Fixture section"
|
||||
],
|
||||
"time": true,
|
||||
"time": false,
|
||||
"pinned": false,
|
||||
"actions": true
|
||||
},
|
||||
@@ -106,7 +106,7 @@
|
||||
"Fixture badge",
|
||||
"Fixture section"
|
||||
],
|
||||
"time": true,
|
||||
"time": false,
|
||||
"pinned": false,
|
||||
"actions": true
|
||||
},
|
||||
@@ -116,8 +116,8 @@
|
||||
"Fixture badge",
|
||||
"Fixture section"
|
||||
],
|
||||
"time": true,
|
||||
"pinned": true,
|
||||
"time": false,
|
||||
"pinned": false,
|
||||
"actions": true
|
||||
},
|
||||
{
|
||||
@@ -136,7 +136,7 @@
|
||||
"Fixture badge",
|
||||
"Fixture section"
|
||||
],
|
||||
"time": true,
|
||||
"time": false,
|
||||
"pinned": false,
|
||||
"actions": true
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Copy image
|
||||
Download
|
||||
Show in folder
|
||||
@@ -0,0 +1,6 @@
|
||||
Pin session
|
||||
Rename
|
||||
Fork session
|
||||
Copy Session ID
|
||||
Show in folder
|
||||
Archive session
|
||||
@@ -0,0 +1,3 @@
|
||||
Rename
|
||||
Show in folder
|
||||
Delete workspace
|
||||
@@ -8,7 +8,7 @@
|
||||
- button "全部折叠"
|
||||
- button "左右对比" [pressed]
|
||||
- button "自动换行" [pressed]
|
||||
- button "文件树" [expanded] [pressed]
|
||||
- button "将文件树移到右侧" [expanded]
|
||||
- region "全部 2 个文件":
|
||||
- button "收起 panel.ts" [expanded]
|
||||
- text: src/panel.ts +2 −2
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
- text: 与 origin/main 比较,包含未提交的修改
|
||||
- button "创建变更请求"
|
||||
- button "分支"
|
||||
- button "全部 0 个文件" [disabled]
|
||||
- button "刷新变更"
|
||||
- button "全部展开" [disabled]
|
||||
- button "左右对比" [pressed]
|
||||
- button "自动换行" [pressed]
|
||||
- status:
|
||||
- text: 无法完整读取 Git 过滤器配置,尚未执行比较。请检查 Git 配置和读取上限后重试
|
||||
- button "重试"
|
||||
@@ -0,0 +1,4 @@
|
||||
- button "本地变更"
|
||||
- text: HEAD → origin/main
|
||||
- button "查看本会话的变更:1 个文件,新增 1 行,删除 0 行": +1 −0 1 个文件
|
||||
- button "创建变更请求"
|
||||
@@ -12,6 +12,6 @@
|
||||
- button "复制变更请求链接"
|
||||
- 'button "从本会话移除 #7"'
|
||||
- 'button "收起 #7" [expanded]'
|
||||
- button "检查 1 项失败 · 1 项通过"
|
||||
- button "检查 已加载 1 项检查,仍有更多"
|
||||
- text: 评审 等待评审 · 1 条未解决讨论 合并 无冲突
|
||||
- 'button "查看 #7 的变更:新增 128 行,删除 14 行"': 变更 +128 −14
|
||||
@@ -7,6 +7,6 @@
|
||||
- button "复制变更请求链接"
|
||||
- 'button "从本会话移除 #7"'
|
||||
- 'button "收起 #7" [expanded]'
|
||||
- button "检查 1 项失败 · 1 项通过"
|
||||
- button "检查 已加载 1 项检查,仍有更多"
|
||||
- text: 评审 等待评审 · 1 条未解决讨论 合并 无冲突
|
||||
- 'button "查看 #7 的变更:新增 128 行,删除 14 行"': 变更 +128 −14
|
||||
@@ -0,0 +1 @@
|
||||
- button "代码审查和变更 查看代码变更与本会话的变更请求"
|
||||
@@ -0,0 +1,14 @@
|
||||
- dialog "提交评审":
|
||||
- heading "提交评审" [level=2]
|
||||
- button "关闭"
|
||||
- text: 待提交评论(1)
|
||||
- textbox "评审总结…"
|
||||
- status: 请求更改时,请填写评审总结
|
||||
- radio "评论"
|
||||
- text: 评论
|
||||
- radio "批准"
|
||||
- text: 批准
|
||||
- radio "请求更改" [checked]
|
||||
- text: 请求更改
|
||||
- button "取消"
|
||||
- button "提交评审" [disabled]
|
||||
@@ -3,6 +3,7 @@
|
||||
- button "关闭"
|
||||
- text: 待提交评论(1)
|
||||
- textbox "评审总结…": 需要补充边界检查
|
||||
- status: 请求更改时,请填写评审总结
|
||||
- radio "评论"
|
||||
- text: 评论
|
||||
- radio "批准"
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
- paragraph:
|
||||
- button "Relative colon:24–30"
|
||||
- text: ·
|
||||
- button "Absolute colon:30"
|
||||
- text: ·
|
||||
- button "Fragment:12"
|
||||
- text: ·
|
||||
- button "Column:24:5"
|
||||
- text: ·
|
||||
- button "Zero line"
|
||||
- text: ·
|
||||
- button "Reversed range"
|
||||
- text: ·
|
||||
- link "Bare URL":
|
||||
- /url: index.ts:24
|
||||
- text: · Blocked script ·
|
||||
- link "Development server":
|
||||
- /url: localhost:3000
|
||||
- text: ·
|
||||
- link "Mail":
|
||||
- /url: mailto:10086
|
||||
@@ -1,24 +1,24 @@
|
||||
{
|
||||
"web-light": {
|
||||
"fill": "rgba(248, 249, 250, 0.58)",
|
||||
"fill": "rgba(252, 253, 254, 0.7)",
|
||||
"blur": "blur(40px) saturate(1.5)",
|
||||
"radius": "16px",
|
||||
"shadow": "rgba(0, 0, 0, 0.04) 0px 0px 0px 0.5px, rgba(0, 0, 0, 0.04) 0px 3px 8px 0px, rgba(0, 0, 0, 0.05) 0px 0px 20px 0px"
|
||||
},
|
||||
"web-dark": {
|
||||
"fill": "rgba(67, 69, 74, 0.45)",
|
||||
"fill": "rgba(48, 49, 54, 0.64)",
|
||||
"blur": "blur(40px) saturate(1.5)",
|
||||
"radius": "16px",
|
||||
"shadow": "rgba(255, 255, 255, 0.16) 0px 0px 0px 0.5px, rgba(0, 0, 0, 0.04) 0px 3px 8px 0px, rgba(0, 0, 0, 0.05) 0px 0px 20px 0px"
|
||||
},
|
||||
"darwin-light": {
|
||||
"fill": "rgba(248, 249, 250, 0.58)",
|
||||
"fill": "rgba(252, 253, 254, 0.7)",
|
||||
"blur": "blur(40px) saturate(1.5)",
|
||||
"radius": "16px",
|
||||
"shadow": "rgba(0, 0, 0, 0.04) 0px 0px 0px 0.5px, rgba(0, 0, 0, 0.04) 0px 3px 8px 0px, rgba(0, 0, 0, 0.05) 0px 0px 20px 0px"
|
||||
},
|
||||
"darwin-dark": {
|
||||
"fill": "rgba(67, 69, 74, 0.45)",
|
||||
"fill": "rgba(48, 49, 54, 0.64)",
|
||||
"blur": "blur(40px) saturate(1.5)",
|
||||
"radius": "16px",
|
||||
"shadow": "rgba(255, 255, 255, 0.16) 0px 0px 0px 0.5px, rgba(0, 0, 0, 0.04) 0px 3px 8px 0px, rgba(0, 0, 0, 0.05) 0px 0px 20px 0px"
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
- menuitem "Pin session"
|
||||
- menuitem "Rename"
|
||||
- menuitem "Fork session"
|
||||
- menuitem "Archive session"
|
||||
- separator
|
||||
- menuitem "Copy Session ID"
|
||||
- separator
|
||||
- menuitem "Archive session"
|
||||
@@ -15,4 +15,5 @@
|
||||
- text: 已完成 $ pnpm add mirrored-package
|
||||
- button "复制"
|
||||
- text: Installed from the registry pnpm names
|
||||
- paragraph: 完整日志:{{cwd}}/.dsh-home/profiles/scaffold/.plugin-manager/logs/operation-{{suffix}}/pnpm.log
|
||||
- button "立即启用"
|
||||
@@ -0,0 +1,14 @@
|
||||
- dialog "插件安装失败":
|
||||
- button "返回编辑": 编辑
|
||||
- button "关闭"
|
||||
- alert: 插件安装失败
|
||||
- paragraph: 安装命令失败,原因见安装详情
|
||||
- paragraph: silent-package
|
||||
- paragraph: 版本 1.0.0
|
||||
- button "收起安装详情" [expanded]
|
||||
- button "重试"
|
||||
- paragraph: 安装位置:{{cwd}}/.dsh-home/profiles/scaffold
|
||||
- text: 失败 $ pnpm add silent-package 退出码 1
|
||||
- button "复制"
|
||||
- text: "Command failed with exit code 1: {{node}} add silent-package"
|
||||
- paragraph: 完整日志:{{cwd}}/.dsh-home/profiles/scaffold/.plugin-manager/logs/operation-{{suffix}}/pnpm.log
|
||||
@@ -7,4 +7,4 @@
|
||||
- Tabs / 600px: resting title 28, actions 97, tabs 96; pinned actions 17, tabs 16, bar 66; stable range, reversible coordinates, same controls.
|
||||
- Tabs / 470px: resting title 28, actions 97, tabs 96; pinned actions 17, tabs 16, bar 66; stable range, reversible coordinates, same controls.
|
||||
- Tabs / 390px: resting title 28, actions 97, tabs 96; pinned actions 17, tabs 16, bar 66; stable range, reversible coordinates, same controls.
|
||||
- Tabs / 334px: resting title 28, actions 146, tabs 96; pinned actions 66, tabs 16, bar 114; stable range, reversible coordinates, same controls.
|
||||
- Tabs / 320px: resting title 28, actions 146, tabs 96; pinned actions 66, tabs 16, bar 114; stable range, reversible coordinates, same controls.
|
||||
@@ -1,2 +1,3 @@
|
||||
- menu:
|
||||
- menuitem "Close"
|
||||
- menuitem "Close Other Tabs" [disabled]
|
||||
@@ -2,5 +2,8 @@
|
||||
- menuitem "Pin session"
|
||||
- menuitem "Rename"
|
||||
- menuitem "Fork session"
|
||||
- menuitem "Archive session"
|
||||
- separator
|
||||
- menuitem "Copy Session ID"
|
||||
- menuitem "Show in Finder"
|
||||
- separator
|
||||
- menuitem "Archive session"
|
||||
@@ -16,7 +16,9 @@ folded landscape: 951px frame splits at 475.5px without a resize handle; unfoldi
|
||||
fold transitions: sidebar controls follow the divider in both directions; reduced motion changes width without animation
|
||||
drawer mask: opacity transitions from 0 to 1 on open and 1 to 0 on close
|
||||
reduced motion: drawer and mask settle without transitions
|
||||
touch selected Session: More remains visible; archive and pin stay in its menu; pin marker retained
|
||||
Web header: only the sidebar opener remains, with 48px leading clearance
|
||||
below 768px: plugin and automation pages use 20px insets; Web view tabs align at 20px, while Desktop and wider Web tabs retain 28px
|
||||
touch selected Session: More remains visible; update time is hidden; pinned rows offer Unpin before More with Workspace action spacing
|
||||
touch Workspace: actions appear only while expanded, including after folding the focused row
|
||||
fine pointer: folded Workspace actions remain available on hover
|
||||
fine pointer: selected Session actions stay hidden until hover, including at 390px
|
||||
@@ -0,0 +1,10 @@
|
||||
{"version":3,"isSeeded":false,"createdAt":0,"cwd":"{{cwd}}","delegationDepth":0,"type":"session","id":"{{session:1}}"}
|
||||
{"type":"turn/start","data":{"turn":1}}
|
||||
{"type":"step/start","data":{"turn":1,"step":1}}
|
||||
{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"},"id":"{{message:1}}"}},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Link src/example.txt using relative :24-30, absolute :30, and relative #L12 destinations, plus line/column and invalid locations, localhost:3000, index.ts:24, mailto:10086, and a blocked script link."}],"source":{"kind":"user","rpcId":"{{rpc:1}}"},"role":"user","id":"{{message:2}}"},"surfaceOp":"append"}
|
||||
{"type":"session/title","data":{"title":"Colon file references","messageSeqs":[3],"source":{"kind":"fallback"}}}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"deepseek-v4-flash"},"tools":"{{tools}}","messagePrefix":["{{messagePrefix}}"]},"reason":"initial"}}
|
||||
{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"text","text":"[Relative colon:24–30](src/example.txt:24-30) · [Absolute colon:30]({{cwd}}/src/example.txt:30) · [Fragment:12](src/example.txt#L12) · [Column:24:5](src/example.txt:24:5) · [Zero line](src/example.txt:0) · [Reversed range](src/example.txt:30-24) · [Bare URL](index.ts:24) · [Blocked script](javascript:alert) · [Development server](localhost:3000) · [Mail](mailto:10086)"}],"source":{"provider":"deepseek-official","model":"deepseek-v4-flash","kind":"model"},"id":"{{message:3}}"},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["[Relative colon:24–30](src/example.txt:24-30) · [Absolute colon:30]({{cwd}}/src/example.txt:30) · [Fragment:12](src/example.txt#L12) · [Column:24:5](src/example.txt:24:5) · [Zero line](src/example.txt:0) · [Reversed range](src/example.txt:30-24) · [Bare URL](index.ts:24) · [Blocked script](javascript:alert) · [Development server](localhost:3000) · [Mail](mailto:10086)"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"[Relative colon:24–30](src/example.txt:24-30) · [Absolute colon:30]({{cwd}}/src/example.txt:30) · [Fragment:12](src/example.txt#L12) · [Column:24:5](src/example.txt:24:5) · [Zero line](src/example.txt:0) · [Reversed range](src/example.txt:30-24) · [Bare URL](index.ts:24) · [Blocked script](javascript:alert) · [Development server](localhost:3000) · [Mail](mailto:10086)"}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}
|
||||
{"type":"step/end","data":{"turn":1,"step":1}}
|
||||
{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}}
|
||||
@@ -101,8 +101,7 @@ window.__ModuleLoader__.load({
|
||||
}
|
||||
})
|
||||
ctx.slots.inject('sidebar.workspaces.session.menu.item', function* () {
|
||||
// The shipped rows end at Session ID (450); these follow as one group,
|
||||
// opened by the export row's hairline.
|
||||
// Legacy rows form their own ordered group before the built-in Archive action.
|
||||
yield registerSessionAction('fixture.export-session', 500, 'exportSession', true)
|
||||
yield registerSessionAction('fixture.copy-session-id', 600, 'copySessionId', false)
|
||||
})
|
||||
|
||||
@@ -113,10 +113,10 @@ if (args[0] === 'auth' && args[1] === 'status') {
|
||||
}
|
||||
if (args[0] === 'api' && args[1] === 'graphql') {
|
||||
const query = args.find(arg => arg.startsWith('query=')).slice('query='.length)
|
||||
const check = (name, conclusion, completedAt) => ({
|
||||
__typename: 'CheckRun', name, status: 'COMPLETED', conclusion,
|
||||
const check = (name, conclusion, completedAt, databaseId = 101) => ({
|
||||
__typename: 'CheckRun', id: 'check-' + databaseId, name, status: 'COMPLETED', conclusion, databaseId,
|
||||
detailsUrl: 'https://github.com/octo/demo/actions/runs/1', startedAt: '2026-10-09T00:00:00Z', completedAt,
|
||||
checkSuite: { workflowRun: { workflow: { name: 'CI' } } },
|
||||
checkSuite: { app: { id: 'github-actions' }, workflowRun: { event: 'pull_request', workflow: { id: 'ci', name: 'CI' } } },
|
||||
})
|
||||
const pulls = {
|
||||
7: {
|
||||
@@ -124,9 +124,9 @@ if (args[0] === 'api' && args[1] === 'graphql') {
|
||||
updatedAt: '2026-10-09T00:00:00Z', closedAt: null, author: { login: 'octo' }, headRefName: 'feat', headRefOid: 'a'.repeat(40),
|
||||
baseRefName: 'main', additions: 128, deletions: 14, mergeable: 'MERGEABLE', mergeStateStatus: 'BLOCKED', reviewDecision: 'REVIEW_REQUIRED',
|
||||
reviewThreads: { nodes: [{ isResolved: false }] },
|
||||
commits: { nodes: [{ commit: { statusCheckRollup: { state: 'FAILURE', contexts: {
|
||||
pageInfo: { hasNextPage: false },
|
||||
nodes: [check('lint', 'SUCCESS', '2026-10-09T00:00:42Z'), check('test', 'FAILURE', '2026-10-09T00:02:07Z')],
|
||||
commits: { nodes: [{ commit: { statusCheckRollup: { id: 'rollup-7', state: 'FAILURE', contexts: {
|
||||
pageInfo: { hasNextPage: true, endCursor: 'checks-100' },
|
||||
nodes: Array.from({ length: 100 }, (_, i) => check('lint', 'FAILURE', '2026-10-08T00:00:42Z', i + 1)),
|
||||
} } } }] },
|
||||
},
|
||||
9: {
|
||||
@@ -134,11 +134,18 @@ if (args[0] === 'api' && args[1] === 'graphql') {
|
||||
isDraft: !state.ready, updatedAt: '2026-10-09T00:00:00Z', closedAt: state.mergedAt, author: { login: 'octo' },
|
||||
headRefName: 'feat/merge', headRefOid: state.head ?? 'b'.repeat(40), baseRefName: 'main', additions: 30, deletions: 2, mergeable: 'MERGEABLE',
|
||||
mergeStateStatus: state.ready ? 'CLEAN' : 'BLOCKED', reviewDecision: 'APPROVED', reviewThreads: { nodes: [] },
|
||||
commits: { nodes: [{ commit: { statusCheckRollup: { state: 'SUCCESS', contexts: {
|
||||
pageInfo: { hasNextPage: false }, nodes: [check('lint', 'SUCCESS', '2026-10-09T00:00:42Z')],
|
||||
commits: { nodes: [{ commit: { statusCheckRollup: { id: 'rollup-9', state: 'SUCCESS', contexts: {
|
||||
pageInfo: { hasNextPage: false, endCursor: null }, nodes: [check('lint', 'SUCCESS', '2026-10-09T00:00:42Z')],
|
||||
} } } }] },
|
||||
},
|
||||
}
|
||||
if (query.includes('node(id: $id)')) {
|
||||
process.stdout.write(JSON.stringify({ data: { node: { contexts: {
|
||||
pageInfo: { hasNextPage: false, endCursor: null },
|
||||
nodes: [check('lint', 'SUCCESS', '2026-10-09T00:00:42Z'), check('test', 'FAILURE', '2026-10-09T00:02:07Z')],
|
||||
} } } }))
|
||||
process.exit(0)
|
||||
}
|
||||
const settings = {
|
||||
squashMergeAllowed: true, mergeCommitAllowed: true, rebaseMergeAllowed: true, viewerPermission: 'WRITE', viewerDefaultMergeMethod: 'SQUASH',
|
||||
}
|
||||
@@ -217,11 +224,11 @@ interface PanelLaunch {
|
||||
* Launch the bundle against a GitHub checkout of `main` and `release` and open the New Session screen of that workspace.
|
||||
* @param failureShot - name of the screenshot saved when the test fails.
|
||||
* @param scenario - normal conversation, a restoration follow-up, or a numbered PR lookup.
|
||||
* @param options - desktop transport, initial checkout branch, and touch input for the browser.
|
||||
* @param options - desktop transport, checkout branch, browser input, sandbox runner availability, and diff output limit.
|
||||
* @returns the scaffold, page, and checkout.
|
||||
*/
|
||||
async function launchPanel(failureShot: string, scenario: 'normal' | 'follow-up' | 'reference' = 'normal',
|
||||
options: { desktop?: 'darwin' | 'win32'; branch?: string; hasTouch?: boolean } = {}): Promise<PanelLaunch> {
|
||||
options: { desktop?: 'darwin' | 'win32'; branch?: string; hasTouch?: boolean; missingSandbox?: boolean; maxDiffBytes?: number } = {}): Promise<PanelLaunch> {
|
||||
const { desktop } = options
|
||||
const resources: { scaffold?: WebScaffold; browser?: Browser } = {}
|
||||
const root = await mkdtemp(join(tmpdir(), 'dsh-forge-panel-'))
|
||||
@@ -240,7 +247,9 @@ async function launchPanel(failureShot: string, scenario: 'normal' | 'follow-up'
|
||||
const panelText = `${Array.from({ length: 20 }, (_, index) => panelLine(index + 1, 'new')).join('\n')}\n`
|
||||
await writeFile(join(root, 'contents.json'), JSON.stringify({ [`src/panel.ts@${HEAD7}`]: panelText }))
|
||||
const overlay = join(root, 'forge.patch.yml')
|
||||
await writeFile(overlay, `- id: forge-github\n config: ${JSON.stringify({ ghCommand: gh })}\n`)
|
||||
await writeFile(overlay, `- id: forge-github\n config: ${JSON.stringify({ ghCommand: gh })}\n`
|
||||
+ (options.maxDiffBytes === undefined ? '' : `- id: forge-panel\n config: ${JSON.stringify({ maxDiffBytes: options.maxDiffBytes })}\n`)
|
||||
+ (options.missingSandbox ? `- id: sandbox\n config: ${JSON.stringify({ runnerCommand: [join(root, 'missing-sandbox')], runnerFailureSignatures: ['sandbox startup failed'] })}\n` : ''))
|
||||
const override = join(root, 'replay.override.json')
|
||||
// The borrowed scenario records one model call, so index 1 appends the reply to the follow-up.
|
||||
if (scenario === 'follow-up') await writeFile(override, JSON.stringify({ patches: [{ at: 1, entry: { kind: 'chunks', chunks: textReply(FOLLOW_UP_REPLY) } }] }))
|
||||
@@ -371,6 +380,68 @@ function worktreeRecords(events: readonly SessionEvent[]): unknown[] {
|
||||
})
|
||||
}
|
||||
|
||||
it.skipIf(MODE === 'record')('reads local Git with full access when the sandbox runner cannot start', async () => {
|
||||
const { scaffold, page, project, tripwire } = await launchPanel('web-e2e-forge-permissions', 'normal', { missingSandbox: true })
|
||||
await git(project, 'update-ref', 'refs/remotes/origin/main', 'HEAD')
|
||||
await git(project, 'symbolic-ref', 'refs/remotes/origin/HEAD', 'refs/remotes/origin/main')
|
||||
await writeFile(join(project, 'README.md'), 'demo\nchanged\n')
|
||||
const { settled } = await sendPrompt(page, scaffold)
|
||||
const sessionId = await settled
|
||||
await page.getByText('LIGHTHOUSE', { exact: true }).waitFor()
|
||||
await page.locator('[data-forge-header]').click()
|
||||
const panel = page.locator('[data-forge-panel]')
|
||||
await panel.getByText('无法读取 Git 信息', { exact: true }).waitFor({ timeout: 20_000 })
|
||||
|
||||
const permission = page.locator('button[aria-label^="访问模式"]').first()
|
||||
await permission.click()
|
||||
await page.getByRole('menuitem', { name: '完全权限', exact: true }).click()
|
||||
const confirmation = page.getByRole('dialog', { name: '确认启用完全权限?' })
|
||||
await confirmation.getByRole('checkbox', { name: '我已了解风险,并愿意继续' }).check()
|
||||
await confirmation.getByRole('button', { name: '启用完全权限' }).click()
|
||||
const local = page.locator('[data-forge-local]')
|
||||
await local.getByRole('button', { name: '查看本会话的变更:1 个文件,新增 1 行,删除 0 行', exact: true }).waitFor({ timeout: 20_000 })
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'full-access.expected.md'), await captureStableAria(page, '[data-forge-local]', scaffold.workspaceCwd), MODE)
|
||||
await local.getByRole('button', { name: '查看本会话的变更:1 个文件,新增 1 行,删除 0 行', exact: true }).click()
|
||||
await page.locator('[data-forge-diff-file="README.md"]').getByText('changed', { exact: true }).waitFor()
|
||||
|
||||
await permission.click()
|
||||
await page.getByRole('menuitem', { name: '工作区内修改', exact: true }).click()
|
||||
if (!await panel.isVisible()) await page.locator('[data-forge-header]').click()
|
||||
await panel.getByText('无法读取 Git 信息', { exact: true }).waitFor({ timeout: 20_000 })
|
||||
await expect.poll(async () => (await readPersistedEvents(scaffold, sessionId))
|
||||
.filter(event => event.type === 'sandbox/mode').map(event => event.data.mode).slice(-2))
|
||||
.toEqual(['danger-full-access', 'workspace-write'])
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
})
|
||||
|
||||
it.skipIf(MODE === 'record')('reports incomplete filter configuration and retries after it is corrected', async () => {
|
||||
const { scaffold, page, project, tripwire } = await launchPanel('web-e2e-forge-filter-config', 'normal', { maxDiffBytes: 512 })
|
||||
await git(project, 'update-ref', 'refs/remotes/origin/main', 'HEAD')
|
||||
await git(project, 'symbolic-ref', 'refs/remotes/origin/HEAD', 'refs/remotes/origin/main')
|
||||
await writeFile(join(project, 'README.md'), 'demo\nchanged\n')
|
||||
const { settled } = await sendPrompt(page, scaffold)
|
||||
await settled
|
||||
await page.getByText('LIGHTHOUSE', { exact: true }).waitFor()
|
||||
await page.locator('[data-forge-header]').click()
|
||||
const openChanges = page.locator('[data-forge-local]').getByRole('button', { name: '查看本会话的变更:1 个文件,新增 1 行,删除 0 行', exact: true })
|
||||
await openChanges.waitFor({ timeout: 20_000 })
|
||||
const key = `filter.${'long'.repeat(200)}.clean`
|
||||
await git(project, 'config', key, 'cat')
|
||||
await openChanges.click()
|
||||
const changes = page.locator('[data-forge-changes="local"]')
|
||||
await changes.getByText('无法完整读取 Git 过滤器配置,尚未执行比较。请检查 Git 配置和读取上限后重试', { exact: true }).waitFor()
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'filter-config-failed.expected.md'),
|
||||
await captureStableAria(page, '[data-forge-changes="local"]', scaffold.workspaceCwd), MODE)
|
||||
|
||||
await git(project, 'config', '--unset', key)
|
||||
await changes.getByRole('button', { name: '重试', exact: true }).click()
|
||||
await changes.locator('[data-forge-diff-file="README.md"]').getByText('changed', { exact: true }).waitFor()
|
||||
expect(await changes.getByRole('status').count()).toBe(0)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
})
|
||||
|
||||
it.skipIf(MODE === 'record')('automatically shows a numbered PR when gh JSON omits its URL', async () => {
|
||||
const { scaffold, page, project, tripwire } = await launchPanel('web-e2e-forge-numbered-reference', 'reference')
|
||||
const { settled } = await sendPrompt(page, scaffold)
|
||||
@@ -472,10 +543,14 @@ it.skipIf(MODE === 'record')('starts a Session in a worktree before its first me
|
||||
// The random branch suffix can read as a duration, so the branch is replaced before the capture normalizes durations.
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'panel.expected.md'),
|
||||
await captureStableAria(page, '[data-forge-panel]', scaffold.workspaceCwd, { replacements: [[branch, 'dsh-{{worktree}}']] }), MODE)
|
||||
const beforeChecks = (await readFile(join(root, 'calls.jsonl'), 'utf8')).trim().split('\n').map(line => JSON.parse(line) as string[])
|
||||
expect(beforeChecks.some(args => args.includes('id=rollup-7'))).toBe(false)
|
||||
const checksRow = change.getByRole('button', { name: /^检查/ })
|
||||
await checksRow.click()
|
||||
const checks = page.getByRole('menu')
|
||||
await expect.poll(() => checks.getByRole('menuitem').allTextContents()).toEqual([expect.stringMatching(/^test/), expect.stringMatching(/^lint/)])
|
||||
const afterChecks = (await readFile(join(root, 'calls.jsonl'), 'utf8')).trim().split('\n').map(line => JSON.parse(line) as string[])
|
||||
expect(afterChecks.filter(args => args.includes('id=rollup-7'))).toHaveLength(1)
|
||||
await page.keyboard.press('Escape')
|
||||
await checks.waitFor({ state: 'detached' })
|
||||
expect(await checksRow.getAttribute('aria-expanded')).toBe('false')
|
||||
@@ -631,7 +706,12 @@ it.skipIf(MODE === 'record')('shows the local changes of the Session by scope an
|
||||
const session = scaffold.ctx.sessions.get(sessionId)
|
||||
if (session === undefined) throw new Error('The Session must stay loaded')
|
||||
const header = page.locator('[data-forge-header]')
|
||||
await header.click()
|
||||
await page.getByRole('button', { name: '打开右侧边栏', exact: true }).click()
|
||||
const guide = page.locator('[data-sidebar-right-guide]')
|
||||
await guide.getByRole('button', { name: /^代码审查和变更/ }).waitFor()
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'review-guide.expected.md'),
|
||||
await captureStableAria(page, '[data-sidebar-right-guide-entry="forge-panel"]', scaffold.workspaceCwd), MODE)
|
||||
await guide.getByRole('button', { name: /^代码审查和变更/ }).click()
|
||||
// The New Session screen inspected the checkout before these changes, which came from outside the Session.
|
||||
await page.locator('[data-forge-panel]').getByRole('button', { name: '刷新状态', exact: true }).click()
|
||||
const card = page.locator('[data-forge-local]')
|
||||
@@ -712,6 +792,13 @@ it.skipIf(MODE === 'record')('shows the local changes of the Session by scope an
|
||||
await page.getByRole('button', { name: '全屏', exact: true }).click()
|
||||
await view.getByRole('navigation').getByRole('button', { name: 'src/panel.ts', exact: true }).waitFor()
|
||||
const fileTree = view.getByRole('navigation')
|
||||
const treeIsLeft = async () => {
|
||||
const tree = await fileTree.boundingBox()
|
||||
const diff = await view.locator('[data-forge-changes-scroll]').boundingBox()
|
||||
if (tree === null || diff === null) throw new Error('Tree and diff must be visible')
|
||||
return tree.x < diff.x
|
||||
}
|
||||
expect(await treeIsLeft()).toBe(true)
|
||||
const directoryName = await fileTree.getByText('src', { exact: true }).boundingBox()
|
||||
const fileName = await fileTree.getByText('panel.ts', { exact: true }).boundingBox()
|
||||
if (directoryName === null || fileName === null) throw new Error('Tree entries must be visible')
|
||||
@@ -719,13 +806,26 @@ it.skipIf(MODE === 'record')('shows the local changes of the Session by scope an
|
||||
await fileTree.getByRole('textbox', { name: '筛选文件…' }).fill('src')
|
||||
await fileTree.getByRole('textbox', { name: '筛选文件…' }).fill('')
|
||||
await fileTree.getByRole('button', { name: 'src', exact: true }).click()
|
||||
await view.getByRole('button', { name: '文件树', exact: true }).click()
|
||||
await view.getByRole('button', { name: /^(将文件树移到右侧|隐藏文件树|在左侧显示文件树)$/ }).click()
|
||||
expect(await treeIsLeft()).toBe(false)
|
||||
expect(await fileTree.getByRole('button', { name: 'src', exact: true }).getAttribute('aria-expanded')).toBe('false')
|
||||
await page.setViewportSize({ width: 390, height: 844 })
|
||||
expect(await fileTree.isVisible()).toBe(false)
|
||||
await view.getByRole('button', { name: '文件树', exact: true }).click()
|
||||
expect(await view.getByRole('button', { name: /^(将文件树移到右侧|隐藏文件树|在左侧显示文件树)$/ }).isVisible()).toBe(false)
|
||||
await view.getByRole('button', { name: '全部 2 个文件', exact: true }).click()
|
||||
await page.getByRole('menu').getByRole('textbox', { name: '筛选文件…' }).waitFor()
|
||||
await page.keyboard.press('Escape')
|
||||
await page.setViewportSize({ width: 1680, height: 1000 })
|
||||
expect(await treeIsLeft()).toBe(false)
|
||||
await view.getByRole('button', { name: /^(将文件树移到右侧|隐藏文件树|在左侧显示文件树)$/ }).click()
|
||||
expect(await fileTree.isVisible()).toBe(false)
|
||||
await view.getByRole('button', { name: /^(将文件树移到右侧|隐藏文件树|在左侧显示文件树)$/ }).click()
|
||||
expect(await treeIsLeft()).toBe(true)
|
||||
expect(await fileTree.getByRole('button', { name: 'src', exact: true }).getAttribute('aria-expanded')).toBe('false')
|
||||
await fileTree.getByRole('textbox', { name: '筛选文件…' }).fill('src')
|
||||
await view.getByRole('button', { name: '文件树', exact: true }).click()
|
||||
await view.getByRole('button', { name: '文件树', exact: true }).click()
|
||||
await view.getByRole('button', { name: /^(将文件树移到右侧|隐藏文件树|在左侧显示文件树)$/ }).click()
|
||||
await view.getByRole('button', { name: /^(将文件树移到右侧|隐藏文件树|在左侧显示文件树)$/ }).click()
|
||||
await view.getByRole('button', { name: /^(将文件树移到右侧|隐藏文件树|在左侧显示文件树)$/ }).click()
|
||||
expect(await fileTree.getByRole('textbox', { name: '筛选文件…' }).inputValue()).toBe('src')
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'file-tree-toggle.expected.md'),
|
||||
await captureStableAria(page, '[data-forge-changes="change"]', scaffold.workspaceCwd), MODE)
|
||||
@@ -737,7 +837,7 @@ it.skipIf(MODE === 'record')('shows the local changes of the Session by scope an
|
||||
if (handle === null) throw new Error('Tree resize handle must be visible')
|
||||
await page.mouse.move(handle.x + handle.width / 2, handle.y + 100)
|
||||
await page.mouse.down()
|
||||
await page.mouse.move(handle.x - 80, handle.y + 100, { steps: 5 })
|
||||
await page.mouse.move(handle.x + 80, handle.y + 100, { steps: 5 })
|
||||
await page.mouse.up()
|
||||
expect(Number(await resizeTree.getAttribute('aria-valuenow'))).toBeGreaterThan(originalWidth)
|
||||
await resizeTree.press('Home')
|
||||
@@ -746,11 +846,25 @@ it.skipIf(MODE === 'record')('shows the local changes of the Session by scope an
|
||||
const treeBounds = await fileTree.boundingBox()
|
||||
if (searchBounds === null || treeBounds === null) throw new Error('Tree search must be visible')
|
||||
expect(searchBounds.x + searchBounds.width).toBeLessThanOrEqual(treeBounds.x + treeBounds.width)
|
||||
await resizeTree.press('ArrowLeft')
|
||||
await resizeTree.press('ArrowRight')
|
||||
const resizedWidth = await resizeTree.getAttribute('aria-valuenow')
|
||||
await view.getByRole('button', { name: '文件树', exact: true }).click()
|
||||
await view.getByRole('button', { name: '文件树', exact: true }).click()
|
||||
await view.getByRole('button', { name: /^(将文件树移到右侧|隐藏文件树|在左侧显示文件树)$/ }).click()
|
||||
expect(await treeIsLeft()).toBe(false)
|
||||
expect(await resizeTree.getAttribute('aria-valuenow')).toBe(resizedWidth)
|
||||
await resizeTree.press('ArrowLeft')
|
||||
expect(Number(await resizeTree.getAttribute('aria-valuenow'))).toBe(Number(resizedWidth) + 20)
|
||||
await resizeTree.press('ArrowRight')
|
||||
const rightHandle = await resizeTree.boundingBox()
|
||||
if (rightHandle === null) throw new Error('Right tree resize handle must be visible')
|
||||
await page.mouse.move(rightHandle.x + rightHandle.width / 2, rightHandle.y + 100)
|
||||
await page.mouse.down()
|
||||
await page.mouse.move(rightHandle.x - 80, rightHandle.y + 100, { steps: 5 })
|
||||
await page.mouse.up()
|
||||
expect(Number(await resizeTree.getAttribute('aria-valuenow'))).toBeGreaterThan(Number(resizedWidth))
|
||||
const rightWidth = await resizeTree.getAttribute('aria-valuenow')
|
||||
await view.getByRole('button', { name: /^(将文件树移到右侧|隐藏文件树|在左侧显示文件树)$/ }).click()
|
||||
await view.getByRole('button', { name: /^(将文件树移到右侧|隐藏文件树|在左侧显示文件树)$/ }).click()
|
||||
expect(await resizeTree.getAttribute('aria-valuenow')).toBe(rightWidth)
|
||||
for (const side of ['old', 'new'] as const) {
|
||||
const firstLine = await panelFile.locator(`[data-review-code][data-${side}-line="2"]`).boundingBox()
|
||||
const lastLine = await panelFile.locator(`[data-review-code][data-${side}-line="4"]`).boundingBox()
|
||||
@@ -810,8 +924,12 @@ it.skipIf(MODE === 'record')('shows the local changes of the Session by scope an
|
||||
await page.keyboard.press('Escape')
|
||||
expect(await reviewDialog.count()).toBe(0)
|
||||
await view.getByRole('button', { name: '提交评审 (1)', exact: true }).click()
|
||||
await reviewDialog.getByRole('textbox', { name: '评审总结…', exact: true }).fill('需要补充边界检查')
|
||||
await reviewDialog.getByRole('radio', { name: '请求更改', exact: true }).check()
|
||||
await reviewDialog.getByText('请求更改时,请填写评审总结', { exact: true }).waitFor()
|
||||
expect(await reviewDialog.getByRole('button', { name: '提交评审', exact: true }).isDisabled()).toBe(true)
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'review-summary-required.expected.md'),
|
||||
await captureStableAria(page, '[role="dialog"][aria-label="提交评审"]', scaffold.workspaceCwd), MODE)
|
||||
await reviewDialog.getByRole('textbox', { name: '评审总结…', exact: true }).fill('需要补充边界检查')
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'submit-review.expected.md'),
|
||||
await captureStableAria(page, '[role="dialog"][aria-label="提交评审"]', scaffold.workspaceCwd), MODE)
|
||||
await reviewDialog.getByRole('button', { name: '提交评审', exact: true }).click()
|
||||
@@ -920,7 +1038,7 @@ it.skipIf(MODE === 'record')('retains a wrapped code line and tree width across
|
||||
await code.waitFor()
|
||||
for (const width of [240, 320]) {
|
||||
if (width === 320) {
|
||||
for (let step = 0; step < 4; step += 1) await separator.press('ArrowLeft')
|
||||
for (let step = 0; step < 4; step += 1) await separator.press('ArrowRight')
|
||||
await beforeFile.getByRole('button', { name: '收起 before-0.ts', exact: true }).click()
|
||||
}
|
||||
await layout()
|
||||
|
||||
@@ -103,7 +103,7 @@ it.each([false, true])('keeps workspace and archived search actions reachable wi
|
||||
await activate(actions)
|
||||
await archive.waitFor()
|
||||
}
|
||||
for (const key of ['ArrowDown', 'Tab']) {
|
||||
for (const key of ['ArrowDown', 'Home']) {
|
||||
await page.keyboard.press(key)
|
||||
expect(await page.locator('html').getAttribute('data-input-modality')).toBe('keyboard')
|
||||
expect(await page.getByRole('menu').evaluate(menu => menu.contains(document.activeElement))).toBe(true)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { mkdir, readFile, writeFile } from 'node:fs/promises'
|
||||
import { basename, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { chromium, type Browser, type Page } from 'playwright'
|
||||
import { chromium, type Browser, type Locator, type Page } from 'playwright'
|
||||
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
|
||||
import { ToolCallId, createAssistantMessage, createToolResultMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
|
||||
import { SESSION_FORMAT_VERSION, Session, SessionId } from '@deepseek-ai/dsh-session'
|
||||
@@ -17,6 +17,13 @@ import { expandOwningTurnProcess, newEnglishPage, saveFailureShot } from './supp
|
||||
const SNAPSHOT_DIR = fileURLToPath(new URL('../../../snapshots/web/markdown-file-links', import.meta.url))
|
||||
const MODE = webSnapshotMode()
|
||||
|
||||
/** A restored preview resolves its Host path after the document's load event. */
|
||||
async function reloadPreview(page: Page, column: Locator, absolutePath: string): Promise<void> {
|
||||
await page.reload({ waitUntil: 'load' })
|
||||
await column.getByText(absolutePath, { exact: true }).waitFor()
|
||||
expect(await column.locator('[data-textpreview-path]').textContent()).toBe(absolutePath)
|
||||
}
|
||||
|
||||
/** Build live test input with a parent-path link and a read result naming the same Host file. */
|
||||
function parentPathFixture(path: string): string {
|
||||
const session = Session.create(SessionId('parent-file-links-source'))
|
||||
@@ -156,6 +163,54 @@ describe('web e2e: Markdown file links', () => {
|
||||
await assertFixtureInventory(SNAPSHOT_DIR, ['session.v3.jsonl', 'links.expected.md', 'preview.expected.md'])
|
||||
})
|
||||
|
||||
it('replays colon line suffixes as locations and shares tabs with fragment links', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-colon-file-links'))
|
||||
const fixture = new URL('./fixtures/markdown-colon-file-links/session.v3.jsonl', import.meta.url)
|
||||
const id = await seedSession(scaffold, await readFile(fixture, 'utf8'), 'colon-file-links')
|
||||
await page.reload({ waitUntil: 'load' })
|
||||
const workspace = page.getByRole('treeitem').first()
|
||||
await workspace.waitFor()
|
||||
if (await workspace.getAttribute('aria-expanded') !== 'true') await workspace.click()
|
||||
await page.locator(`[data-row-key="session:${id}"]`).click()
|
||||
|
||||
const relative = page.getByRole('button', { name: 'Relative colon:24–30', exact: true })
|
||||
await relative.waitFor()
|
||||
expect(await page.getByRole('button', { name: 'Development server', exact: true }).count()).toBe(0)
|
||||
expect(await page.getByRole('link', { name: 'Development server', exact: true }).getAttribute('href')).toBe('localhost:3000')
|
||||
expect(await page.getByRole('link', { name: 'Bare URL', exact: true }).getAttribute('href')).toBe('index.ts:24')
|
||||
expect(await page.getByRole('link', { name: 'Blocked script', exact: true }).count()).toBe(0)
|
||||
expect(await page.getByRole('button', { name: 'Blocked script', exact: true }).count()).toBe(0)
|
||||
expect(await page.getByRole('link', { name: 'Mail', exact: true }).getAttribute('href')).toBe('mailto:10086')
|
||||
await compareOrRefreshGolden(
|
||||
fileURLToPath(new URL('./expected/markdown-colon-file-links.md', import.meta.url)),
|
||||
await relative.locator('..').ariaSnapshot(), MODE,
|
||||
)
|
||||
const column = page.locator('[data-rightbar-col]')
|
||||
for (const label of ['Zero line', 'Reversed range']) {
|
||||
await page.getByRole('button', { name: label, exact: true }).click()
|
||||
await expect.poll(() => column.locator('[data-textpreview-path]').textContent())
|
||||
.toBe(join(scaffold.workspaceCwd, 'src/example.txt'))
|
||||
await expect.poll(() => column.locator('[data-textpreview-line="1"]').textContent()).toBe('source line 1\n')
|
||||
expect(await column.locator('[data-dockkit-tab-title]').allTextContents()).toEqual(['example.txt'])
|
||||
}
|
||||
for (const [label, line] of [['Relative colon:24–30', 24], ['Absolute colon:30', 30], ['Column:24:5', 24], ['Fragment:12', 12]] as const) {
|
||||
const link = page.getByRole('button', { name: label, exact: true })
|
||||
await link.focus()
|
||||
await link.press('Enter')
|
||||
await expect.poll(() => column.locator(`[data-textpreview-target="${line}"]`).textContent())
|
||||
.toBe(`source line ${line}\n`)
|
||||
await expect.poll(() => column.locator('[data-textpreview-path]').textContent())
|
||||
.toBe(join(scaffold.workspaceCwd, 'src/example.txt'))
|
||||
expect(await column.locator('[data-dockkit-tab-title]').allTextContents()).toEqual(['example.txt'])
|
||||
}
|
||||
await reloadPreview(page, column, join(scaffold.workspaceCwd, 'src/example.txt'))
|
||||
await relative.click()
|
||||
await expect.poll(() => column.locator('[data-textpreview-target="24"]').textContent()).toBe('source line 24\n')
|
||||
expect(await column.locator('[data-dockkit-tab-title]').allTextContents()).toEqual(['example.txt'])
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
})
|
||||
|
||||
it('opens parent-path prose and read-card links while retaining each address across reload', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-parent-file-links'))
|
||||
// Return through the parent into this owned temp root; no shared parent file is created.
|
||||
@@ -186,8 +241,7 @@ describe('web e2e: Markdown file links', () => {
|
||||
await expect.poll(() => column.locator('[data-textpreview-target="30"]').textContent()).toBe('parent line 30\n')
|
||||
expect(await tabs.allTextContents()).toEqual(['parent.txt'])
|
||||
|
||||
await page.reload({ waitUntil: 'load' })
|
||||
await expect.poll(() => column.locator('[data-textpreview-path]').textContent()).toBe(join(scaffold.workspaceCwd, 'parent.txt'))
|
||||
await reloadPreview(page, column, join(scaffold.workspaceCwd, 'parent.txt'))
|
||||
await expect.poll(stored).toContain(address)
|
||||
await source.click()
|
||||
await expect.poll(() => column.locator('[data-textpreview-target="24"]').textContent()).toBe('parent line 24\n')
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// A rewritten local image file shows its current bytes in a newly rendered Markdown image.
|
||||
import { writeFile } from 'node:fs/promises'
|
||||
import { readFile, writeFile } from 'node:fs/promises'
|
||||
import { join } from 'node:path'
|
||||
import type { Browser, Page } from 'playwright'
|
||||
import { chromium } from 'playwright'
|
||||
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
|
||||
import { createLaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment'
|
||||
import { createMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
|
||||
import { SESSION_FORMAT_VERSION, Session, SessionId } from '@deepseek-ai/dsh-session'
|
||||
import type {} from '@deepseek-ai/dsh-session-title'
|
||||
@@ -50,7 +51,11 @@ describe('web e2e: rewritten Markdown image files', () => {
|
||||
let tripwire: ReturnType<typeof watchConsole>
|
||||
|
||||
beforeAll(async () => {
|
||||
scaffold = await launchWebScaffold({})
|
||||
scaffold = await launchWebScaffold({
|
||||
openInAppEnvironment: createLaunchEnvironmentSnapshot([
|
||||
{ source: 'process', values: { SSH_CONNECTION: '10.0.0.2 55000 10.0.0.9 22' } },
|
||||
]),
|
||||
})
|
||||
await writeFile(join(scaffold.workspaceCwd, 'chart.svg'), chart(120, 'red'))
|
||||
await seedSession(scaffold, chartFixture('First chart'), 'markdown-image-refresh-first', undefined,
|
||||
{ createdAt: WEB_FIXTURE_TIME - 120_000 })
|
||||
@@ -81,6 +86,14 @@ describe('web e2e: rewritten Markdown image files', () => {
|
||||
await page.getByRole('treeitem').nth(1).click()
|
||||
await page.getByText('Second chart', { exact: true }).last().waitFor()
|
||||
await expect.poll(width, { timeout: 10_000 }).toBe(240)
|
||||
await page.getByRole('img', { name: ALT }).click({ button: 'right' })
|
||||
const action = page.getByRole('menuitem', { name: 'Download', exact: true })
|
||||
await action.waitFor()
|
||||
const [download] = await Promise.all([page.waitForEvent('download'), action.click()])
|
||||
expect(download.suggestedFilename()).toBe('chart.svg')
|
||||
const path = await download.path()
|
||||
if (path === null) throw new Error('Browser download unavailable')
|
||||
expect(await readFile(path, 'utf8')).toBe(chart(240, 'blue'))
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
}, 60_000)
|
||||
|
||||
@@ -3,6 +3,7 @@ import { readFile } from 'node:fs/promises'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { join } from 'node:path'
|
||||
import { chromium, type Locator } from 'playwright'
|
||||
import sharp from 'sharp'
|
||||
import { expect, it, onTestFinished } from 'vitest'
|
||||
import { captureStableAria, compareOrRefreshGolden, launchWebScaffold, seedSession, webSnapshotMode } from './scaffold.ts'
|
||||
|
||||
@@ -48,13 +49,13 @@ it('shares menu transparency and blur across palettes and follows native menu bo
|
||||
})
|
||||
expect(overlayFill).toBe(platform === 'darwin'
|
||||
? dark ? 'rgba(48, 49, 54, 0.94)' : 'rgba(248, 249, 250, 0.94)'
|
||||
: dark ? 'rgba(67, 69, 74, 0.45)' : 'rgba(248, 249, 250, 0.58)')
|
||||
: dark ? 'rgba(48, 49, 54, 0.64)' : 'rgba(252, 253, 254, 0.7)')
|
||||
await account.click()
|
||||
const menu = page.getByRole('menu').filter({ has: page.getByRole('menuitem', { name: 'Settings', exact: true }) })
|
||||
await menu.waitFor()
|
||||
const appearance = await material(menu)
|
||||
expect(appearance).toMatchObject({
|
||||
fill: dark ? 'rgba(67, 69, 74, 0.45)' : 'rgba(248, 249, 250, 0.58)',
|
||||
fill: dark ? 'rgba(48, 49, 54, 0.64)' : 'rgba(252, 253, 254, 0.7)',
|
||||
blur: 'blur(40px) saturate(1.5)',
|
||||
})
|
||||
expect(appearance.shadow).toContain(`${dark ? 'rgba(255, 255, 255, 0.16)' : 'rgba(0, 0, 0, 0.04)'} 0px 0px 0px 0.5px`)
|
||||
@@ -109,4 +110,57 @@ it('shares menu transparency and blur across palettes and follows native menu bo
|
||||
await captureStableAria(page, '[role="menu"]', scaffold.workspaceCwd), webSnapshotMode())
|
||||
await page.keyboard.press('Escape')
|
||||
await expect.poll(() => page.locator('[data-menu-backing]').count()).toBe(0)
|
||||
|
||||
await action.locator('xpath=ancestor::*[@role="treeitem"][1]').click({ button: 'right' })
|
||||
await sessionMenu.waitFor()
|
||||
const popup = page.locator('[data-context-menu]')
|
||||
const stripes = await page.evaluateHandle(() => {
|
||||
const element = document.createElement('div')
|
||||
element.style.cssText = 'position:fixed;inset:0;z-index:1099;pointer-events:none;background:repeating-linear-gradient(90deg,#000 0 4px,#fff 4px 8px)'
|
||||
document.body.appendChild(element)
|
||||
return element
|
||||
})
|
||||
try {
|
||||
// Hide text while preserving layout so pixel contrast measures only the material.
|
||||
await popup.evaluate((node) => {
|
||||
for (const child of node.children) {
|
||||
if (child instanceof HTMLElement && child.getAttribute('aria-hidden') !== 'true') child.style.visibility = 'hidden'
|
||||
}
|
||||
})
|
||||
const box = (await popup.boundingBox())!
|
||||
const clip = { x: Math.floor(box.x + box.width / 2 - 32), y: Math.floor(box.y + box.height / 2 - 16), width: 64, height: 32 }
|
||||
for (const phase of ['enter', 'dismiss', 'replace']) {
|
||||
await popup.evaluate((node, phase) => {
|
||||
node.removeAttribute('data-menu-phase')
|
||||
void (node as HTMLElement).offsetWidth
|
||||
node.setAttribute('data-menu-phase', phase)
|
||||
for (const animation of node.getAnimations({ subtree: true })) {
|
||||
animation.pause()
|
||||
animation.currentTime = Number(animation.effect!.getComputedTiming().duration) / 2
|
||||
}
|
||||
}, phase)
|
||||
const stats = await sharp(await page.screenshot({ clip })).stats()
|
||||
// During a fade the unpainted fraction exposes stripes; a working blur still
|
||||
// removes substantially more contrast than opacity without backdrop sampling.
|
||||
expect(stats.channels[0]!.stdev, phase).toBeLessThan(90)
|
||||
}
|
||||
await popup.evaluate((node) => {
|
||||
node.setAttribute('data-menu-phase', 'enter')
|
||||
for (const animation of node.getAnimations({ subtree: true })) animation.finish()
|
||||
})
|
||||
const settled = await sharp(await page.screenshot({ clip })).stats()
|
||||
expect(settled.channels[0]!.stdev).toBeLessThan(3)
|
||||
await popup.evaluate((node) => {
|
||||
node.style.opacity = '0.999'
|
||||
// The negative control measures backdrop isolation independently of the theme's fill alpha.
|
||||
const material = node.querySelector<HTMLElement>(':scope > [aria-hidden="true"]')!
|
||||
material.style.backgroundColor = 'transparent'
|
||||
})
|
||||
const isolated = await sharp(await page.screenshot({ clip })).stats()
|
||||
expect(isolated.channels[0]!.stdev).toBeGreaterThan(90)
|
||||
} finally {
|
||||
await stripes.evaluate((node) => { node.remove() })
|
||||
await stripes.dispose()
|
||||
await page.keyboard.press('Escape')
|
||||
}
|
||||
})
|
||||
@@ -1,6 +1,8 @@
|
||||
// Real Git reaches a controlled proxy failure or stall; the browser
|
||||
// offers a mirror for a replacement spec, or another way once the install
|
||||
// already asks the mirror, without retrying the failed address.
|
||||
// already asks the mirror, without retrying the failed address. Without a
|
||||
// configured fallback registry the same failure keeps the plain failed
|
||||
// screen, whose details name the check's own Git run and complete log.
|
||||
import { once } from 'node:events'
|
||||
import { mkdtemp, readFile, writeFile, rm } from 'node:fs/promises'
|
||||
import { createServer, type Socket } from 'node:net'
|
||||
@@ -121,3 +123,66 @@ it.each(['network', 'timeout'] as const)('offers a mirror after a GitHub %s, the
|
||||
expect(connections).toBeGreaterThan(checked)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
})
|
||||
|
||||
it("shows the failed check's Git run and complete log in the installation details when no mirror is offered", async () => {
|
||||
const scratch = await mkdtemp(join(tmpdir(), 'dsh-install-github-details-'))
|
||||
onTestFinished(() => rm(scratch, { recursive: true, force: true }))
|
||||
const sockets = new Set<Socket>()
|
||||
const proxy = createServer((socket) => {
|
||||
sockets.add(socket)
|
||||
socket.on('error', () => {})
|
||||
socket.once('close', () => { sockets.delete(socket) })
|
||||
socket.once('data', () => socket.destroy())
|
||||
})
|
||||
onTestFinished(async () => {
|
||||
for (const socket of sockets) socket.destroy()
|
||||
await new Promise<void>((resolve, reject) => { proxy.close((error) => { if (error) reject(error); else resolve() }) })
|
||||
})
|
||||
proxy.listen(0, '127.0.0.1')
|
||||
await once(proxy, 'listening')
|
||||
const address = proxy.address()
|
||||
if (address === null || typeof address === 'string') throw new Error('proxy did not bind a TCP port')
|
||||
const gitConfig = join(scratch, 'git.config')
|
||||
await writeFile(gitConfig, `[http "https://github.com/"]\n proxy = http://127.0.0.1:${String(address.port)}\n`)
|
||||
// Without a configured fallback registry the Host has no mirror to offer, so the failure keeps the
|
||||
// plain failed screen whose details name the check's own run.
|
||||
const overlay = join(scratch, 'cordis.patch.yml')
|
||||
await writeFile(overlay, '- id: ui-plugin-manager\n config: { registryProbeEnabled: false }\n- id: plugin-manager\n config: { fallbackRegistries: [] }\n')
|
||||
const scaffold = await launchWebScaffold({
|
||||
profile: { packages: [], packageManager: { command: process.execPath, args: [], env: { GIT_CONFIG_GLOBAL: gitConfig, GIT_CONFIG_NOSYSTEM: '1' } } },
|
||||
extraOverlayPath: overlay,
|
||||
})
|
||||
onTestFinished(() => scaffold.close())
|
||||
const browser = await chromium.launch()
|
||||
onTestFinished(() => browser.close())
|
||||
const profile = join(scaffold.harnessHome, 'profiles', 'scaffold')
|
||||
const attempts = join(profile, '.attempts')
|
||||
await writeFile(join(profile, 'config'), 'console.log("https://registry.npmjs.org/")\n')
|
||||
await writeFile(attempts, '')
|
||||
await writeFile(join(profile, 'add'), `
|
||||
const fs = require('node:fs');
|
||||
fs.appendFileSync('.attempts', JSON.stringify(process.argv) + '\\n');
|
||||
process.exitCode = 1;
|
||||
`)
|
||||
const page = await browser.newPage({ viewport: { width: 1280, height: 800 }, locale: ZH_BROWSER_LOCALE })
|
||||
const tripwire = watchConsole(page)
|
||||
await page.goto(scaffold.authenticatedUrl)
|
||||
await page.waitForSelector('[class*="frame"]')
|
||||
if (await page.getByRole('dialog', { name: '设置' }).count() > 0) await page.keyboard.press('Escape')
|
||||
await page.getByRole('navigation', { name: '全局面板' }).getByRole('button', { name: '插件', exact: true }).click()
|
||||
await page.getByRole('button', { name: '添加插件', exact: true }).click()
|
||||
const spec = 'https://github.com/example/dsh-plugin.git'
|
||||
let dialog = page.getByRole('dialog', { name: '添加插件', exact: true })
|
||||
await dialog.getByRole('textbox', { name: '包名或地址' }).fill(spec)
|
||||
await dialog.getByRole('button', { name: '安装', exact: true }).click()
|
||||
dialog = page.getByRole('dialog', { name: '插件安装失败', exact: true })
|
||||
await dialog.waitFor()
|
||||
expect(await dialog.getByText('无法连接 github.com', { exact: false }).count()).toBe(1)
|
||||
// The details carry the failed check's own Git run and the complete log, not an empty terminal.
|
||||
await dialog.getByRole('button', { name: '查看安装详情', exact: true }).click()
|
||||
await dialog.getByText(/git -c credential\.helper= ls-remote -- https:\/\/github\.com\/example\/dsh-plugin\.git HEAD/).waitFor()
|
||||
await dialog.getByText(/fatal: unable to access/).waitFor()
|
||||
expect(await dialog.getByText(/^完整日志:.*github-connection-.*git\.log$/).count()).toBe(1)
|
||||
expect(await readFile(attempts, 'utf8')).toBe('')
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
})
|
||||
@@ -124,6 +124,7 @@ it.each(['https://registry.npmjs.org/', MIRROR])('selects the fastest responding
|
||||
const installed = (await captureStableAria(page, '[role="dialog"]', scaffold.workspaceCwd))
|
||||
.split(process.execPath).join('{{node}}')
|
||||
.split(scaffold.harnessHome).join('{{harnessHome}}')
|
||||
.replace(/operation-[A-Za-z0-9]+/g, 'operation-{{suffix}}')
|
||||
await compareOrRefreshGolden(fileURLToPath(new URL('./expected/plugin-install-registry/installed.expected.md', import.meta.url)), installed, webSnapshotMode())
|
||||
// The dialog opened again starts from the registry picked for the last install.
|
||||
await dialog.getByRole('button', { name: '立即启用', exact: true }).click()
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
// A real Host/Remote/browser composition with a controllable package-manager process:
|
||||
// pnpm fails without printing anything, and the dialog still shows what failed and where
|
||||
// the complete log lives instead of a generic sentence over an empty details panel.
|
||||
import { mkdtemp, readFile, writeFile, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { chromium } from 'playwright'
|
||||
import { expect, it } from 'vitest'
|
||||
import { launchWebScaffold, captureStableAria, compareOrRefreshGolden, webSnapshotMode, watchConsole, type WebScaffold } from './scaffold.ts'
|
||||
import { ZH_BROWSER_LOCALE } from './support.ts'
|
||||
|
||||
it('reports a failed install whose pnpm printed nothing with its command line, output, and log file', async () => {
|
||||
const scratch = await mkdtemp(join(tmpdir(), 'dsh-install-silent-'))
|
||||
const overlay = join(scratch, 'cordis.patch.yml')
|
||||
await writeFile(overlay, `- id: plugin-manager\n config: ${JSON.stringify({ pnpmCommand: process.execPath })}\n`)
|
||||
let scaffold: WebScaffold | undefined
|
||||
try {
|
||||
scaffold = await launchWebScaffold({ profile: { packages: [] }, extraOverlayPath: overlay })
|
||||
const browser = await chromium.launch()
|
||||
try {
|
||||
const profile = join(scaffold.harnessHome, 'profiles', 'scaffold')
|
||||
// Node stands in for pnpm: `view` answers the check, and `add` exits unsuccessfully without printing
|
||||
// anything, the way a silent or early-crashing package manager leaves a failed run with no terminal output.
|
||||
await writeFile(join(profile, 'view'), 'console.log(JSON.stringify({ name: "silent-package", version: "1.0.0", dsh: { bundle: { patch: "./cordis.patch.yml" } } }))\n')
|
||||
await writeFile(join(profile, 'add'), 'process.exitCode = 1\n')
|
||||
const page = await browser.newPage({ viewport: { width: 1440, height: 1000 }, locale: ZH_BROWSER_LOCALE })
|
||||
const tripwire = watchConsole(page)
|
||||
await page.goto(scaffold.authenticatedUrl)
|
||||
await page.waitForSelector('[class*="frame"]')
|
||||
if (await page.getByRole('dialog', { name: '设置' }).count() > 0) await page.keyboard.press('Escape')
|
||||
await page.getByRole('navigation', { name: '全局面板' }).getByRole('button', { name: '插件', exact: true }).click()
|
||||
await page.getByRole('button', { name: '添加插件', exact: true }).click()
|
||||
const dialog = page.getByRole('dialog')
|
||||
await dialog.getByRole('textbox').fill('silent-package')
|
||||
await dialog.getByRole('button', { name: '安装', exact: true }).click()
|
||||
const failure = page.getByRole('dialog', { name: '插件安装失败', exact: true })
|
||||
await failure.waitFor({ timeout: 20_000 })
|
||||
// The sentence names the failed stage; the details carry the Host's own record of the run.
|
||||
await failure.getByText('安装命令失败,原因见安装详情', { exact: true }).waitFor()
|
||||
await failure.getByRole('button', { name: '查看安装详情', exact: true }).click()
|
||||
await failure.getByText('pnpm add silent-package', { exact: true }).waitFor()
|
||||
await failure.getByText(/Command failed with exit code 1:/).waitFor()
|
||||
expect(await failure.getByText(/^完整日志:.*pnpm\.log$/).count()).toBe(1)
|
||||
expect(await readFile(join(profile, 'package.json'), 'utf8')).not.toContain('silent-package')
|
||||
const snapshot = (await captureStableAria(page, '[role="dialog"]', scaffold.workspaceCwd))
|
||||
.split(process.execPath).join('{{node}}')
|
||||
.split(scaffold.harnessHome).join('{{harnessHome}}')
|
||||
.replace(/operation-[A-Za-z0-9]+/g, 'operation-{{suffix}}')
|
||||
await compareOrRefreshGolden(
|
||||
fileURLToPath(new URL('./expected/plugin-install-silent-failure/failed.expected.md', import.meta.url)), snapshot, webSnapshotMode(),
|
||||
)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
} finally { await browser.close() }
|
||||
} finally {
|
||||
await scaffold?.close()
|
||||
await rm(scratch, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
@@ -269,7 +269,7 @@ describe('web e2e: plugin manager', () => {
|
||||
await add.focus()
|
||||
for (const [width, icons, narrowTabs, wraps] of [
|
||||
[1280, false, false, false], [544, true, false, false],
|
||||
[414, true, true, false], [334, true, true, true], [244, true, true, true],
|
||||
[390, true, true, false], [320, true, true, true], [244, true, true, true],
|
||||
] as const) {
|
||||
await probe.setViewportSize({ width, height: 480 })
|
||||
await body.evaluate((element) => { element.scrollTop = 180 })
|
||||
|
||||
@@ -83,8 +83,8 @@ it('preserves both header layouts and follows the scroll position without changi
|
||||
await page.locator('[data-plugin-bar][data-natural]').waitFor()
|
||||
await page.evaluate(() => document.fonts.ready)
|
||||
// Without tabs, whether the actions fit beside the title at 470px depends on the platform font,
|
||||
// so that width is pinned only with tabs. At 334px the tabs and actions wrap onto separate rows.
|
||||
for (const width of hasTabs ? [1280, 600, 470, 390, 334] : [1280, 600, 390]) {
|
||||
// so that width is pinned only with tabs. At 320px the tabs and actions wrap onto separate rows.
|
||||
for (const width of hasTabs ? [1280, 600, 470, 390, 320] : [1280, 600, 390]) {
|
||||
await page.setViewportSize({ width, height: 480 })
|
||||
await scrollTo(page, 0)
|
||||
const resting = await reference(page, false)
|
||||
@@ -95,7 +95,7 @@ it('preserves both header layouts and follows the scroll position without changi
|
||||
expect(initial.tabs).toEqual(resting.tabs)
|
||||
if (hasTabs && width <= 600) {
|
||||
const tabs = initial.tabs!
|
||||
if (width === 334) {
|
||||
if (width === 320) {
|
||||
expect(initial.toolbar.y).toBeGreaterThanOrEqual(tabs.y + tabs.height)
|
||||
} else {
|
||||
expect(initial.toolbar.x).toBeGreaterThanOrEqual(tabs.x + tabs.width)
|
||||
|
||||
@@ -127,10 +127,16 @@ describe.skipIf(process.platform === 'win32')('Web sidebar shortcuts', () => {
|
||||
|
||||
const terminalEntry = panel.locator('[data-sidebar-right-guide-entry="terminal"]')
|
||||
const shellMenu = terminalEntry.getByRole('button', { name: 'Choose shell', exact: true })
|
||||
const titleBounds = await terminalEntry.getByText('New terminal', { exact: true }).boundingBox()
|
||||
const arrowBounds = await shellMenu.boundingBox()
|
||||
expect(arrowBounds!.x).toBeGreaterThanOrEqual(titleBounds!.x + titleBounds!.width)
|
||||
expect(arrowBounds!.x - titleBounds!.x - titleBounds!.width).toBeLessThan(8)
|
||||
// Sample both rectangles in one layout instead of crossing the panel's transition frames.
|
||||
await expect.poll(() => terminalEntry.evaluate((entry) => {
|
||||
const title = [...entry.querySelectorAll('span[aria-hidden="true"]')].find(element => element.textContent === 'New terminal')
|
||||
const arrow = entry.querySelector('button[aria-label="Choose shell"]')
|
||||
if (title === undefined || arrow === null) return null
|
||||
const titleBounds = title.getBoundingClientRect()
|
||||
const arrowBounds = arrow.getBoundingClientRect()
|
||||
const gap = arrowBounds.left - titleBounds.right
|
||||
return { ordered: gap >= 0, adjacent: gap < 8 }
|
||||
})).toEqual({ ordered: true, adjacent: true })
|
||||
await shellMenu.click()
|
||||
await page.getByRole('menu').waitFor()
|
||||
expect(await panel.locator('[data-sidebar-terminal]').count()).toBe(0)
|
||||
@@ -254,12 +260,12 @@ describe.skipIf(process.platform === 'win32')('Web sidebar shortcuts', () => {
|
||||
await menuTab.click({ button: 'right' })
|
||||
await page.getByRole('menu').waitFor()
|
||||
expect(await page.getByRole('tooltip').count()).toBe(0)
|
||||
expect(await page.getByRole('menuitem').getAttribute('aria-keyshortcuts')).toBeNull()
|
||||
expect(await page.getByRole('menuitem', { name: 'Close', exact: true }).getAttribute('aria-keyshortcuts')).toBe(aria)
|
||||
if (attempt === 0) {
|
||||
await compareOrRefreshGolden(join(expected, 'tab-menu.expected.md'),
|
||||
await captureStableAria(page, '[data-dockkit-tab-menu]', scaffold.workspaceCwd), mode)
|
||||
await captureStableAria(page, '[data-context-menu][role="menu"]', scaffold.workspaceCwd), mode)
|
||||
} else {
|
||||
await page.getByRole('menuitem').focus()
|
||||
await page.getByRole('menuitem', { name: 'Close', exact: true }).focus()
|
||||
}
|
||||
await page.keyboard.press('Escape')
|
||||
await page.getByRole('menu').waitFor({ state: 'detached' })
|
||||
|
||||
@@ -553,6 +553,11 @@ describe('web e2e: sidebar search alignment and row action targets', () => {
|
||||
expect(tooltipBox.x + tooltipBox.width).toBe(anchorBox.x + anchorBox.width)
|
||||
await page.mouse.move(1000, 400)
|
||||
await tooltip.waitFor({ state: 'detached' })
|
||||
if (kind === 'session') {
|
||||
expect(await menuButton.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
expect(await tooltipAnchor.isVisible()).toBe(true)
|
||||
}
|
||||
await page.mouse.click(1000, 400)
|
||||
expect(await tooltipAnchor.isVisible()).toBe(false)
|
||||
expect(await page.getByRole('tooltip').count()).toBe(0)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
|
||||
@@ -236,6 +236,9 @@ it('overlays the conversation and closes after navigation without losing its sid
|
||||
const opener = page.getByRole('button', { name: 'Open sidebar', exact: true })
|
||||
await opener.waitFor()
|
||||
const frame = page.locator('[data-sidebar-drawer]')
|
||||
expect(await page.locator('[data-shell-leading]').getByRole('button').count()).toBe(1)
|
||||
expect(await frame.evaluate(el => getComputedStyle(el).getPropertyValue('--dsh-frame-leading-clearance').trim()))
|
||||
.toBe('48px')
|
||||
await expect.poll(() => frame.getAttribute('data-sidebar-collapsed')).toBe('true')
|
||||
const sidebar = page.locator('[data-slot="sidebar"]')
|
||||
const original = await sidebar.elementHandle()
|
||||
@@ -271,6 +274,33 @@ it('overlays the conversation and closes after navigation without losing its sid
|
||||
await assertMaskFade(frame, 1, 0)
|
||||
await drawer.waitFor({ state: 'hidden' })
|
||||
await page.getByRole('navigation', { name: 'Session hierarchy' }).getByText('Drawer navigation', { exact: true }).waitFor()
|
||||
const chatTab = page.getByRole('tab', { name: 'Chat', exact: true })
|
||||
const tabInset = () => chatTab.evaluate((tab) => {
|
||||
const label = document.createRange()
|
||||
label.selectNodeContents(tab)
|
||||
return label.getBoundingClientRect().left - tab.closest('header')!.getBoundingClientRect().left
|
||||
})
|
||||
expect(await tabInset()).toBeCloseTo(20, 1)
|
||||
// Restore CSS-probe markers in the same synchronous task, before rendering.
|
||||
const desktopInsets = await chatTab.evaluate((tab) => {
|
||||
const root = document.documentElement
|
||||
try {
|
||||
return ['darwin', 'win32'].map((platform) => {
|
||||
root.dataset.platform = platform
|
||||
const label = document.createRange()
|
||||
label.selectNodeContents(tab)
|
||||
return label.getBoundingClientRect().left - tab.closest('header')!.getBoundingClientRect().left
|
||||
})
|
||||
} finally {
|
||||
delete root.dataset.platform
|
||||
}
|
||||
})
|
||||
for (const inset of desktopInsets) expect(inset).toBeCloseTo(28, 1)
|
||||
await page.setViewportSize({ width: 768, height: 844 })
|
||||
await frame.waitFor({ state: 'detached' })
|
||||
expect(await tabInset()).toBeCloseTo(28, 1)
|
||||
await page.setViewportSize({ width: 390, height: 844 })
|
||||
await frame.waitFor()
|
||||
await opener.click()
|
||||
const selectedRow = drawer.getByRole('treeitem', { selected: true })
|
||||
const more = selectedRow.getByRole('button', { name: 'Session actions for Drawer navigation', exact: true })
|
||||
@@ -283,14 +313,52 @@ it('overlays the conversation and closes after navigation without losing its sid
|
||||
await menu.getByRole('menuitem', { name: 'Archive session', exact: true }).waitFor()
|
||||
await menu.getByRole('menuitem', { name: 'Pin session', exact: true }).tap()
|
||||
await menu.waitFor({ state: 'hidden' })
|
||||
await selectedRow.getByLabel('Pinned', { exact: true }).waitFor()
|
||||
const unpin = selectedRow.getByRole('button', { name: 'Unpin session', exact: true })
|
||||
await expect.poll(() => selectedRow.getByLabel('Pinned', { exact: true }).count()).toBe(1)
|
||||
expect(await unpin.isVisible()).toBe(true)
|
||||
const timestamp = selectedRow.getByText(/^(?:now|\d+min)$/, { exact: true })
|
||||
expect(await timestamp.count()).toBe(1)
|
||||
expect(await timestamp.textContent()).toMatch(/^(?:now|\d+min)$/)
|
||||
expect(await timestamp.isVisible()).toBe(false)
|
||||
const unpinBox = (await unpin.boundingBox())!
|
||||
const moreBox = (await more.boundingBox())!
|
||||
const folderMoreBox = (await workspaceButtons.nth(0).boundingBox())!
|
||||
const folderNewBox = (await workspaceButtons.nth(1).boundingBox())!
|
||||
expect(moreBox.x - unpinBox.x).toBeCloseTo(folderNewBox.x - folderMoreBox.x, 1)
|
||||
await unpin.tap()
|
||||
await expect.poll(() => selectedRow.getByLabel('Pinned', { exact: true }).count()).toBe(0)
|
||||
expect(await drawer.isVisible()).toBe(true)
|
||||
await more.tap()
|
||||
await menu.getByRole('menuitem', { name: 'Pin session', exact: true }).tap()
|
||||
await menu.waitFor({ state: 'hidden' })
|
||||
await unpin.waitFor()
|
||||
await more.tap()
|
||||
await menu.getByRole('menuitem', { name: 'Unpin session', exact: true }).tap()
|
||||
await menu.waitFor({ state: 'hidden' })
|
||||
await expect.poll(() => selectedRow.getByLabel('Pinned', { exact: true }).count()).toBe(0)
|
||||
await drawer.getByRole('button', { name: 'Plugins', exact: true }).tap()
|
||||
await drawer.waitFor({ state: 'hidden' })
|
||||
await page.locator('[data-plugin-panel]').waitFor()
|
||||
const pluginPanel = page.locator('[data-plugin-panel]')
|
||||
await pluginPanel.waitFor()
|
||||
for (const width of [390, 767, 768]) {
|
||||
await page.setViewportSize({ width, height: 844 })
|
||||
expect(await pluginPanel.evaluate(el => Number.parseFloat(getComputedStyle(el).paddingLeft)))
|
||||
.toBeCloseTo(width < 768 ? 20 : width * 0.04, 1)
|
||||
}
|
||||
await page.setViewportSize({ width: 390, height: 844 })
|
||||
await frame.waitFor()
|
||||
await opener.click()
|
||||
await drawer.getByRole('button', { name: 'Automation tasks', exact: true }).tap()
|
||||
await drawer.waitFor({ state: 'hidden' })
|
||||
const tasksContent = page.getByTestId('task-manager-page').locator('[class*="pageContent"]')
|
||||
await tasksContent.waitFor()
|
||||
for (const width of [390, 767, 768]) {
|
||||
await page.setViewportSize({ width, height: 844 })
|
||||
expect(await tasksContent.evaluate(el => Number.parseFloat(getComputedStyle(el).paddingLeft)))
|
||||
.toBeCloseTo(width < 768 ? 20 : width * 0.04, 1)
|
||||
}
|
||||
await page.setViewportSize({ width: 390, height: 844 })
|
||||
await frame.waitFor()
|
||||
await opener.click()
|
||||
await drawer.waitFor()
|
||||
await page.touchscreen.tap(370, 420)
|
||||
@@ -526,7 +594,9 @@ it('overlays the conversation and closes after navigation without losing its sid
|
||||
'fold transitions: sidebar controls follow the divider in both directions; reduced motion changes width without animation',
|
||||
'drawer mask: opacity transitions from 0 to 1 on open and 1 to 0 on close',
|
||||
'reduced motion: drawer and mask settle without transitions',
|
||||
'touch selected Session: More remains visible; archive and pin stay in its menu; pin marker retained',
|
||||
'Web header: only the sidebar opener remains, with 48px leading clearance',
|
||||
'below 768px: plugin and automation pages use 20px insets; Web view tabs align at 20px, while Desktop and wider Web tabs retain 28px',
|
||||
'touch selected Session: More remains visible; update time is hidden; pinned rows offer Unpin before More with Workspace action spacing',
|
||||
'touch Workspace: actions appear only while expanded, including after folding the focused row',
|
||||
'fine pointer: folded Workspace actions remain available on hover',
|
||||
'fine pointer: selected Session actions stay hidden until hover, including at 390px',
|
||||
|
||||
@@ -1128,8 +1128,28 @@ describe('web e2e: shipped right Sidebar', () => {
|
||||
expect(await column.locator('[data-dockkit-tab-close]').count()).toBe(0)
|
||||
expect(await column.locator('[data-dockkit-tab-quiet]').count()).toBe(1)
|
||||
await column.locator('[data-dockkit-tab]').first().click({ button: 'right' })
|
||||
expect(await page.locator('[data-dockkit-tab-menu]').isVisible()).toBe(false)
|
||||
// Wait for prepared content, rather than passing before the opening delay.
|
||||
const emptyMenu = page.locator('[data-context-menu][role="menu"]')
|
||||
await emptyMenu.waitFor({ state: 'attached' })
|
||||
expect(await emptyMenu.evaluate(node => getComputedStyle(node).display)).toBe('none')
|
||||
expect(await emptyMenu.isVisible()).toBe(false)
|
||||
expect(await page.getByRole('menu').count()).toBe(0)
|
||||
expect(await column.locator('[data-dockkit-tab]').first().evaluate(node => node.contains(document.activeElement))).toBe(true)
|
||||
const backingSize = await page.locator('[data-menu-backing]').evaluate((node) => {
|
||||
const root = document.documentElement
|
||||
const platform = root.getAttribute('data-platform')
|
||||
root.setAttribute('data-platform', 'darwin')
|
||||
try {
|
||||
const { width, height } = node.getBoundingClientRect()
|
||||
return { width, height }
|
||||
} finally {
|
||||
if (platform === null) root.removeAttribute('data-platform')
|
||||
else root.setAttribute('data-platform', platform)
|
||||
}
|
||||
})
|
||||
expect(backingSize).toEqual({ width: 0, height: 0 })
|
||||
await page.keyboard.press('Escape')
|
||||
await emptyMenu.waitFor({ state: 'detached' })
|
||||
|
||||
// Any other tab standing alone closes together with the column. Open the
|
||||
// sample file, close the guide (an ordinary close with two tabs), then
|
||||
@@ -1231,13 +1251,10 @@ describe('web e2e: shipped right Sidebar', () => {
|
||||
// is the secondary press.
|
||||
expect(await column.locator('[data-dockkit-tab-more]').count()).toBe(0)
|
||||
await column.locator('[data-dockkit-tab]').filter({ hasText: 'Start' }).click({ button: 'right' })
|
||||
const menu = page.locator('[data-dockkit-tab-menu]')
|
||||
const menu = page.locator('[data-context-menu][role="menu"]')
|
||||
await expect.poll(async () => await menu.count()).toBe(1)
|
||||
|
||||
// The kit's one item; the extension seat is declared and rendered, and
|
||||
// with no registrant it contributes nothing, which is what "declared, not
|
||||
// speculative" looks like from the outside.
|
||||
await expect.poll(async () => await menu.getByRole('menuitem').allInnerTexts()).toEqual(['Close'])
|
||||
await expect.poll(() => menu.ariaSnapshot()).toBe('- menu:\n - menuitem "Close"\n - menuitem "Close Other Tabs"')
|
||||
// The menu hangs below the strip that clips its overflow. Its pixels are
|
||||
// its own: a hit test at its centre lands on it, not on whatever the
|
||||
// strip would have shown through a clipped box.
|
||||
|
||||
@@ -567,7 +567,10 @@ describe('web e2e: workspace management (create / rename / grouping / hover affo
|
||||
const consoleWatch = watchConsole(hoverPage)
|
||||
await hoverPage.goto(scaffold.authenticatedUrl)
|
||||
const row = await seededSessionRow(hoverPage)
|
||||
await row.click()
|
||||
await hoverPage.getByText('DONE', { exact: true }).waitFor()
|
||||
const title = row.locator('[class*="title"]')
|
||||
await expect.poll(() => title.innerText()).not.toBe('Untitled')
|
||||
const card = hoverPage.getByRole('button', { name: `Copy: ${await title.innerText()}` })
|
||||
const tooltip = hoverPage.getByRole('tooltip')
|
||||
const observations: { stage: string; details: boolean; tooltips: string[] }[] = []
|
||||
@@ -575,6 +578,7 @@ describe('web e2e: workspace management (create / rename / grouping / hover affo
|
||||
observations.push({ stage, details: await card.count() > 0, tooltips: await tooltip.allTextContents() })
|
||||
}
|
||||
const clockStart = Date.now()
|
||||
await hoverPage.getByRole('button', { name: 'Account menu', exact: true }).hover()
|
||||
await hoverPage.clock.install({ time: clockStart })
|
||||
await hoverPage.clock.pauseAt(clockStart + 1000)
|
||||
await title.hover()
|
||||
@@ -612,9 +616,11 @@ describe('web e2e: workspace management (create / rename / grouping / hover affo
|
||||
|
||||
const menu = row.getByRole('button', { name: /^Session actions for / })
|
||||
await menu.click()
|
||||
await hoverPage.clock.runFor(1000)
|
||||
await hoverPage.getByRole('menu').waitFor()
|
||||
expect(await card.count()).toBe(0)
|
||||
await hoverPage.keyboard.press('Escape')
|
||||
await hoverPage.clock.runFor(1000)
|
||||
await hoverPage.getByRole('menu').waitFor({ state: 'detached' })
|
||||
await title.hover()
|
||||
await hoverPage.clock.runFor(1600)
|
||||
@@ -821,8 +827,10 @@ describe('web e2e: workspace management (create / rename / grouping / hover affo
|
||||
await item.hover()
|
||||
await page.waitForTimeout(POINTER_HOLD_MS)
|
||||
expect(await page.getByRole('menuitem', { name: 'Rename' }).count()).toBe(1)
|
||||
// Pointer-leave dismissal still applies once the pointer genuinely leaves.
|
||||
// Context menus stay open across pointer departure and dismiss on an outside press.
|
||||
await page.getByRole('button', { name: 'Account menu', exact: true }).hover()
|
||||
expect(await item.isVisible()).toBe(true)
|
||||
await page.locator('[data-row-key]').first().click()
|
||||
await expect.poll(() => page.getByRole('menuitem', { name: 'Rename' }).count(), { timeout: 5_000 }).toBe(0)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
}, 60_000)
|
||||
@@ -862,9 +870,8 @@ describe('web e2e: workspace management (create / rename / grouping / hover affo
|
||||
await page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
|
||||
acknowledgeReloadConnectionLoss(tripwire, warningStart)
|
||||
await expect.poll(() => page.getByText('Workspaces', { exact: true }).count(), { timeout: 15_000 }).toBe(1)
|
||||
// Initial Workspace reconnection can focus the composer after the tree renders.
|
||||
// Finish that navigation before the next test opens a path editor.
|
||||
await page.locator('[role="treeitem"][aria-selected="true"]').waitFor({ timeout: 15_000 })
|
||||
// The last Session can leave the new-session page with no selected row.
|
||||
// Wait for composer focus so reconnection cannot steal the next editor's focus.
|
||||
await expect.poll(
|
||||
() => page.locator('[data-composer-input][contenteditable="true"]')
|
||||
.evaluate(element => element === document.activeElement),
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
"tests/creation-recommendations.e2e.ts",
|
||||
"tests/plugin-recommendations.e2e.ts",
|
||||
"tests/japanese-plugin-metadata.e2e.ts",
|
||||
"tests/context-menus.e2e.ts",
|
||||
"tests/additional-locales.e2e.ts",
|
||||
"tests/rich-text-quotes.e2e.ts",
|
||||
"tests/hover-input.e2e.ts",
|
||||
@@ -114,6 +115,7 @@
|
||||
"tests/plugin-hmr-lifecycle.e2e.ts",
|
||||
"tests/plugin-install-registry.e2e.ts",
|
||||
"tests/plugin-install-github.e2e.ts",
|
||||
"tests/plugin-install-silent-failure.e2e.ts",
|
||||
"tests/client-plugin-live.e2e.ts",
|
||||
"tests/icon-skin.e2e.ts",
|
||||
"tests/draft-initialization.e2e.ts",
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
en: 41d772192075e133
|
||||
zh: 5ef3da69b4de1d8a
|
||||
/capability-seams-and-core-services:
|
||||
en: 6dfe441b758583b2
|
||||
zh: fb28de0533f07432
|
||||
en: 5e42f2392f0457d6
|
||||
zh: a694691c079e36fb
|
||||
@@ -663,7 +663,7 @@ flowchart LR
|
||||
| `ctx.connection` | `core` | [`client-connection`](../packages/client/connection) | - | [`api-gateway`](../packages/api/gateway), [`host-frontend-static`](../packages/host/frontend-static) | - | Owns browser authentication and shared HTTP request dispatch; API adapters register endpoints and streams. |
|
||||
| `ctx.forge` | `seam` | [`experimental-forge`](../packages/experimental/forge) | [`experimental-forge-github`](../packages/experimental/forge-github) | [`experimental-forge-session`](../packages/experimental/forge-session), [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | Providers map remote and change request URLs, look up change requests by head branch, and read status in batches; watchers of one change request share one polling loop. |
|
||||
| `ctx.forgeSession` | `service` | [`experimental-forge-session`](../packages/experimental/forge-session) | - | [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | A Session projection derives bindings from shell results and binding records and publishes their URLs without status to clients; push results trigger head-branch discovery, and Session watchers poll bound change requests through the forge registry. |
|
||||
| `ctx.forgePanel` | `service` | [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | - | - | Streams one panel state per followed Session: a read-only Git inspection in the Session sandbox, the recognized code host and its sign-in, and the bound change requests with polled status. |
|
||||
| `ctx.forgePanel` | `service` | [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | - | - | Streams one panel state per followed Session: Git inspection using Session permissions, the recognized code host and its sign-in, and the bound change requests with polled status. |
|
||||
| `ctx.worktrees` | `seam` | [`experimental-worktree`](../packages/experimental/worktree) | [`experimental-worktree`](../packages/experimental/worktree) | [`experimental-tool-worktree`](../packages/experimental/tool-worktree) | - | Explicit experimental creation from a pinned local commit. Existing write permissions govern checkout and shared Git metadata; the working-directory service owns the resulting Session directory. |
|
||||
| `ctx.workingDirectory` | `seam` | [`working-directory`](../packages/session/working-directory) | [`working-directory`](../packages/session/working-directory) | [`tool-working-directory`](../packages/session/tool-working-directory), [`tool-fs`](../packages/fs/tool-fs), [`tool-bash`](../packages/shell/tool-bash), [`tool-pwsh`](../packages/shell/tool-pwsh), [`subagent`](../packages/subagent/subagent), [`sdk-jsonrpc-server`](../packages/sdk/server) | - | One Session projection owns the effective execution directory. The filesystem validates changes; user context reports them while original metadata and write grants stay fixed. |
|
||||
| `ctx.mcpResources` | `seam` | [`mcp-resources`](../packages/mcp/mcp-resources) | [`mcp-client`](../packages/mcp/mcp-client) | [`mcp-resources`](../packages/mcp/mcp-resources) | - | Connection-owned providers serve shared resource tools in the calling agent scope. |
|
||||
|
||||
@@ -665,7 +665,7 @@ flowchart LR
|
||||
| `ctx.connection` | `core` | [`client-connection`](../packages/client/connection) | - | [`api-gateway`](../packages/api/gateway), [`host-frontend-static`](../packages/host/frontend-static) | - | 负责浏览器认证与共享 HTTP 请求分发;API 适配器注册端点和流。 |
|
||||
| `ctx.forge` | `seam` | [`experimental-forge`](../packages/experimental/forge) | [`experimental-forge-github`](../packages/experimental/forge-github) | [`experimental-forge-session`](../packages/experimental/forge-session), [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | 提供方映射远端与变更请求 URL、按 head 分支查找变更请求并批量读取状态;同一变更请求的监听方共享一个轮询循环。 |
|
||||
| `ctx.forgeSession` | `service` | [`experimental-forge-session`](../packages/experimental/forge-session) | - | [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | Session 投影从 shell 结果与绑定记录派生绑定,并把不含状态的 URL 发布给客户端;推送结果触发按 head 分支的发现,Session 监听方通过 forge 注册表轮询已绑定的变更请求。 |
|
||||
| `ctx.forgePanel` | `service` | [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | - | - | 为每个被跟随的 Session 推送一份面板状态:在 Session 沙箱中进行的只读 Git 检查、识别出的代码托管平台及其登录状态,以及带轮询状态的已绑定变更请求。 |
|
||||
| `ctx.forgePanel` | `service` | [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | - | - | 为每个被跟随的 Session 推送一份面板状态:使用 Session 权限进行的 Git 检查、识别出的代码托管平台及其登录状态,以及带轮询状态的已绑定变更请求。 |
|
||||
| `ctx.worktrees` | `seam` | [`experimental-worktree`](../packages/experimental/worktree) | [`experimental-worktree`](../packages/experimental/worktree) | [`experimental-tool-worktree`](../packages/experimental/tool-worktree) | - | 显式实验组合从固定的本地提交创建工作树。检出目录与共享 Git 元数据受现有写权限约束;工作目录服务拥有创建后的 Session 目录。 |
|
||||
| `ctx.workingDirectory` | `seam` | [`working-directory`](../packages/session/working-directory) | [`working-directory`](../packages/session/working-directory) | [`tool-working-directory`](../packages/session/tool-working-directory), [`tool-fs`](../packages/fs/tool-fs), [`tool-bash`](../packages/shell/tool-bash), [`tool-pwsh`](../packages/shell/tool-pwsh), [`subagent`](../packages/subagent/subagent), [`sdk-jsonrpc-server`](../packages/sdk/server) | - | 一个 Session 投影拥有有效执行目录。文件系统验证变更,用户上下文报告目录信息,原始元数据与写入授权保持不变。 |
|
||||
| `ctx.mcpResources` | `seam` | [`mcp-resources`](../packages/mcp/mcp-resources) | [`mcp-client`](../packages/mcp/mcp-client) | [`mcp-resources`](../packages/mcp/mcp-resources) | - | 连接所有者提供的操作在调用 agent 的作用域内服务于共享资源工具。 |
|
||||
|
||||
@@ -1126,7 +1126,7 @@ export type Config = CuaConfig
|
||||
|
||||
## `@deepseek-ai/dsh-experimental-forge`
|
||||
|
||||
- `source`: [`packages/experimental/forge/src/types.ts:230`](../packages/experimental/forge/src/types.ts)
|
||||
- `source`: [`packages/experimental/forge/src/types.ts:232`](../packages/experimental/forge/src/types.ts)
|
||||
|
||||
```ts config-catalog
|
||||
/** Poll cadence and fetch deadline for watched change requests. */
|
||||
@@ -1160,7 +1160,7 @@ export interface Config {
|
||||
hosts?: string[]
|
||||
/** Deadline in milliseconds for one `gh` invocation. */
|
||||
timeoutMs?: number
|
||||
/** Maximum captured bytes per `gh` output stream. */
|
||||
/** Maximum captured bytes per `gh` output stream and combined JSON bytes of one complete check read. */
|
||||
maxOutputBytes?: number
|
||||
}
|
||||
```
|
||||
@@ -4832,6 +4832,7 @@ These load from a `cordis.yml` entry with no `config:` block; they declare no co
|
||||
| `@deepseek-ai/dsh-client-ui-brand-official` | — | [`packages/client/ui-brand-official/src/index.ts`](../packages/client/ui-brand-official/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-chat` | — | [`packages/client/ui-chat/src/index.ts`](../packages/client/ui-chat/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-commands` | — | [`packages/client/ui-commands/src/index.ts`](../packages/client/ui-commands/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-context-menu` | — | [`packages/client/ui-context-menu/src/index.ts`](../packages/client/ui-context-menu/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-conversation` | — | [`packages/client/ui-conversation/src/index.ts`](../packages/client/ui-conversation/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-cordis` | — | [`packages/extensions/ui-cordis/src/index.ts`](../packages/extensions/ui-cordis/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-creation-recommendations` | — | [`packages/experimental/client-ui-creation-recommendations/src/index.ts`](../packages/experimental/client-ui-creation-recommendations/src/index.ts) |
|
||||
@@ -4839,6 +4840,7 @@ These load from a `cordis.yml` entry with no `config:` block; they declare no co
|
||||
| `@deepseek-ai/dsh-client-ui-directory-picker-browse` | — | [`packages/client/ui-directory-picker-browse/src/index.ts`](../packages/client/ui-directory-picker-browse/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-directory-picker-native` | — | [`packages/client/ui-directory-picker-native/src/index.ts`](../packages/client/ui-directory-picker-native/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-entry-customization` | — | [`packages/client/ui-entry-customization/src/index.ts`](../packages/client/ui-entry-customization/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-file-actions` | — | [`packages/client/ui-file-actions/src/index.ts`](../packages/client/ui-file-actions/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-file-drag` | — | [`packages/client/ui-file-drag/src/index.ts`](../packages/client/ui-file-drag/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-goal` | — | [`packages/client/ui-goal/src/index.ts`](../packages/client/ui-goal/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-input-trigger` | — | [`packages/client/ui-input-trigger/src/index.ts`](../packages/client/ui-input-trigger/src/index.ts) |
|
||||
|
||||
@@ -1128,7 +1128,7 @@ export type Config = CuaConfig
|
||||
|
||||
## `@deepseek-ai/dsh-experimental-forge`
|
||||
|
||||
- `source`: [`packages/experimental/forge/src/types.ts:230`](../packages/experimental/forge/src/types.ts)
|
||||
- `source`: [`packages/experimental/forge/src/types.ts:232`](../packages/experimental/forge/src/types.ts)
|
||||
|
||||
```ts config-catalog
|
||||
/** Poll cadence and fetch deadline for watched change requests. */
|
||||
@@ -1162,7 +1162,7 @@ export interface Config {
|
||||
hosts?: string[]
|
||||
/** Deadline in milliseconds for one `gh` invocation. */
|
||||
timeoutMs?: number
|
||||
/** Maximum captured bytes per `gh` output stream. */
|
||||
/** Maximum captured bytes per `gh` output stream and combined JSON bytes of one complete check read. */
|
||||
maxOutputBytes?: number
|
||||
}
|
||||
```
|
||||
@@ -4834,6 +4834,7 @@ export interface Config {
|
||||
| `@deepseek-ai/dsh-client-ui-brand-official` | — | [`packages/client/ui-brand-official/src/index.ts`](../packages/client/ui-brand-official/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-chat` | — | [`packages/client/ui-chat/src/index.ts`](../packages/client/ui-chat/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-commands` | — | [`packages/client/ui-commands/src/index.ts`](../packages/client/ui-commands/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-context-menu` | — | [`packages/client/ui-context-menu/src/index.ts`](../packages/client/ui-context-menu/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-conversation` | — | [`packages/client/ui-conversation/src/index.ts`](../packages/client/ui-conversation/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-cordis` | — | [`packages/extensions/ui-cordis/src/index.ts`](../packages/extensions/ui-cordis/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-creation-recommendations` | — | [`packages/experimental/client-ui-creation-recommendations/src/index.ts`](../packages/experimental/client-ui-creation-recommendations/src/index.ts) |
|
||||
@@ -4841,6 +4842,7 @@ export interface Config {
|
||||
| `@deepseek-ai/dsh-client-ui-directory-picker-browse` | — | [`packages/client/ui-directory-picker-browse/src/index.ts`](../packages/client/ui-directory-picker-browse/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-directory-picker-native` | — | [`packages/client/ui-directory-picker-native/src/index.ts`](../packages/client/ui-directory-picker-native/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-entry-customization` | — | [`packages/client/ui-entry-customization/src/index.ts`](../packages/client/ui-entry-customization/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-file-actions` | — | [`packages/client/ui-file-actions/src/index.ts`](../packages/client/ui-file-actions/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-file-drag` | — | [`packages/client/ui-file-drag/src/index.ts`](../packages/client/ui-file-drag/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-goal` | — | [`packages/client/ui-goal/src/index.ts`](../packages/client/ui-goal/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-input-trigger` | — | [`packages/client/ui-input-trigger/src/index.ts`](../packages/client/ui-input-trigger/src/index.ts) |
|
||||
|
||||
@@ -110,7 +110,7 @@ The root context of the application (every child context shares it). @experiment
|
||||
|
||||
```ts cordis-catalog
|
||||
/** Base URL used to resolve relative plugin/module specifiers, if the runtime sets one. */
|
||||
baseUrl?: string
|
||||
baseUrl?: string | undefined
|
||||
```
|
||||
|
||||
Base URL used to resolve relative plugin/module specifiers, if the runtime sets one.
|
||||
|
||||
@@ -112,7 +112,7 @@ root: this
|
||||
|
||||
```ts cordis-catalog
|
||||
/** Base URL used to resolve relative plugin/module specifiers, if the runtime sets one. */
|
||||
baseUrl?: string
|
||||
baseUrl?: string | undefined
|
||||
```
|
||||
|
||||
用于解析相对插件/模块说明符的基础 URL,前提是运行时设置了该值。
|
||||
|
||||
@@ -9,29 +9,29 @@
|
||||
en: 9d809e3de33dd783
|
||||
zh: b965aee4a65c6c1a
|
||||
/events/ctx-parallel-name-args:
|
||||
en: e583c71acb606915
|
||||
zh: 0560679b20f8d7f0
|
||||
en: 9c0a63f484e33428
|
||||
zh: 09ee4c26931324af
|
||||
/events/ctx-emit-name-args:
|
||||
en: ff6f4023b66f8164
|
||||
zh: af16d24d663a7eb7
|
||||
en: b41bd01cf219cbd6
|
||||
zh: 2e9660a05dc07cfc
|
||||
/events/ctx-serial-name-args:
|
||||
en: c431c0e3ac72e854
|
||||
zh: c43b7d899ea8161c
|
||||
en: 46708104f4d6a034
|
||||
zh: f1b7fcb92a5b05c0
|
||||
/events/ctx-bail-name-args:
|
||||
en: 85b8b2178c3e3c33
|
||||
zh: ad8af3e0743e231c
|
||||
en: 6577e113d5b8ce40
|
||||
zh: b925f8070cf387f7
|
||||
/events/ctx-waterfall-name-args:
|
||||
en: 3b32d0511b7da48b
|
||||
zh: e0ac62e59d8e2152
|
||||
en: 105fda32f60c7cea
|
||||
zh: c67e6c6051c9a1af
|
||||
/events/ctx-on-name-listener-options:
|
||||
en: 74a1fe55f4a47ec8
|
||||
zh: 87d37038af3bab0e
|
||||
en: ec7c7e8a8b15d460
|
||||
zh: 79eba67c31873b0b
|
||||
/events/ctx-once-name-listener-options:
|
||||
en: 64802f0580705984
|
||||
zh: 3f6ce2d7ce1e760d
|
||||
en: 27143e45f63622dd
|
||||
zh: 095f804dfa47ad37
|
||||
/events/eventoptions:
|
||||
en: 937453f689836c80
|
||||
zh: ebf0cc0f28127245
|
||||
en: 14ed1031e4a7abee
|
||||
zh: 2380e2f73f8931af
|
||||
/events/dispatchmode:
|
||||
en: 1c8548fb249ed794
|
||||
zh: 86b92a28f39b2a12
|
||||
en: 1081bbd7aa27baf8
|
||||
zh: cc4434892b0bb93f
|
||||
@@ -26,7 +26,7 @@ Dispatch an event, running all listeners concurrently.
|
||||
|
||||
**Returns** a promise resolving once every listener has settled.
|
||||
|
||||
[Source](../../vendor/cordis/src/events.ts#L44)
|
||||
[Source](../../vendor/cordis/src/events.ts#L43)
|
||||
|
||||
### ctx.emit(name, ...args)
|
||||
|
||||
@@ -46,7 +46,7 @@ Dispatch an event synchronously, ignoring listener return values.
|
||||
- `name` — the event name.
|
||||
- `args` — arguments passed to every listener.
|
||||
|
||||
[Source](../../vendor/cordis/src/events.ts#L53)
|
||||
[Source](../../vendor/cordis/src/events.ts#L52)
|
||||
|
||||
### ctx.serial(name, ...args)
|
||||
|
||||
@@ -69,7 +69,7 @@ Dispatch an event, awaiting listeners in order until one bails.
|
||||
|
||||
**Returns** the first bail value (non-null, non-false, non-undefined), if any.
|
||||
|
||||
[Source](../../vendor/cordis/src/events.ts#L63)
|
||||
[Source](../../vendor/cordis/src/events.ts#L62)
|
||||
|
||||
### ctx.bail(name, ...args)
|
||||
|
||||
@@ -92,7 +92,7 @@ Dispatch an event, calling listeners in order until one bails.
|
||||
|
||||
**Returns** the first bail value (non-null, non-false, non-undefined), if any.
|
||||
|
||||
[Source](../../vendor/cordis/src/events.ts#L73)
|
||||
[Source](../../vendor/cordis/src/events.ts#L72)
|
||||
|
||||
### ctx.waterfall(name, ...args)
|
||||
|
||||
@@ -120,7 +120,7 @@ Each listener wraps the rest of the chain: calling `next()` invokes the next lis
|
||||
|
||||
**Returns** the outermost listener's return value.
|
||||
|
||||
[Source](../../vendor/cordis/src/events.ts#L86)
|
||||
[Source](../../vendor/cordis/src/events.ts#L85)
|
||||
|
||||
### ctx.on(name, listener, options?)
|
||||
|
||||
@@ -144,7 +144,7 @@ Register an event listener owned by the current fiber.
|
||||
|
||||
**Returns** a disposer removing the listener; `true` if it was still registered.
|
||||
|
||||
[Source](../../vendor/cordis/src/events.ts#L97)
|
||||
[Source](../../vendor/cordis/src/events.ts#L96)
|
||||
|
||||
### ctx.once(name, listener, options?)
|
||||
|
||||
@@ -168,7 +168,7 @@ Same as `on()`, but the listener disposes itself after its first call.
|
||||
|
||||
**Returns** a disposer removing the listener; `true` if it was still registered.
|
||||
|
||||
[Source](../../vendor/cordis/src/events.ts#L106)
|
||||
[Source](../../vendor/cordis/src/events.ts#L105)
|
||||
|
||||
## EventOptions
|
||||
|
||||
@@ -184,7 +184,7 @@ interface EventOptions {
|
||||
}
|
||||
```
|
||||
|
||||
[Source](../../vendor/cordis/src/events.ts#L112)
|
||||
[Source](../../vendor/cordis/src/events.ts#L111)
|
||||
|
||||
## DispatchMode
|
||||
|
||||
@@ -204,4 +204,4 @@ Event dispatch strategy used by the event service.
|
||||
type DispatchMode = 'emit' | 'parallel' | 'serial' | 'bail' | 'waterfall'
|
||||
```
|
||||
|
||||
[Source](../../vendor/cordis/src/events.ts#L32)
|
||||
[Source](../../vendor/cordis/src/events.ts#L31)
|
||||
@@ -28,7 +28,7 @@ parallel<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K,
|
||||
|
||||
**返回值**:一个 Promise,在所有监听器均已完成后兑现。
|
||||
|
||||
[源码](../../vendor/cordis/src/events.ts#L44)
|
||||
[源码](../../vendor/cordis/src/events.ts#L43)
|
||||
|
||||
### ctx.emit(name, ...args)
|
||||
|
||||
@@ -48,7 +48,7 @@ emit<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, ...
|
||||
- `name`:事件名称。
|
||||
- `args`:传递给每个监听器的参数。
|
||||
|
||||
[源码](../../vendor/cordis/src/events.ts#L53)
|
||||
[源码](../../vendor/cordis/src/events.ts#L52)
|
||||
|
||||
### ctx.serial(name, ...args)
|
||||
|
||||
@@ -71,7 +71,7 @@ serial<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, .
|
||||
|
||||
**返回值**:第一个提前终止值(非 null、非 false 且非 undefined);如果没有,则不返回此类值。
|
||||
|
||||
[源码](../../vendor/cordis/src/events.ts#L63)
|
||||
[源码](../../vendor/cordis/src/events.ts#L62)
|
||||
|
||||
### ctx.bail(name, ...args)
|
||||
|
||||
@@ -94,7 +94,7 @@ bail<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, ...
|
||||
|
||||
**返回值**:第一个提前终止值(非 null、非 false 且非 undefined);如果没有,则不返回此类值。
|
||||
|
||||
[源码](../../vendor/cordis/src/events.ts#L73)
|
||||
[源码](../../vendor/cordis/src/events.ts#L72)
|
||||
|
||||
### ctx.waterfall(name, ...args)
|
||||
|
||||
@@ -122,7 +122,7 @@ waterfall<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K
|
||||
|
||||
**返回值**:最外层监听器的返回值。
|
||||
|
||||
[源码](../../vendor/cordis/src/events.ts#L86)
|
||||
[源码](../../vendor/cordis/src/events.ts#L85)
|
||||
|
||||
### ctx.on(name, listener, options?)
|
||||
|
||||
@@ -146,7 +146,7 @@ on<K extends keyof Events>(name: K, listener: Events[K], options?: boolean | Eve
|
||||
|
||||
**返回值**:一个用于移除监听器的资源释放函数;如果调用该函数时监听器仍处于注册状态,则返回 `true`。
|
||||
|
||||
[源码](../../vendor/cordis/src/events.ts#L97)
|
||||
[源码](../../vendor/cordis/src/events.ts#L96)
|
||||
|
||||
### ctx.once(name, listener, options?)
|
||||
|
||||
@@ -170,7 +170,7 @@ once<K extends keyof Events>(name: K, listener: Events[K], options?: boolean | E
|
||||
|
||||
**返回值**:一个用于移除监听器的资源释放函数;如果调用该函数时监听器仍处于注册状态,则返回 `true`。
|
||||
|
||||
[源码](../../vendor/cordis/src/events.ts#L106)
|
||||
[源码](../../vendor/cordis/src/events.ts#L105)
|
||||
|
||||
## EventOptions
|
||||
|
||||
@@ -186,7 +186,7 @@ interface EventOptions {
|
||||
}
|
||||
```
|
||||
|
||||
[源码](../../vendor/cordis/src/events.ts#L112)
|
||||
[源码](../../vendor/cordis/src/events.ts#L111)
|
||||
|
||||
## DispatchMode
|
||||
|
||||
@@ -206,4 +206,4 @@ interface EventOptions {
|
||||
type DispatchMode = 'emit' | 'parallel' | 'serial' | 'bail' | 'waterfall'
|
||||
```
|
||||
|
||||
[源码](../../vendor/cordis/src/events.ts#L32)
|
||||
[源码](../../vendor/cordis/src/events.ts#L31)
|
||||
@@ -9,14 +9,14 @@
|
||||
en: b5b3510f4b6dd13a
|
||||
zh: a0c70471b6d779b5
|
||||
/fiber/ctx-effect-execute-label:
|
||||
en: ef3418fd5ffbe86d
|
||||
zh: c98935435da8bc7e
|
||||
en: 38bab93cf931eec1
|
||||
zh: 50fed09622da4926
|
||||
/fiber/ctx-fiber:
|
||||
en: a10e38bf26b4ecfe
|
||||
zh: 7c91817984c95c99
|
||||
/fiber/the-fiber-class:
|
||||
en: 0e0fcb134ed44957
|
||||
zh: 326f4232aa0e65d1
|
||||
en: 31ca1205552db9ef
|
||||
zh: 5fa2e5b9a7396576
|
||||
/fiber/the-fiber-class/fiber-uid:
|
||||
en: 2f0eb3658bb8497e
|
||||
zh: 65d3c17ca8bd4f95
|
||||
@@ -24,50 +24,53 @@
|
||||
en: 1b527d85759324f9
|
||||
zh: 54aa40db2705b95c
|
||||
/fiber/the-fiber-class/fiber-config:
|
||||
en: 1efe137a7ef0e599
|
||||
zh: bb4b9818fb48f4e9
|
||||
en: 73b05dc38761b681
|
||||
zh: d663668f3e8fd33f
|
||||
/fiber/the-fiber-class/fiber-state:
|
||||
en: 999ad29dfc29661b
|
||||
zh: 20245d11c338e3f1
|
||||
en: eda419fecddc4dc8
|
||||
zh: 1a1b90f405cf3cbc
|
||||
/fiber/the-fiber-class/fiber-dispose:
|
||||
en: 29e304d183eb9104
|
||||
zh: 9ac5023f518e06c4
|
||||
/fiber/the-fiber-class/fiber-store:
|
||||
en: c4185e5d051136a2
|
||||
zh: 5714d9e4f5461ca3
|
||||
en: 43f4ad79a728a492
|
||||
zh: 71b216695d0afb22
|
||||
/fiber/the-fiber-class/fiber-committed:
|
||||
en: 0485c9d782bf90da
|
||||
zh: 74304cd05e9c0796
|
||||
/fiber/the-fiber-class/fiber-provisions:
|
||||
en: 1cf8235d0ca54124
|
||||
zh: 3d2e39064853165f
|
||||
/fiber/the-fiber-class/fiber-inertia:
|
||||
en: 2a3b1d3bc37bf986
|
||||
zh: 83bd257ee685d38b
|
||||
/fiber/the-fiber-class/fiber-name:
|
||||
en: e5c2ecca13167a32
|
||||
zh: 284a461f0f1cd35b
|
||||
en: cdc0677ce1d83361
|
||||
zh: a58305521a0626de
|
||||
/fiber/the-fiber-class/fiber-assertactive:
|
||||
en: cceb503899634d09
|
||||
zh: a8381af1a23436f3
|
||||
en: 0c3e8008ff2d69e2
|
||||
zh: 7b454626d3e3a3b6
|
||||
/fiber/the-fiber-class/fiber-effect-execute-label:
|
||||
en: 55dcfacf295bbcf2
|
||||
zh: 6e3ec27bb8da5a3d
|
||||
en: 0e905aa798ce3830
|
||||
zh: bbd0b0c537097d37
|
||||
/fiber/the-fiber-class/fiber-geteffects:
|
||||
en: 4d739a9c186fd9c2
|
||||
zh: f80fd3b87e79b004
|
||||
en: 729a1000bda8ee36
|
||||
zh: 5bfc19df3addab80
|
||||
/fiber/the-fiber-class/fiber-rawconfig:
|
||||
en: 898aab51825bd8c3
|
||||
zh: b9ab6339574002df
|
||||
en: 80d4007e42bd8b47
|
||||
zh: 14c11dc09c6402ce
|
||||
/fiber/the-fiber-class/fiber-effectiveconfig:
|
||||
en: 93ac680251e7023f
|
||||
zh: 8ea7d7de5db39b8e
|
||||
en: 8e9fcdcf458c8bde
|
||||
zh: 36d21cafbf4f0198
|
||||
/fiber/the-fiber-class/fiber-resolveconfig-config:
|
||||
en: d7319852e2a1c3a9
|
||||
zh: 3300fac049227006
|
||||
en: f8a9ca27b288bd4c
|
||||
zh: 03ce360b5200fbdb
|
||||
/fiber/the-fiber-class/fiber-await:
|
||||
en: c9a6544cacdbc28e
|
||||
zh: 636bf93efad95bc9
|
||||
en: 3f228c1861466386
|
||||
zh: 43b3f3acfc3d314b
|
||||
/fiber/the-fiber-class/fiber-restart:
|
||||
en: 6ffc1baba98d689f
|
||||
zh: 7e13bc92225c7e0a
|
||||
en: 152116f669f52e95
|
||||
zh: 11d3cd941ce32d88
|
||||
/fiber/the-fiber-class/fiber-update-config-nosave:
|
||||
en: 5c176a6e67073e92
|
||||
zh: ee07edc8dbf7c1f3
|
||||
en: a4f711258eb70e47
|
||||
zh: fff4d880d820de10
|
||||
/fiber/effect:
|
||||
en: 007d5b214e8a8610
|
||||
zh: d74c26fbb1b8aeb6
|
||||
|
||||
+45
-39
@@ -34,7 +34,7 @@ Register a cleanup-aware effect on this fiber.
|
||||
|
||||
**Returns** a disposer that tears the effect down and settles once done.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L415)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L421)
|
||||
|
||||
### ctx.fiber
|
||||
|
||||
@@ -51,7 +51,7 @@ The fiber (plugin runtime instance) that owns this context.
|
||||
|
||||
Runtime instance of one plugin application.
|
||||
|
||||
A fiber tracks dependency state, validated config, lifecycle effects, and cleanup for the plugin context returned by `ctx.plugin()`.
|
||||
A fiber tracks dependency state, raw and effective config, lifecycle effects, and cleanup for the plugin context returned by `ctx.plugin()`.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L184)
|
||||
|
||||
@@ -80,11 +80,11 @@ The context this fiber's plugin runs in (extends the parent context).
|
||||
### fiber.config
|
||||
|
||||
```ts cordis-catalog
|
||||
/** The validated plugin config (updated by `update()`); read through {@link effectiveConfig}. */
|
||||
/** Raw plugin input retained for the next activation. */
|
||||
public config: any
|
||||
```
|
||||
|
||||
The validated plugin config (updated by `update()`); read through effectiveConfig.
|
||||
Raw plugin input retained for the next activation.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L190)
|
||||
|
||||
@@ -97,7 +97,7 @@ public state
|
||||
|
||||
Current lifecycle state; transitions emit `internal/status`.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L194)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L192)
|
||||
|
||||
### fiber.dispose
|
||||
|
||||
@@ -108,16 +108,27 @@ public readonly dispose: () => Promise<void>
|
||||
|
||||
Dispose this fiber: unload the plugin, then settle once cleanup finished.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L196)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L194)
|
||||
|
||||
### fiber.store
|
||||
### fiber.committed
|
||||
|
||||
```ts cordis-catalog
|
||||
/** Snapshot of required service implementations while loaded; `undefined` otherwise. */
|
||||
public store: Dict<Impl> | undefined
|
||||
/** Required implementations retained through dependent teardown. */
|
||||
public committed: Readonly<Dict<Impl>> | undefined
|
||||
```
|
||||
|
||||
Snapshot of required service implementations while loaded; `undefined` otherwise.
|
||||
Required implementations retained through dependent teardown.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L196)
|
||||
|
||||
### fiber.provisions
|
||||
|
||||
```ts cordis-catalog
|
||||
/** Service implementations owned by this fiber, including isolated provisions. */
|
||||
public readonly provisions: Set<Impl>
|
||||
```
|
||||
|
||||
Service implementations owned by this fiber, including isolated provisions.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L198)
|
||||
|
||||
@@ -141,7 +152,7 @@ get name()
|
||||
|
||||
The plugin's display name, inherited from the nearest named ancestor, else `'root'`.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L336)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L342)
|
||||
|
||||
### fiber.assertActive()
|
||||
|
||||
@@ -159,7 +170,7 @@ Throw if the fiber has already been disposed.
|
||||
|
||||
**Returns** nothing when the fiber is still active.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L351)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L357)
|
||||
|
||||
### fiber.effect(execute, label?)
|
||||
|
||||
@@ -190,7 +201,7 @@ Register a cleanup-aware effect on this fiber.
|
||||
|
||||
**Returns** a disposer that tears the effect down and settles once done.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L415)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L421)
|
||||
|
||||
### fiber.getEffects()
|
||||
|
||||
@@ -207,7 +218,7 @@ Return metadata for currently registered effects.
|
||||
|
||||
**Returns** one `EffectMeta` tree per labeled live effect.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L568)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L574)
|
||||
|
||||
### fiber.rawConfig
|
||||
|
||||
@@ -218,21 +229,22 @@ get rawConfig(): unknown
|
||||
|
||||
Raw input retained for the next activation, without evaluating expressions or validating it.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L642)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L649)
|
||||
|
||||
### fiber.effectiveConfig
|
||||
|
||||
```ts cordis-catalog
|
||||
/**
|
||||
* The config object published by the existing activation/update lifecycle, without cloning or re-parsing.
|
||||
* It is undefined before the first resolution and remains readable after unload; callers requiring a live instance check `state`.
|
||||
* The object passed to plugin activation or the latest successful update that retained the instance.
|
||||
* Candidate resolution does not publish it; volatile updates retain its references.
|
||||
* Undefined before activation and readable after unload; callers requiring a live instance check `state`.
|
||||
*/
|
||||
get effectiveConfig(): unknown
|
||||
```
|
||||
|
||||
The config object published by the existing activation/update lifecycle, without cloning or re-parsing. It is undefined before the first resolution and remains readable after unload; callers requiring a live instance check `state`.
|
||||
The object passed to plugin activation or the latest successful update that retained the instance. Candidate resolution does not publish it; volatile updates retain its references. Undefined before activation and readable after unload; callers requiring a live instance check `state`.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L655)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L664)
|
||||
|
||||
### fiber.resolveConfig(config)
|
||||
|
||||
@@ -254,7 +266,7 @@ Evaluate and validate a candidate using this fiber's `internal/config` hooks and
|
||||
|
||||
**Returns** The candidate's resolved config, retaining the schema's result identity.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L667)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L676)
|
||||
|
||||
### fiber.await()
|
||||
|
||||
@@ -272,7 +284,7 @@ Wait for current lifecycle work and rethrow startup errors.
|
||||
|
||||
**Returns** this fiber, once it has settled into a stable state.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L731)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L754)
|
||||
|
||||
### fiber.restart()
|
||||
|
||||
@@ -290,35 +302,29 @@ Dispose and immediately reload this plugin with its current config.
|
||||
|
||||
**Returns** a promise resolving once the reload settled.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L745)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L768)
|
||||
|
||||
### fiber.update(config, noSave?)
|
||||
|
||||
```ts cordis-catalog
|
||||
/**
|
||||
* Validate and apply new config, then restart the plugin.
|
||||
*
|
||||
* Runs the `internal/update` waterfall first, so update hooks (and HMR)
|
||||
* can veto or replace the restart.
|
||||
*
|
||||
* @param config — the new raw config; validated before anything restarts.
|
||||
* @param noSave — hint for persistence hooks not to write the change back.
|
||||
* @returns nothing; the restart runs behind the `internal/update` waterfall.
|
||||
* @throws {ValidationError} when the new config fails validation.
|
||||
* Resolve a candidate, retain its raw config and apply it through the update waterfall.
|
||||
* @param config Raw config; pending fibers defer resolution until activation.
|
||||
* @param noSave Suppress the persistence notification when true.
|
||||
* @returns The awaited update/restart result, or undefined when a synchronous listener handles it.
|
||||
* @throws {ValidationError} when an active fiber's candidate is invalid.
|
||||
*/
|
||||
update(config: any, noSave = false)
|
||||
update(config: any, noSave = false): Awaitable<void>
|
||||
```
|
||||
|
||||
Validate and apply new config, then restart the plugin.
|
||||
Resolve a candidate, retain its raw config and apply it through the update waterfall.
|
||||
|
||||
Runs the `internal/update` waterfall first, so update hooks (and HMR) can veto or replace the restart.
|
||||
- `config` — Raw config; pending fibers defer resolution until activation.
|
||||
- `noSave` — Suppress the persistence notification when true.
|
||||
|
||||
- `config` — the new raw config; validated before anything restarts.
|
||||
- `noSave` — hint for persistence hooks not to write the change back.
|
||||
**Returns** The awaited update/restart result, or undefined when a synchronous listener handles it.
|
||||
|
||||
**Returns** nothing; the restart runs behind the `internal/update` waterfall.
|
||||
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L764)
|
||||
[Source](../../vendor/cordis/src/fiber.ts#L783)
|
||||
|
||||
## Effect
|
||||
|
||||
|
||||
+47
-39
@@ -36,7 +36,7 @@ effect(execute: () => Effect, label?: string): AsyncDisposable<Promise<void>>
|
||||
|
||||
**返回**一个用于撤销该作用的清理函数,并在清理完成后结算。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L415)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L421)
|
||||
|
||||
### ctx.fiber
|
||||
|
||||
@@ -53,7 +53,7 @@ fiber: Fiber
|
||||
|
||||
单次插件应用的运行时实例。
|
||||
|
||||
fiber 会跟踪 `ctx.plugin()` 返回的插件上下文所对应的依赖状态、经过校验的配置、生命周期作用和清理操作。
|
||||
fiber 会跟踪 `ctx.plugin()` 返回的插件上下文所对应的依赖状态、原始配置与有效配置、生命周期作用和清理操作。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L184)
|
||||
|
||||
@@ -82,11 +82,11 @@ public readonly ctx: Context
|
||||
### fiber.config
|
||||
|
||||
```ts cordis-catalog
|
||||
/** The validated plugin config (updated by `update()`); read through {@link effectiveConfig}. */
|
||||
/** Raw plugin input retained for the next activation. */
|
||||
public config: any
|
||||
```
|
||||
|
||||
经过校验的插件配置(由 `update()` 更新);通过 `effectiveConfig` 读取。
|
||||
为下次激活保留的原始插件输入。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L190)
|
||||
|
||||
@@ -99,7 +99,7 @@ public state
|
||||
|
||||
当前生命周期状态;状态转换会发出 `internal/status`。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L194)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L192)
|
||||
|
||||
### fiber.dispose
|
||||
|
||||
@@ -110,16 +110,27 @@ public readonly dispose: () => Promise<void>
|
||||
|
||||
dispose 此 fiber:卸载插件,并在清理完成后结算。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L196)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L194)
|
||||
|
||||
### fiber.store
|
||||
### fiber.committed
|
||||
|
||||
```ts cordis-catalog
|
||||
/** Snapshot of required service implementations while loaded; `undefined` otherwise. */
|
||||
public store: Dict<Impl> | undefined
|
||||
/** Required implementations retained through dependent teardown. */
|
||||
public committed: Readonly<Dict<Impl>> | undefined
|
||||
```
|
||||
|
||||
加载期间所需服务实现的快照;其他情况下为 `undefined`。
|
||||
在依赖方清理完成前保留的所需服务实现。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L196)
|
||||
|
||||
### fiber.provisions
|
||||
|
||||
```ts cordis-catalog
|
||||
/** Service implementations owned by this fiber, including isolated provisions. */
|
||||
public readonly provisions: Set<Impl>
|
||||
```
|
||||
|
||||
此 fiber 拥有的服务实现,包括隔离域中的服务。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L198)
|
||||
|
||||
@@ -143,7 +154,7 @@ get name()
|
||||
|
||||
插件的显示名称,继承自最近的具名祖先;如果不存在,则为 `'root'`。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L336)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L342)
|
||||
|
||||
### fiber.assertActive()
|
||||
|
||||
@@ -161,7 +172,7 @@ assertActive()
|
||||
|
||||
**返回**:fiber 仍处于活动状态时不返回任何内容。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L351)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L357)
|
||||
|
||||
### fiber.effect(execute, label?)
|
||||
|
||||
@@ -192,7 +203,7 @@ effect(execute: () => Effect, label?: string): AsyncDisposable<Promise<void>>
|
||||
|
||||
**返回**一个用于撤销该作用的清理函数,并在清理完成后结算。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L415)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L421)
|
||||
|
||||
### fiber.getEffects()
|
||||
|
||||
@@ -209,7 +220,7 @@ getEffects()
|
||||
|
||||
**返回**:每个带标签的活动作用对应一棵 `EffectMeta` 树。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L568)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L574)
|
||||
|
||||
### fiber.rawConfig
|
||||
|
||||
@@ -218,23 +229,25 @@ getEffects()
|
||||
get rawConfig(): unknown
|
||||
```
|
||||
|
||||
|
||||
保留供下次激活使用的原始输入,不执行表达式求值或验证。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L642)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L649)
|
||||
|
||||
### fiber.effectiveConfig
|
||||
|
||||
```ts cordis-catalog
|
||||
/**
|
||||
* The config object published by the existing activation/update lifecycle, without cloning or re-parsing.
|
||||
* It is undefined before the first resolution and remains readable after unload; callers requiring a live instance check `state`.
|
||||
* The object passed to plugin activation or the latest successful update that retained the instance.
|
||||
* Candidate resolution does not publish it; volatile updates retain its references.
|
||||
* Undefined before activation and readable after unload; callers requiring a live instance check `state`.
|
||||
*/
|
||||
get effectiveConfig(): unknown
|
||||
```
|
||||
|
||||
既有激活/更新生命周期发布的配置对象,不克隆或重新解析。首次解析前为 undefined,卸载后仍可读取;需要运行实例的调用方应检查 `state`。
|
||||
传给插件激活过程或最近一次成功保留实例的更新的对象。候选配置求值不发布结果;volatile 更新保留其中的引用。激活前为 undefined,卸载后仍可读取;需要运行中实例的调用方还应检查 `state`。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L655)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L664)
|
||||
|
||||
### fiber.resolveConfig(config)
|
||||
|
||||
@@ -250,13 +263,14 @@ get effectiveConfig(): unknown
|
||||
resolveConfig(config: unknown): unknown
|
||||
```
|
||||
|
||||
|
||||
通过此 fiber 的 `internal/config` 钩子和运行时 schema 对候选值求值并验证。此操作不发布结果、不替换原始输入,也不提交运行中的 volatile 引用。钩子访问的注入服务必须已经可用。
|
||||
|
||||
- `config`:原始候选输入。
|
||||
|
||||
**返回**候选配置的解析结果,保留 schema 返回对象的身份。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L667)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L676)
|
||||
|
||||
### fiber.await()
|
||||
|
||||
@@ -274,7 +288,7 @@ async await()
|
||||
|
||||
**返回**:进入稳定状态后的此 fiber。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L731)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L754)
|
||||
|
||||
### fiber.restart()
|
||||
|
||||
@@ -292,35 +306,29 @@ dispose 此插件,并立即使用其当前配置重新加载。
|
||||
|
||||
**返回**一个在重新加载完成后兑现的 promise。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L745)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L768)
|
||||
|
||||
### fiber.update(config, noSave?)
|
||||
|
||||
```ts cordis-catalog
|
||||
/**
|
||||
* Validate and apply new config, then restart the plugin.
|
||||
*
|
||||
* Runs the `internal/update` waterfall first, so update hooks (and HMR)
|
||||
* can veto or replace the restart.
|
||||
*
|
||||
* @param config — the new raw config; validated before anything restarts.
|
||||
* @param noSave — hint for persistence hooks not to write the change back.
|
||||
* @returns nothing; the restart runs behind the `internal/update` waterfall.
|
||||
* @throws {ValidationError} when the new config fails validation.
|
||||
* Resolve a candidate, retain its raw config and apply it through the update waterfall.
|
||||
* @param config Raw config; pending fibers defer resolution until activation.
|
||||
* @param noSave Suppress the persistence notification when true.
|
||||
* @returns The awaited update/restart result, or undefined when a synchronous listener handles it.
|
||||
* @throws {ValidationError} when an active fiber's candidate is invalid.
|
||||
*/
|
||||
update(config: any, noSave = false)
|
||||
update(config: any, noSave = false): Awaitable<void>
|
||||
```
|
||||
|
||||
校验并应用新配置,然后重新启动插件。
|
||||
求值候选配置,保留原始输入,并通过更新 waterfall 应用结果。
|
||||
|
||||
首先运行 `internal/update` waterfall(瀑布式事件),因此更新钩子(以及 HMR(热模块替换))可以否决或取代重新启动操作。
|
||||
- `config` — 原始配置;pending fiber 将求值推迟到激活时。
|
||||
- `noSave` — 为 true 时不发出持久化通知。
|
||||
|
||||
- `config`:新的原始配置;在任何内容重新启动前进行校验。
|
||||
- `noSave`:提示持久化钩子不要写回此变更。
|
||||
**返回** 可等待的更新或重启结果;同步监听器处理更新时为 undefined。
|
||||
|
||||
**返回**无返回值;重启由 `internal/update` waterfall 执行。
|
||||
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L764)
|
||||
[源码](../../vendor/cordis/src/fiber.ts#L783)
|
||||
|
||||
## Effect
|
||||
|
||||
|
||||
@@ -21,15 +21,16 @@ This file is GENERATED from source (`scripts/gen-cordis-catalog.ts`) and verifie
|
||||
|
||||
## Inherited events (cordis core + loader/hmr/timer)
|
||||
|
||||
- `internal/plugin` — A plugin fiber was created. ([`vendor/cordis/src/events.ts:331`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/status` — A fiber changed lifecycle state. ([`vendor/cordis/src/events.ts:333`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/service` — Interception hook for a service binding (no core producer). ([`vendor/cordis/src/events.ts:341`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/update` — Waterfall: a fiber config update is being applied. ([`vendor/cordis/src/events.ts:343`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/config` — Waterfall: a fiber config is being resolved before validation. ([`vendor/cordis/src/events.ts:339`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/get` — Waterfall: a service is being read from the store. ([`vendor/cordis/src/events.ts:345`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/set` — Waterfall: a service is being written to the store. ([`vendor/cordis/src/events.ts:347`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/listener` — A listener was registered. ([`vendor/cordis/src/events.ts:349`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/dispatch` — An event is being dispatched to listeners. ([`vendor/cordis/src/events.ts:351`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/plugin` — A plugin fiber was created. ([`vendor/cordis/src/events.ts:337`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/status` — A fiber changed lifecycle state. ([`vendor/cordis/src/events.ts:339`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/service` — A service binding was refreshed in the matching isolation scope. ([`vendor/cordis/src/events.ts:341`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/update` — Waterfall: apply resolved config; omitting next() keeps the current instance. ([`vendor/cordis/src/events.ts:348`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/commit` — Persist raw config from a programmatic update unless noSave is set. ([`vendor/cordis/src/events.ts:355`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/config` — Waterfall: resolve a candidate after injections are active without publishing it. ([`vendor/cordis/src/events.ts:362`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/get` — Waterfall: a service is being read from the store. ([`vendor/cordis/src/events.ts:364`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/set` — Waterfall: a service is being written to the store. ([`vendor/cordis/src/events.ts:366`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/listener` — A listener was registered. ([`vendor/cordis/src/events.ts:368`](../../vendor/cordis/src/events.ts))
|
||||
- `internal/dispatch` — An event is being dispatched to listeners. ([`vendor/cordis/src/events.ts:370`](../../vendor/cordis/src/events.ts))
|
||||
- `exit` — The process is exiting on a signal. ([`vendor/loader/src/index.ts:25`](../../vendor/loader/src/index.ts))
|
||||
- `loader/config-update` — The loader config tree changed. ([`vendor/loader/src/index.ts:26`](../../vendor/loader/src/index.ts))
|
||||
- `loader/entry-init` — A config entry is being initialized. ([`vendor/loader/src/index.ts:27`](../../vendor/loader/src/index.ts))
|
||||
|
||||
@@ -59,11 +59,11 @@ Application listeners are outside this package matrix. Desktop Host subscribes t
|
||||
| `llm/models-updated` | `emit` | [`packages/llm/llm/src/types.ts:30`](../packages/llm/llm/src/types.ts) | [`llm-deepseek`](../packages/llm/llm-deepseek) (`emit`) | `remotes` |
|
||||
| `llm/stream` | `waterfall` | [`packages/llm/llm/src/index.ts:75`](../packages/llm/llm/src/index.ts) | [`llm`](../packages/llm/llm) (`waterfall`) | [`llm-replay`](../packages/test-support/llm-replay), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), [`session-title`](../packages/session/session-title) |
|
||||
| `permission-presets/catalog-changed` | `emit` | [`packages/interaction/permission-presets/src/types.ts:48`](../packages/interaction/permission-presets/src/types.ts) | [`permission-presets`](../packages/interaction/permission-presets) (`events.dispatch`) | `remotes` |
|
||||
| `plugin-manager/changed` | `emit` | [`packages/boot/plugin-manager/src/types.ts:427`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/install-log` | `emit` | [`packages/boot/plugin-manager/src/types.ts:433`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/install-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:440`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/operation` | `parallel` | [`packages/boot/plugin-manager/src/types.ts:419`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`parallel`) | - |
|
||||
| `plugin-manager/update-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:447`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/changed` | `emit` | [`packages/boot/plugin-manager/src/types.ts:432`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/install-log` | `emit` | [`packages/boot/plugin-manager/src/types.ts:438`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/install-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:445`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/operation` | `parallel` | [`packages/boot/plugin-manager/src/types.ts:424`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`parallel`) | - |
|
||||
| `plugin-manager/update-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:452`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-market/changed` | `emit` | [`packages/boot/plugin-market/src/types.ts:168`](../packages/boot/plugin-market/src/types.ts) | [`plugin-market`](../packages/boot/plugin-market) (`emit`) | `remotes` |
|
||||
| `schedule/changed` | `emit` | [`packages/schedule/schedule/src/types.ts:484`](../packages/schedule/schedule/src/types.ts) | [`schedule`](../packages/schedule/schedule) (`emit`) | `remotes` |
|
||||
| `schedule/resolve-agent` | `waterfall` | [`packages/schedule/schedule/src/index.ts:74`](../packages/schedule/schedule/src/index.ts) | [`schedule`](../packages/schedule/schedule) (`waterfall`) | `server` |
|
||||
@@ -104,14 +104,16 @@ Application listeners are outside this package matrix. Desktop Host subscribes t
|
||||
| Event string | Dispatchers | Listeners |
|
||||
| --- | --- | --- |
|
||||
| `agent/request` | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`compaction-basic`](../packages/compaction/compaction-basic) |
|
||||
| `connection/reset` | `gateway` (`emit`) | `terminal-controller`, `ui-settings` |
|
||||
| `internal/config` | - | [`llm-pi-ai`](../packages/llm/llm-pi-ai) |
|
||||
| `internal/dispatch` | - | [`terminal-bash`](../packages/terminal/terminal-bash) |
|
||||
| `internal/plugin` | - | `computer-use-cua-driver-native`, `inspector`, `loader`, [`lsp-stdio`](../packages/lsp/lsp-stdio), [`mcp-client`](../packages/mcp/mcp-client), `modules` |
|
||||
| `internal/service` | - | `client-ui-forge`, `gateway` |
|
||||
| `internal/status` | - | [`agent`](../packages/core/agent), `inspector`, `translator`, [`web`](../packages/web/web) |
|
||||
| `internal/update` | - | [`app-boot`](../packages/boot/app-boot) |
|
||||
| `internal/status` | - | [`agent`](../packages/core/agent), `claude-code-mods`, `inspector`, `translator`, [`web`](../packages/web/web) |
|
||||
| `loader/volatile-update` | - | [`llm-deepseek`](../packages/llm/llm-deepseek), [`llm-deepseek-api-key`](../packages/llm/llm-deepseek-api-key), [`llm-pi-ai`](../packages/llm/llm-pi-ai), [`plugin-market`](../packages/boot/plugin-market), `product-analytics`, `speech-to-text` |
|
||||
| `locale/change` | `locale` (`emit`) | `locale` |
|
||||
| `slots/changed` | `ui-renderer` (`emit`) | - |
|
||||
| `theme/change` | `ui-theme` (`emit`) | `ui-layout`, `ui-theme` |
|
||||
<!-- END GENERATED event-producer-consumer:undeclared -->
|
||||
|
||||
Maintenance mode: generated: Cordis event declarations and producer/listener edges are resolved from the repository TypeScript Program.
|
||||
@@ -61,11 +61,11 @@
|
||||
| `llm/models-updated` | `emit` | [`packages/llm/llm/src/types.ts:30`](../packages/llm/llm/src/types.ts) | [`llm-deepseek`](../packages/llm/llm-deepseek) (`emit`) | `remotes` |
|
||||
| `llm/stream` | `waterfall` | [`packages/llm/llm/src/index.ts:75`](../packages/llm/llm/src/index.ts) | [`llm`](../packages/llm/llm) (`waterfall`) | [`llm-replay`](../packages/test-support/llm-replay), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), [`session-title`](../packages/session/session-title) |
|
||||
| `permission-presets/catalog-changed` | `emit` | [`packages/interaction/permission-presets/src/types.ts:48`](../packages/interaction/permission-presets/src/types.ts) | [`permission-presets`](../packages/interaction/permission-presets) (`events.dispatch`) | `remotes` |
|
||||
| `plugin-manager/changed` | `emit` | [`packages/boot/plugin-manager/src/types.ts:427`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/install-log` | `emit` | [`packages/boot/plugin-manager/src/types.ts:433`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/install-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:440`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/operation` | `parallel` | [`packages/boot/plugin-manager/src/types.ts:419`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`parallel`) | - |
|
||||
| `plugin-manager/update-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:447`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/changed` | `emit` | [`packages/boot/plugin-manager/src/types.ts:432`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/install-log` | `emit` | [`packages/boot/plugin-manager/src/types.ts:438`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/install-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:445`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/operation` | `parallel` | [`packages/boot/plugin-manager/src/types.ts:424`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`parallel`) | - |
|
||||
| `plugin-manager/update-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:452`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-market/changed` | `emit` | [`packages/boot/plugin-market/src/types.ts:168`](../packages/boot/plugin-market/src/types.ts) | [`plugin-market`](../packages/boot/plugin-market) (`emit`) | `remotes` |
|
||||
| `schedule/changed` | `emit` | [`packages/schedule/schedule/src/types.ts:484`](../packages/schedule/schedule/src/types.ts) | [`schedule`](../packages/schedule/schedule) (`emit`) | `remotes` |
|
||||
| `schedule/resolve-agent` | `waterfall` | [`packages/schedule/schedule/src/index.ts:74`](../packages/schedule/schedule/src/index.ts) | [`schedule`](../packages/schedule/schedule) (`waterfall`) | `server` |
|
||||
@@ -106,14 +106,16 @@
|
||||
| Event string | Dispatchers | Listeners |
|
||||
| --- | --- | --- |
|
||||
| `agent/request` | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`compaction-basic`](../packages/compaction/compaction-basic) |
|
||||
| `connection/reset` | `gateway` (`emit`) | `terminal-controller`, `ui-settings` |
|
||||
| `internal/config` | - | [`llm-pi-ai`](../packages/llm/llm-pi-ai) |
|
||||
| `internal/dispatch` | - | [`terminal-bash`](../packages/terminal/terminal-bash) |
|
||||
| `internal/plugin` | - | `computer-use-cua-driver-native`, `inspector`, `loader`, [`lsp-stdio`](../packages/lsp/lsp-stdio), [`mcp-client`](../packages/mcp/mcp-client), `modules` |
|
||||
| `internal/service` | - | `client-ui-forge`, `gateway` |
|
||||
| `internal/status` | - | [`agent`](../packages/core/agent), `inspector`, `translator`, [`web`](../packages/web/web) |
|
||||
| `internal/update` | - | [`app-boot`](../packages/boot/app-boot) |
|
||||
| `internal/status` | - | [`agent`](../packages/core/agent), `claude-code-mods`, `inspector`, `translator`, [`web`](../packages/web/web) |
|
||||
| `loader/volatile-update` | - | [`llm-deepseek`](../packages/llm/llm-deepseek), [`llm-deepseek-api-key`](../packages/llm/llm-deepseek-api-key), [`llm-pi-ai`](../packages/llm/llm-pi-ai), [`plugin-market`](../packages/boot/plugin-market), `product-analytics`, `speech-to-text` |
|
||||
| `locale/change` | `locale` (`emit`) | `locale` |
|
||||
| `slots/changed` | `ui-renderer` (`emit`) | - |
|
||||
| `theme/change` | `ui-theme` (`emit`) | `ui-layout`, `ui-theme` |
|
||||
<!-- END GENERATED event-producer-consumer:undeclared -->
|
||||
|
||||
Maintenance mode: generated: Cordis event declarations and producer/listener edges are resolved from the repository TypeScript Program.
|
||||
@@ -165,12 +165,14 @@ flowchart TD
|
||||
pkg_client_ui_brand_official["client-ui-brand-official"]
|
||||
pkg_client_ui_chat["client-ui-chat"]
|
||||
pkg_client_ui_commands["client-ui-commands"]
|
||||
pkg_client_ui_context_menu["client-ui-context-menu"]
|
||||
pkg_client_ui_conversation["client-ui-conversation"]
|
||||
pkg_client_ui_deliverables["client-ui-deliverables"]
|
||||
pkg_client_ui_directory_picker_browse["client-ui-directory-picker-browse"]
|
||||
pkg_client_ui_directory_picker_native["client-ui-directory-picker-native"]
|
||||
pkg_client_ui_dockkit["client-ui-dockkit"]
|
||||
pkg_client_ui_entry_customization["client-ui-entry-customization"]
|
||||
pkg_client_ui_file_actions["client-ui-file-actions"]
|
||||
pkg_client_ui_file_drag["client-ui-file-drag"]
|
||||
pkg_client_ui_goal["client-ui-goal"]
|
||||
pkg_client_ui_input_trigger["client-ui-input-trigger"]
|
||||
@@ -1461,6 +1463,7 @@ flowchart TD
|
||||
pkg_client_test_runtime --> pkg_client_modules
|
||||
pkg_client_test_runtime --> pkg_client_store
|
||||
pkg_client_test_runtime --> pkg_client_ui_chat
|
||||
pkg_client_test_runtime --> pkg_client_ui_context_menu
|
||||
pkg_client_test_runtime --> pkg_client_ui_conversation
|
||||
pkg_client_test_runtime --> pkg_client_ui_renderer
|
||||
pkg_client_test_runtime --> pkg_client_ui_session
|
||||
@@ -1545,12 +1548,14 @@ flowchart TD
|
||||
| [`client-ui-brand-official`](../packages/client/ui-brand-official) | `client` | — |
|
||||
| [`client-ui-chat`](../packages/client/ui-chat) | `client` | — |
|
||||
| [`client-ui-commands`](../packages/client/ui-commands) | `client` | — |
|
||||
| [`client-ui-context-menu`](../packages/client/ui-context-menu) | `client` | — |
|
||||
| [`client-ui-conversation`](../packages/client/ui-conversation) | `client` | — |
|
||||
| [`client-ui-deliverables`](../packages/client/ui-deliverables) | `client` | — |
|
||||
| [`client-ui-directory-picker-browse`](../packages/client/ui-directory-picker-browse) | `client` | — |
|
||||
| [`client-ui-directory-picker-native`](../packages/client/ui-directory-picker-native) | `client` | — |
|
||||
| [`client-ui-dockkit`](../packages/client/ui-dockkit) | `client` | — |
|
||||
| [`client-ui-entry-customization`](../packages/client/ui-entry-customization) | `client` | — |
|
||||
| [`client-ui-file-actions`](../packages/client/ui-file-actions) | `client` | — |
|
||||
| [`client-ui-file-drag`](../packages/client/ui-file-drag) | `client` | — |
|
||||
| [`client-ui-goal`](../packages/client/ui-goal) | `client` | — |
|
||||
| [`client-ui-input-trigger`](../packages/client/ui-input-trigger) | `client` | — |
|
||||
@@ -1863,7 +1868,7 @@ flowchart TD
|
||||
| [`experimental-tool-agent-team`](../packages/experimental/tool-agent-team) | `experimental` | [`agent`](../packages/core/agent), [`experimental-agent-team`](../packages/experimental/agent-team), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
|
||||
| [`schedule`](../packages/schedule/schedule) | `schedule` | [`agent`](../packages/core/agent), [`api-session-controller`](../packages/api/session-controller), [`brand`](../packages/util/brand), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`storage-domain`](../packages/storage/storage-domain), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`util-time`](../packages/util/time), [`workspace`](../packages/workspace/workspace) |
|
||||
| [`sdk-client`](../packages/sdk/client) | `sdk` | [`llm`](../packages/llm/llm), [`sdk-protocol`](../packages/sdk/protocol), [`session`](../packages/core/session) |
|
||||
| [`client-test-runtime`](../packages/test-support/client-runtime) | `test-support` | [`api-gateway`](../packages/api/gateway), [`api-session-controller`](../packages/api/session-controller), [`api-workspace-controller`](../packages/api/workspace-controller), [`attachment`](../packages/attachment/attachment), [`client-connection`](../packages/client/connection), [`client-hmr`](../packages/client/hmr), [`client-modules`](../packages/client/modules), [`client-store`](../packages/client/store), [`client-ui-chat`](../packages/client/ui-chat), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-renderer`](../packages/client/ui-renderer), [`client-ui-session`](../packages/client/ui-session), [`client-ui-settings`](../packages/client/ui-settings), [`client-ui-slots`](../packages/client/ui-slots), [`client-web`](../packages/client/web), [`remote-mock`](../packages/test-support/remote-mock), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`typert-protocol`](../packages/typert/protocol) |
|
||||
| [`client-test-runtime`](../packages/test-support/client-runtime) | `test-support` | [`api-gateway`](../packages/api/gateway), [`api-session-controller`](../packages/api/session-controller), [`api-workspace-controller`](../packages/api/workspace-controller), [`attachment`](../packages/attachment/attachment), [`client-connection`](../packages/client/connection), [`client-hmr`](../packages/client/hmr), [`client-modules`](../packages/client/modules), [`client-store`](../packages/client/store), [`client-ui-chat`](../packages/client/ui-chat), [`client-ui-context-menu`](../packages/client/ui-context-menu), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-renderer`](../packages/client/ui-renderer), [`client-ui-session`](../packages/client/ui-session), [`client-ui-settings`](../packages/client/ui-settings), [`client-ui-slots`](../packages/client/ui-slots), [`client-web`](../packages/client/web), [`remote-mock`](../packages/test-support/remote-mock), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`typert-protocol`](../packages/typert/protocol) |
|
||||
| [`subagent-dsh-sdk`](../packages/subagent/subagent-dsh-sdk) | `subagent` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`sdk-client`](../packages/sdk/client), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`subprocess`](../packages/subprocess/subprocess) |
|
||||
| [`tool-schedule`](../packages/schedule/tool-schedule) | `schedule` | [`llm`](../packages/llm/llm), [`schedule`](../packages/schedule/schedule), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools) |
|
||||
| [`sdk-jsonrpc-server`](../packages/sdk/server) | `sdk` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`llm`](../packages/llm/llm), [`llm-deepseek-api-key`](../packages/llm/llm-deepseek-api-key), [`schedule`](../packages/schedule/schedule), [`scope`](../packages/core/scope), [`sdk-protocol`](../packages/sdk/protocol), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`user-approval`](../packages/interaction/user-approval), [`user-questions`](../packages/interaction/user-questions), [`working-directory`](../packages/session/working-directory) |
|
||||
|
||||
@@ -167,12 +167,14 @@ flowchart TD
|
||||
pkg_client_ui_brand_official["client-ui-brand-official"]
|
||||
pkg_client_ui_chat["client-ui-chat"]
|
||||
pkg_client_ui_commands["client-ui-commands"]
|
||||
pkg_client_ui_context_menu["client-ui-context-menu"]
|
||||
pkg_client_ui_conversation["client-ui-conversation"]
|
||||
pkg_client_ui_deliverables["client-ui-deliverables"]
|
||||
pkg_client_ui_directory_picker_browse["client-ui-directory-picker-browse"]
|
||||
pkg_client_ui_directory_picker_native["client-ui-directory-picker-native"]
|
||||
pkg_client_ui_dockkit["client-ui-dockkit"]
|
||||
pkg_client_ui_entry_customization["client-ui-entry-customization"]
|
||||
pkg_client_ui_file_actions["client-ui-file-actions"]
|
||||
pkg_client_ui_file_drag["client-ui-file-drag"]
|
||||
pkg_client_ui_goal["client-ui-goal"]
|
||||
pkg_client_ui_input_trigger["client-ui-input-trigger"]
|
||||
@@ -1463,6 +1465,7 @@ flowchart TD
|
||||
pkg_client_test_runtime --> pkg_client_modules
|
||||
pkg_client_test_runtime --> pkg_client_store
|
||||
pkg_client_test_runtime --> pkg_client_ui_chat
|
||||
pkg_client_test_runtime --> pkg_client_ui_context_menu
|
||||
pkg_client_test_runtime --> pkg_client_ui_conversation
|
||||
pkg_client_test_runtime --> pkg_client_ui_renderer
|
||||
pkg_client_test_runtime --> pkg_client_ui_session
|
||||
@@ -1547,12 +1550,14 @@ flowchart TD
|
||||
| [`client-ui-brand-official`](../packages/client/ui-brand-official) | `client` | — |
|
||||
| [`client-ui-chat`](../packages/client/ui-chat) | `client` | — |
|
||||
| [`client-ui-commands`](../packages/client/ui-commands) | `client` | — |
|
||||
| [`client-ui-context-menu`](../packages/client/ui-context-menu) | `client` | — |
|
||||
| [`client-ui-conversation`](../packages/client/ui-conversation) | `client` | — |
|
||||
| [`client-ui-deliverables`](../packages/client/ui-deliverables) | `client` | — |
|
||||
| [`client-ui-directory-picker-browse`](../packages/client/ui-directory-picker-browse) | `client` | — |
|
||||
| [`client-ui-directory-picker-native`](../packages/client/ui-directory-picker-native) | `client` | — |
|
||||
| [`client-ui-dockkit`](../packages/client/ui-dockkit) | `client` | — |
|
||||
| [`client-ui-entry-customization`](../packages/client/ui-entry-customization) | `client` | — |
|
||||
| [`client-ui-file-actions`](../packages/client/ui-file-actions) | `client` | — |
|
||||
| [`client-ui-file-drag`](../packages/client/ui-file-drag) | `client` | — |
|
||||
| [`client-ui-goal`](../packages/client/ui-goal) | `client` | — |
|
||||
| [`client-ui-input-trigger`](../packages/client/ui-input-trigger) | `client` | — |
|
||||
@@ -1865,7 +1870,7 @@ flowchart TD
|
||||
| [`experimental-tool-agent-team`](../packages/experimental/tool-agent-team) | `experimental` | [`agent`](../packages/core/agent), [`experimental-agent-team`](../packages/experimental/agent-team), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
|
||||
| [`schedule`](../packages/schedule/schedule) | `schedule` | [`agent`](../packages/core/agent), [`api-session-controller`](../packages/api/session-controller), [`brand`](../packages/util/brand), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`storage-domain`](../packages/storage/storage-domain), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`util-time`](../packages/util/time), [`workspace`](../packages/workspace/workspace) |
|
||||
| [`sdk-client`](../packages/sdk/client) | `sdk` | [`llm`](../packages/llm/llm), [`sdk-protocol`](../packages/sdk/protocol), [`session`](../packages/core/session) |
|
||||
| [`client-test-runtime`](../packages/test-support/client-runtime) | `test-support` | [`api-gateway`](../packages/api/gateway), [`api-session-controller`](../packages/api/session-controller), [`api-workspace-controller`](../packages/api/workspace-controller), [`attachment`](../packages/attachment/attachment), [`client-connection`](../packages/client/connection), [`client-hmr`](../packages/client/hmr), [`client-modules`](../packages/client/modules), [`client-store`](../packages/client/store), [`client-ui-chat`](../packages/client/ui-chat), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-renderer`](../packages/client/ui-renderer), [`client-ui-session`](../packages/client/ui-session), [`client-ui-settings`](../packages/client/ui-settings), [`client-ui-slots`](../packages/client/ui-slots), [`client-web`](../packages/client/web), [`remote-mock`](../packages/test-support/remote-mock), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`typert-protocol`](../packages/typert/protocol) |
|
||||
| [`client-test-runtime`](../packages/test-support/client-runtime) | `test-support` | [`api-gateway`](../packages/api/gateway), [`api-session-controller`](../packages/api/session-controller), [`api-workspace-controller`](../packages/api/workspace-controller), [`attachment`](../packages/attachment/attachment), [`client-connection`](../packages/client/connection), [`client-hmr`](../packages/client/hmr), [`client-modules`](../packages/client/modules), [`client-store`](../packages/client/store), [`client-ui-chat`](../packages/client/ui-chat), [`client-ui-context-menu`](../packages/client/ui-context-menu), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-renderer`](../packages/client/ui-renderer), [`client-ui-session`](../packages/client/ui-session), [`client-ui-settings`](../packages/client/ui-settings), [`client-ui-slots`](../packages/client/ui-slots), [`client-web`](../packages/client/web), [`remote-mock`](../packages/test-support/remote-mock), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`typert-protocol`](../packages/typert/protocol) |
|
||||
| [`subagent-dsh-sdk`](../packages/subagent/subagent-dsh-sdk) | `subagent` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`sdk-client`](../packages/sdk/client), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`subprocess`](../packages/subprocess/subprocess) |
|
||||
| [`tool-schedule`](../packages/schedule/tool-schedule) | `schedule` | [`llm`](../packages/llm/llm), [`schedule`](../packages/schedule/schedule), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools) |
|
||||
| [`sdk-jsonrpc-server`](../packages/sdk/server) | `sdk` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`llm`](../packages/llm/llm), [`llm-deepseek-api-key`](../packages/llm/llm-deepseek-api-key), [`schedule`](../packages/schedule/schedule), [`scope`](../packages/core/scope), [`sdk-protocol`](../packages/sdk/protocol), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`user-approval`](../packages/interaction/user-approval), [`user-questions`](../packages/interaction/user-questions), [`working-directory`](../packages/session/working-directory) |
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
en: c8aa4d3384ea1306
|
||||
zh: 5aa030587d5b634d
|
||||
/vendored-package-rescope/name-mapping:
|
||||
en: cc0f91dc4bb82605
|
||||
zh: 81d5031752c6ea74
|
||||
en: 239fa7993825ac62
|
||||
zh: df35fa9f5ef42a05
|
||||
/vendored-package-rescope/what-the-rename-does-not-touch:
|
||||
en: 9bb7d09f8cccf695
|
||||
zh: 2a8f3f60ae5116f3
|
||||
|
||||
Loaded 100 of 605 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user