mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-10-26 16:55:08 +00:00
Merge pull request #5435 from deepseek-harness/ux/plugin-guide-package-only
refine(web): 精简插件安装引导并补充插件升级说明
This commit is contained in:
commit
31ed8ec4c4
12 files changed
+55
-71
No files matched your search
@@ -56,8 +56,12 @@ it('keeps settings and expanded plugin dialogs clear of the Windows caption acro
|
||||
for (const fullscreen of [false, true, false]) {
|
||||
await page.evaluate(value => document.documentElement.toggleAttribute('data-fullscreen', value), fullscreen)
|
||||
const margin = fullscreen ? 24 : 60
|
||||
await expect.poll(async () => (await plugin.boundingBox())?.y).toBe(margin)
|
||||
expect((await plugin.boundingBox())?.height).toBe(600 - 2 * margin)
|
||||
// The dialog is content-sized: it fills the available height only while its content needs it,
|
||||
// and otherwise stays centered inside the same clearances.
|
||||
await expect.poll(async () => {
|
||||
const box = await plugin.boundingBox()
|
||||
return box !== null && box.y >= margin && box.y + box.height <= 600 - margin
|
||||
}, { timeout: 5_000 }).toBe(true)
|
||||
expect((await plugin.locator('..').locator(':scope > [aria-hidden="true"]').boundingBox())?.y).toBe(fullscreen ? 0 : 40)
|
||||
expect(await plugin.getByRole('button', { name: '关闭', exact: true }).isVisible()).toBe(true)
|
||||
expect(await plugin.getByRole('button', { name: '安装', exact: true }).isVisible()).toBe(true)
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
- text: slow-package
|
||||
- button "插件安装引导和示例"
|
||||
- button "安装源 默认安装源"
|
||||
- note: 请确认插件来源可信。插件在本机以你的权限运行,来源不明的插件可能损坏 DeepSeek Harness,或读取和泄露你的数据。
|
||||
- note: 请确认插件来源可信。插件在本机以你的权限运行,来源不明的插件可能损坏 DeepSeek Harness,或读取和泄露你的数据。 插件安装后,暂不支持自动更新。若需升级,请先卸载再安装新版,后续版本会持续改善升级体验。
|
||||
- button "安装"
|
||||
@@ -7,16 +7,8 @@
|
||||
- button "安装源 中国大陆镜像源"
|
||||
- list:
|
||||
- listitem:
|
||||
- text: 包名 插件包名即 npm 包名(如 dsh-xxx 或 @作者/插件名),社区插件的 README 安装命令中 dsh plugin add 或 pnpm add 之后的部分。 示例:
|
||||
- text: 填入插件 npm 包名 插件包名即 npm 包名(如 dsh-xxx 或 @作者/插件名),社区插件的 README 安装命令中 dsh plugin add 或 pnpm add 之后的部分。 示例:
|
||||
- code: dsh-plugin-whale-pet
|
||||
- button "填入示例 dsh-plugin-whale-pet": 填入示例
|
||||
- listitem:
|
||||
- text: GitHub 仓库地址 插件在 GitHub 上的开源仓库地址,也支持其他 Git 仓库。 示例:
|
||||
- code: https://github.com/author/dsh-plugin
|
||||
- button "填入示例 https://github.com/author/dsh-plugin": 填入示例
|
||||
- listitem:
|
||||
- text: 本地插件目录 本机上插件目录的绝对路径,适用于自行开发或已下载的插件。 示例:
|
||||
- code: /Users/name/my-plugin
|
||||
- button "填入示例 /Users/name/my-plugin": 填入示例
|
||||
- note: 请确认插件来源可信。插件在本机以你的权限运行,来源不明的插件可能损坏 DeepSeek Harness,或读取和泄露你的数据。
|
||||
- note: 请确认插件来源可信。插件在本机以你的权限运行,来源不明的插件可能损坏 DeepSeek Harness,或读取和泄露你的数据。 插件安装后,暂不支持自动更新。若需升级,请先卸载再安装新版,后续版本会持续改善升级体验。
|
||||
- button "安装" [disabled]
|
||||
@@ -5,5 +5,5 @@
|
||||
- /placeholder: 例如 dsh-plugin-whale-pet
|
||||
- button "插件安装引导和示例"
|
||||
- button "安装源 中国大陆镜像源"
|
||||
- note: 请确认插件来源可信。插件在本机以你的权限运行,来源不明的插件可能损坏 DeepSeek Harness,或读取和泄露你的数据。
|
||||
- note: 请确认插件来源可信。插件在本机以你的权限运行,来源不明的插件可能损坏 DeepSeek Harness,或读取和泄露你的数据。 插件安装后,暂不支持自动更新。若需升级,请先卸载再安装新版,后续版本会持续改善升级体验。
|
||||
- button "安装" [disabled]
|
||||
@@ -835,13 +835,18 @@ describe('web e2e: plugin manager', () => {
|
||||
const install = dialog.getByRole('button', { name: '安装', exact: true })
|
||||
expect(await install.isDisabled()).toBe(true)
|
||||
expect(await dialog.getByRole('note').textContent()).toContain('请确认插件来源可信')
|
||||
expect(await dialog.getByRole('note').textContent()).toContain('暂不支持自动更新')
|
||||
await dialog.getByRole('button', { name: '插件安装引导和示例' }).click()
|
||||
// The guide carries the package-name example only; the former template strings keep their replacement reminder.
|
||||
await expect.poll(() => dialog.getByRole('listitem').count()).toBe(1)
|
||||
await dialog.getByRole('button', { name: '填入示例 dsh-plugin-whale-pet' }).click()
|
||||
expect(await field.inputValue()).toBe('dsh-plugin-whale-pet')
|
||||
expect(await dialog.getByRole('status').count()).toBe(0)
|
||||
for (const [example, hint] of [
|
||||
['https://github.com/author/dsh-plugin', '请替换为实际的 Git 仓库地址'],
|
||||
['/Users/name/my-plugin', '请替换为本机插件目录的实际路径'],
|
||||
]) {
|
||||
await dialog.getByRole('button', { name: `填入示例 ${example}` }).click()
|
||||
expect(await field.inputValue()).toBe(example)
|
||||
] as const) {
|
||||
await field.fill(example)
|
||||
expect(await dialog.getByRole('status').textContent()).toBe(hint)
|
||||
}
|
||||
await field.fill('/actual/plugin-directory')
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
en: b7d2396da72ecac4
|
||||
zh: 4ec8336478dd39c7
|
||||
/deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/installing-a-bundle:
|
||||
en: 20e7310ab6867389
|
||||
zh: eed2957381abc0bd
|
||||
en: 7f4438da14f803bc
|
||||
zh: 1728231acbd25d49
|
||||
/deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/switching-a-bundle:
|
||||
en: abc90531efa889d5
|
||||
zh: 0562570f85e69c35
|
||||
|
||||
@@ -41,7 +41,7 @@ On first use, when pnpm uses the unconfigured official npm registry and npmmirro
|
||||
|
||||
The Host sends GET requests to `https://registry.npmjs.org/-/ping` and `https://registry.npmmirror.com/-/ping` through its normal fetch proxy. A 2xx response wins; redirects and failures do not. The remaining request is cancelled, both response bodies are discarded, and cleanup completes before the result returns. The default deadline is 1500 ms and results, including unavailable results, are cached for five minutes. Configure `registryProbeTimeoutMs` and `registryProbeCacheTtlMs` on `ui-plugin-manager`; `registryProbeEnabled: false` disables probing. If both requests fail or time out, the existing default remains selected. No IP-location service or Session content is involved.
|
||||
|
||||
**Add plugin** takes a package name with an optional version, a Git address, a tarball, or an absolute local path; the dialog says a package name is what follows `dsh plugin add` in a README. Enter in the package or custom-registry field submits the install request, but Enter used to confirm an input-method candidate does not. **Install guide and examples** under the field opens a guide that shows the three common forms with an example each; **Use example** drops one into the field. Git and local-path examples require the actual address or path; a hint appears while either example remains in the field. A trust warning stays above **Install**, including when the guide is collapsed. **Registry** beside it names the registry the install asks first and unfolds the choice: pnpm's own registry, named by the registry it actually names — the official npm registry, the mainland China mirror, or its host — which keeps the neutral default name until the Host reads it, is listed once, and carries its host unless that host is already its name; each mirror the Host configured (`pluginManager.registries`), npmmirror as the mainland China mirror; and a typed http(s) address. The options use an opaque selector panel, fill rows only on hover, and show hosts in tertiary text without parentheses. The custom-address area highlights on hover; clicking anywhere in it selects the custom registry and focuses its input, whose focus style matches the package field. Keyboard focus alone preserves the selected registry; activating the custom radio or editing the address selects the custom registry. Tab moves from the selected radio to the address, and Shift+Tab moves back; leaving either end closes the selector and returns focus to **Registry**. Switching to an offered registry retains the custom URL draft for switching back. Submitting an invalid custom address blocks installation, opens the registry selector, and focuses the address. Invalid package and custom-address fields keep a red error border and add the shared blue inset focus ring on focus. The options float over the dialog from the control, so unfolding them never lengthens the card, and the card's content scrolls when the guide makes it taller than the viewport. The initial choice follows the response comparison above; the choice is then remembered in this browser (`localStorage`) and starts the next dialog, and a remembered address the Host no longer offers stays as a typed one and remains the requested address when installation starts before the registry list returns. **Install** first asks the Host to read what the spec names (`pluginManager.inspect`) at the chosen registry: a name the list already shows, a name no registry has, a path without a package, a package without a bundle patch, or a spec pnpm would refuse comes back under the field as one sentence, with the spec kept for editing; when no registry could be reached, the sentence names every one asked. The install then starts at the registry that answered. An accepted spec opens the installing screen, which shows the package's name, one-liner, and version as the Host read them and folds pnpm's command and output behind **Show install details**. A finished install offers **Enable now**, which switches the new bundle on, closes the dialog, and scrolls the list to it; closing instead leaves it installed and off. While the Host moves on to another registry, the installing screen says which registry could not serve the package and which is asked now, and each pnpm run behind the details carries a badge naming its registry. A failed install says what went wrong in one line, as the Host attributed it — no registry could be reached, naming every one asked; the host a GitHub address or a tarball link is fetched from could not be reached, which no registry helps; the package was not found, the disk is full, the profile is not writable, pnpm blocked a build script — with pnpm's output behind the details and **Retry** at hand, and **Change registry** beside it when the Host laid the failure at the registry it asked, which returns to the spec with the registry options open; the Host has already put the profile files back. When pnpm blocked a dependency's install scripts, the failed screen lists the packages whose scripts wait for permission and offers **Allow these scripts and retry** in place of **Retry**; the Host saves the permission in the profile's `pnpm-workspace.yaml`, which a failed run leaves as pnpm wrote it, then runs pnpm again, and the installed screen names what was allowed. A successful installation does not certify that a module can activate.
|
||||
**Add plugin** takes a package name with an optional version, a Git address, a tarball, or an absolute local path; the dialog says a package name is what follows `dsh plugin add` in a README. Enter in the package or custom-registry field submits the install request, but Enter used to confirm an input-method candidate does not. **Install guide and examples** under the field opens a guide that shows the package-name example; **Use example** drops it into the field. Typing or pasting the Git or local-path template verbatim still raises the reminder asking for the actual value. A trust box above **Install** stays visible including when the guide is collapsed, and adds that installed plugins do not update automatically: upgrading means uninstalling and installing the new version, which later releases will keep improving. **Registry** beside it names the registry the install asks first and unfolds the choice: pnpm's own registry, named by the registry it actually names — the official npm registry, the mainland China mirror, or its host — which keeps the neutral default name until the Host reads it, is listed once, and carries its host unless that host is already its name; each mirror the Host configured (`pluginManager.registries`), npmmirror as the mainland China mirror; and a typed http(s) address. The options use an opaque selector panel, fill rows only on hover, and show hosts in tertiary text without parentheses. The custom-address area highlights on hover; clicking anywhere in it selects the custom registry and focuses its input, whose focus style matches the package field. Keyboard focus alone preserves the selected registry; activating the custom radio or editing the address selects the custom registry. Tab moves from the selected radio to the address, and Shift+Tab moves back; leaving either end closes the selector and returns focus to **Registry**. Switching to an offered registry retains the custom URL draft for switching back. Submitting an invalid custom address blocks installation, opens the registry selector, and focuses the address. Invalid package and custom-address fields keep a red error border and add the shared blue inset focus ring on focus. The options float over the dialog from the control, so unfolding them never lengthens the card, and the card's content scrolls when the guide makes it taller than the viewport. The initial choice follows the response comparison above; the choice is then remembered in this browser (`localStorage`) and starts the next dialog, and a remembered address the Host no longer offers stays as a typed one and remains the requested address when installation starts before the registry list returns. **Install** first asks the Host to read what the spec names (`pluginManager.inspect`) at the chosen registry: a name the list already shows, a name no registry has, a path without a package, a package without a bundle patch, or a spec pnpm would refuse comes back under the field as one sentence, with the spec kept for editing; when no registry could be reached, the sentence names every one asked. The install then starts at the registry that answered. An accepted spec opens the installing screen, which shows the package's name, one-liner, and version as the Host read them and folds pnpm's command and output behind **Show install details**. A finished install offers **Enable now**, which switches the new bundle on, closes the dialog, and scrolls the list to it; closing instead leaves it installed and off. While the Host moves on to another registry, the installing screen says which registry could not serve the package and which is asked now, and each pnpm run behind the details carries a badge naming its registry. A failed install says what went wrong in one line, as the Host attributed it — no registry could be reached, naming every one asked; the host a GitHub address or a tarball link is fetched from could not be reached, which no registry helps; the package was not found, the disk is full, the profile is not writable, pnpm blocked a build script — with pnpm's output behind the details and **Retry** at hand, and **Change registry** beside it when the Host laid the failure at the registry it asked, which returns to the spec with the registry options open; the Host has already put the profile files back. When pnpm blocked a dependency's install scripts, the failed screen lists the packages whose scripts wait for permission and offers **Allow these scripts and retry** in place of **Retry**; the Host saves the permission in the profile's `pnpm-workspace.yaml`, which a failed run leaves as pnpm wrote it, then runs pnpm again, and the installed screen names what was allowed. A successful installation does not certify that a module can activate.
|
||||
|
||||
During preparation and download, **Cancel install** asks the Host to stop the run and waits for confirmation. Loading the bundle cannot be cancelled. Closing with ×, Escape, or the backdrop hides the dialog immediately and requests cancellation when possible. **View installation** reopens the same task with its output; another installation cannot start while its outcome is pending or unconfirmed. Confirmed cancellation returns to the spec and shows a toast; the manifest and lockfile are restored, while downloaded files can remain. A lost installation response triggers a request to recover the result; **Check installation status** and reconnect retry that request. If the Host has no active request, **Installation result unavailable** allows returning to editing after checking the plugin list. A cancellation sent before acceptance waits and retries automatically; a failed cancellation can be retried manually. Hidden tasks report their outcome through toasts without reopening the dialog.
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ kind: "package-reference"
|
||||
|
||||
Host 通过普通 fetch 代理向 `https://registry.npmjs.org/-/ping` 和 `https://registry.npmmirror.com/-/ping` 发送 GET 请求,以最先返回 2xx 的源为结果;重定向和失败不参与选择。随后取消另一条请求、丢弃两个响应体,并在清理完成后返回。默认时限为 1500 毫秒,包括不可用结果在内的探测结果均缓存五分钟。在 `ui-plugin-manager` 上配置 `registryProbeTimeoutMs` 和 `registryProbeCacheTtlMs`;`registryProbeEnabled: false` 关闭探测。两条请求都失败或超时时保留现有默认源。不使用 IP 地区服务,也不发送 Session 内容。
|
||||
|
||||
**添加插件**接受包名(可带版本)、Git 地址、压缩包或本地绝对路径;对话框说明包名就是 README 里 `dsh plugin add` 后面的那一段。在包名或自定义安装源输入框中按 Enter 会提交安装请求,但用于确认输入法候选词的 Enter 不会触发安装。输入框下方的**插件安装引导和示例**展开一段引导,给出三种常见形式各一个示例;**填入示例**把示例填进输入框。Git 地址和本地路径示例需要替换为实际值;输入框中保留示例时会显示提醒。可信来源提示始终显示在**安装**按钮上方,引导收起后也可见。旁边的**安装源**写着安装首先询问的注册表,展开后可选:pnpm 自身的注册表,按它实际指向的源命名——npm 官方源、中国大陆镜像源,其余以主机名显示——Host 读不到时保留中性的默认名称,只列一次,选项标题带上主机名(主机名即名称时不重复显示);Host 配置的每个镜像(`pluginManager.registries`),npmmirror 显示为中国大陆镜像源;以及手动输入的 http(s) 地址。选项使用不透明选择面板,仅悬停行使用底色,主机名不加括号并使用三级文字色。自定义地址区域在悬停时高亮;点击其中任意位置会选中自定义源并聚焦输入框,焦点样式与包名输入框一致。仅通过键盘聚焦不会改变已选安装源;激活自定义单选项或编辑地址才会选中自定义源。Tab 从已选单选项移到地址框,Shift+Tab 反向返回;从任一端移出时关闭选择器,并将焦点交还**安装源**按钮。切到预设源时保留自定义地址草稿,切回后继续使用。提交无效的自定义地址时会阻止安装,展开安装源选择器并聚焦地址框。包名和自定义地址输入框无效时保留红色错误边框,聚焦时加上共享的蓝色内嵌焦点环。选项从控件上浮在对话框之上,展开不会拉长卡片;引导使卡片高过视口时,卡片内容可以滚动。初始选择遵循上文的响应比较规则;之后选择记在本浏览器(`localStorage`)里,下次打开对话框从它开始,Host 不再提供的已记住地址保留为手动输入的地址;在安装源列表返回前开始安装,也仍请求该地址。**安装**先让 Host 在所选注册表读出 spec 指向什么(`pluginManager.inspect`):列表中已有的名字、所有注册表都没有的名字、没有包的路径、没有组合包 patch 的包,或 pnpm 会拒绝的 spec,都以一句话回到输入框下方,spec 保留可继续编辑;所有注册表都连不上时,这句话列出问过的每一个。随后安装从作答的那个注册表开始。通过检查的 spec 打开安装中界面,展示 Host 读到的包名、一句话简介和版本,pnpm 的命令与输出折叠在**查看安装详情**之后。安装完成后提供**立即启用**:启用新组合包、关闭对话框并把列表滚动到它;直接关闭则让它保持已安装但关闭。Host 改问另一个注册表时,安装中界面会说明哪个源没能提供这个包、现在改问哪个,详情里每次 pnpm 运行都带一个写明所用源的标记。安装失败时按 Host 的归因用一行话说明原因——所有安装源都连不上,并列出问过的每一个;GitHub 地址或压缩包链接自身的主机连不上,换源无济于事;包不存在、磁盘已满、profile 不可写、pnpm 拦下了构建脚本——pnpm 输出在详情里,**重试**就在手边,Host 把失败归于所问注册表时还在旁边提供**更换安装源**,回到 spec 输入界面并展开安装源选项;Host 已经把 profile 文件放回原样。pnpm 拦下依赖的安装脚本时,失败界面列出等待允许的包,并以**允许这些脚本并重试**取代**重试**;Host 把授权写进 profile 的 `pnpm-workspace.yaml`(失败的运行保留 pnpm 写入的这个文件)再运行 pnpm,安装完成界面会说明允许了哪些脚本。安装成功不代表模块一定能够激活。
|
||||
**添加插件**接受包名(可带版本)、Git 地址、压缩包或本地绝对路径;对话框说明包名就是 README 里 `dsh plugin add` 后面的那一段。在包名或自定义安装源输入框中按 Enter 会提交安装请求,但用于确认输入法候选词的 Enter 不会触发安装。输入框下方的**插件安装引导和示例**展开一段引导,给出包名示例;**填入示例**把它填进输入框。输入框中若原样保留 Git 地址或本地路径的模板文本,仍会显示要求替换为实际值的提醒。**安装**按钮上方的提示框在引导收起后也可见,并说明插件安装后暂不支持自动更新:升级需先卸载再安装新版,后续版本会持续改善升级体验。旁边的**安装源**写着安装首先询问的注册表,展开后可选:pnpm 自身的注册表,按它实际指向的源命名——npm 官方源、中国大陆镜像源,其余以主机名显示——Host 读不到时保留中性的默认名称,只列一次,选项标题带上主机名(主机名即名称时不重复显示);Host 配置的每个镜像(`pluginManager.registries`),npmmirror 显示为中国大陆镜像源;以及手动输入的 http(s) 地址。选项使用不透明选择面板,仅悬停行使用底色,主机名不加括号并使用三级文字色。自定义地址区域在悬停时高亮;点击其中任意位置会选中自定义源并聚焦输入框,焦点样式与包名输入框一致。仅通过键盘聚焦不会改变已选安装源;激活自定义单选项或编辑地址才会选中自定义源。Tab 从已选单选项移到地址框,Shift+Tab 反向返回;从任一端移出时关闭选择器,并将焦点交还**安装源**按钮。切到预设源时保留自定义地址草稿,切回后继续使用。提交无效的自定义地址时会阻止安装,展开安装源选择器并聚焦地址框。包名和自定义地址输入框无效时保留红色错误边框,聚焦时加上共享的蓝色内嵌焦点环。选项从控件上浮在对话框之上,展开不会拉长卡片;引导使卡片高过视口时,卡片内容可以滚动。初始选择遵循上文的响应比较规则;之后选择记在本浏览器(`localStorage`)里,下次打开对话框从它开始,Host 不再提供的已记住地址保留为手动输入的地址;在安装源列表返回前开始安装,也仍请求该地址。**安装**先让 Host 在所选注册表读出 spec 指向什么(`pluginManager.inspect`):列表中已有的名字、所有注册表都没有的名字、没有包的路径、没有组合包 patch 的包,或 pnpm 会拒绝的 spec,都以一句话回到输入框下方,spec 保留可继续编辑;所有注册表都连不上时,这句话列出问过的每一个。随后安装从作答的那个注册表开始。通过检查的 spec 打开安装中界面,展示 Host 读到的包名、一句话简介和版本,pnpm 的命令与输出折叠在**查看安装详情**之后。安装完成后提供**立即启用**:启用新组合包、关闭对话框并把列表滚动到它;直接关闭则让它保持已安装但关闭。Host 改问另一个注册表时,安装中界面会说明哪个源没能提供这个包、现在改问哪个,详情里每次 pnpm 运行都带一个写明所用源的标记。安装失败时按 Host 的归因用一行话说明原因——所有安装源都连不上,并列出问过的每一个;GitHub 地址或压缩包链接自身的主机连不上,换源无济于事;包不存在、磁盘已满、profile 不可写、pnpm 拦下了构建脚本——pnpm 输出在详情里,**重试**就在手边,Host 把失败归于所问注册表时还在旁边提供**更换安装源**,回到 spec 输入界面并展开安装源选项;Host 已经把 profile 文件放回原样。pnpm 拦下依赖的安装脚本时,失败界面列出等待允许的包,并以**允许这些脚本并重试**取代**重试**;Host 把授权写进 profile 的 `pnpm-workspace.yaml`(失败的运行保留 pnpm 写入的这个文件)再运行 pnpm,安装完成界面会说明允许了哪些脚本。安装成功不代表模块一定能够激活。
|
||||
|
||||
准备和下载期间,**取消安装**会请求 Host 停止运行并等待确认。加载组合包的阶段不可取消。点击 ×、按 Escape 或点击遮罩会立即隐藏对话框,并在可以取消时请求取消。**查看安装任务**会重新打开同一任务并保留输出;结果待定或尚未确认时不能发起另一项安装。确认取消后回到 spec 输入界面并显示 toast;manifest 与 lockfile 已恢复,已下载文件可能保留。安装响应丢失后会请求恢复结果;**核对安装状态**和重连会重试该请求。Host 已无活动请求时,**未能获取安装结果**允许检查插件列表后返回编辑。早于接收确认的取消请求会等待并自动重试;取消失败可手动重试。隐藏的任务通过 toast 通知结果,不会重新弹出对话框。
|
||||
|
||||
|
||||
@@ -535,7 +535,7 @@
|
||||
box-shadow: inset 0 0 0 0.5px var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
|
||||
}
|
||||
|
||||
/* The guide under the field: opened by a text button, it says what an ID is and shows the three forms with examples. */
|
||||
/* The guide under the field: opened by a text button, it names the npm package name and shows its example. */
|
||||
.guideToggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -567,17 +567,17 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 8px 14px 14px;
|
||||
padding: 8px 14px;
|
||||
border: 0.5px solid var(--dsw-alias-border-l4);
|
||||
border-radius: var(--dsw-radius-lg);
|
||||
background: var(--dsw-alias-bg-layer-1);
|
||||
}
|
||||
|
||||
.guideHint {
|
||||
margin: 0;
|
||||
margin: 6px 0 0;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: var(--dsw-alias-label-secondary);
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
}
|
||||
|
||||
/* Trust guidance stays beside the install action, including while examples are collapsed. */
|
||||
@@ -594,6 +594,13 @@
|
||||
color: var(--dsw-alias-label-secondary);
|
||||
}
|
||||
|
||||
.installSafetyText {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.installSafety > svg {
|
||||
flex: none;
|
||||
margin-top: 2px;
|
||||
@@ -620,21 +627,6 @@
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.guideIndex {
|
||||
display: inline-flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 999px;
|
||||
corner-shape: round;
|
||||
background: var(--dsw-alias-bg-module-platform);
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
color: var(--dsw-alias-label-secondary);
|
||||
}
|
||||
|
||||
.guideMain {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
@@ -653,7 +645,7 @@
|
||||
.guideExample {
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: var(--dsw-alias-label-secondary);
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
|
||||
@@ -668,11 +668,9 @@ interface GuideExample {
|
||||
readonly hintKey: PluginManagerLocaleKey
|
||||
}
|
||||
|
||||
/** The spec forms the install guide shows, each with an example the person can drop into the field. */
|
||||
/** The spec form the install guide shows, with an example the person can drop into the field. */
|
||||
const GUIDE_EXAMPLES = [
|
||||
{ key: 'id', titleKey: 'installGuideIdTitle', exampleKey: 'installGuideIdExample', hintKey: 'installGuideIdHint' },
|
||||
{ key: 'git', titleKey: 'installGuideGitTitle', exampleKey: 'installGuideGitExample', hintKey: 'installGuideGitHint' },
|
||||
{ key: 'path', titleKey: 'installGuidePathTitle', exampleKey: 'installGuidePathExample', hintKey: 'installGuidePathHint' },
|
||||
] as const satisfies readonly GuideExample[]
|
||||
|
||||
/** The one-line reading of a classified pnpm failure. */
|
||||
@@ -850,7 +848,7 @@ function InstallDialog({
|
||||
variant="primary"
|
||||
autoFocus
|
||||
onClick={() => {
|
||||
// The mirror is already asked, so the form opens with the guide to the other kinds of spec.
|
||||
// The mirror is already asked, so the form opens with the package-name guide.
|
||||
if (anotherWay) setGuideOpen(true)
|
||||
onUseGithubMirror()
|
||||
}}
|
||||
@@ -892,7 +890,10 @@ function InstallDialog({
|
||||
<div className={css.installFooter}>
|
||||
<p className={css.installSafety} role="note">
|
||||
<IconWarningOutlineRegular size={14} aria-hidden="true" />
|
||||
<span>{t('installGuideSafety')}</span>
|
||||
<span className={css.installSafetyText}>
|
||||
<span>{t('installGuideSafety')}</span>
|
||||
<span>{t('installUpgradeNotice')}</span>
|
||||
</span>
|
||||
</p>
|
||||
<Button variant="primary" className={css.wide} disabled={checking || empty} aria-busy={checking} onClick={onRun}>
|
||||
{checking ? <StateDot state="ongoing" /> : null}
|
||||
@@ -959,9 +960,8 @@ function InstallDialog({
|
||||
? (
|
||||
<div id={guideId} className={css.guide} data-install-guide>
|
||||
<ol className={css.guideList}>
|
||||
{GUIDE_EXAMPLES.map(({ key, titleKey, exampleKey, hintKey }, index) => (
|
||||
{GUIDE_EXAMPLES.map(({ key, titleKey, exampleKey, hintKey }) => (
|
||||
<li key={key} className={css.guideItem}>
|
||||
<span className={css.guideIndex} aria-hidden="true">{index + 1}</span>
|
||||
<div className={css.guideMain}>
|
||||
<span className={css.guideTitle}>{t(titleKey)}</span>
|
||||
<span className={css.guideHint}>{t(hintKey)}</span>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/** Plugin management interface copy. */
|
||||
|
||||
/** Git template shared by the displayed example and replacement reminder. */
|
||||
/** Git template a field still holding it reports as needing the actual address; no guide entry shows it. */
|
||||
export const INSTALL_GIT_EXAMPLE = 'https://github.com/author/dsh-plugin'
|
||||
/** Local-path template shared by the displayed example and replacement reminder. */
|
||||
/** Local-path template a field still holding it reports as needing the actual path; no guide entry shows it. */
|
||||
export const INSTALL_PATH_EXAMPLE = '/Users/name/my-plugin'
|
||||
|
||||
/** Simplified Chinese dictionary and key source of truth. */
|
||||
@@ -59,21 +59,16 @@ export const zh = {
|
||||
installSpecPlaceholder: '例如 dsh-plugin-whale-pet',
|
||||
installGuideToggle: '插件安装引导和示例',
|
||||
installGuideHide: '收起引导',
|
||||
installGuideIdTitle: '包名',
|
||||
installGuideIdTitle: '填入插件 npm 包名',
|
||||
installGuideIdExample: 'dsh-plugin-whale-pet',
|
||||
installGuideIdHint: '插件包名即 npm 包名(如 dsh-xxx 或 @作者/插件名),社区插件的 README 安装命令中 dsh plugin add 或 pnpm add 之后的部分。',
|
||||
installGuideGitTitle: 'GitHub 仓库地址',
|
||||
installGuideGitExample: INSTALL_GIT_EXAMPLE,
|
||||
installGuideGitHint: '插件在 GitHub 上的开源仓库地址,也支持其他 Git 仓库。',
|
||||
installGuidePathTitle: '本地插件目录',
|
||||
installGuidePathExample: INSTALL_PATH_EXAMPLE,
|
||||
installGuidePathHint: '本机上插件目录的绝对路径,适用于自行开发或已下载的插件。',
|
||||
installGuideExampleLabel: '示例:',
|
||||
installGitTemplateHint: '请替换为实际的 Git 仓库地址',
|
||||
installPathTemplateHint: '请替换为本机插件目录的实际路径',
|
||||
installGuideFill: '填入示例',
|
||||
installGuideFillAria: '填入示例 {example}',
|
||||
installGuideSafety: '请确认插件来源可信。插件在本机以你的权限运行,来源不明的插件可能损坏 DeepSeek Harness,或读取和泄露你的数据。',
|
||||
installUpgradeNotice: '插件安装后,暂不支持自动更新。若需升级,请先卸载再安装新版,后续版本会持续改善升级体验。',
|
||||
registryToggle: '安装源',
|
||||
registryLegend: '从哪个 npm 源下载插件',
|
||||
registryDefault: '默认安装源',
|
||||
@@ -256,21 +251,16 @@ export const en = {
|
||||
installSpecPlaceholder: 'for example dsh-plugin-whale-pet',
|
||||
installGuideToggle: 'Install guide and examples',
|
||||
installGuideHide: 'Hide the guide',
|
||||
installGuideIdTitle: 'Package name',
|
||||
installGuideIdTitle: 'Enter the plugin\'s npm package name',
|
||||
installGuideIdExample: 'dsh-plugin-whale-pet',
|
||||
installGuideIdHint: 'The plugin package name is the npm package name (like dsh-xxx or @author/plugin): the part after dsh plugin add or pnpm add in a community plugin\'s README install command.',
|
||||
installGuideGitTitle: 'GitHub repository address',
|
||||
installGuideGitExample: INSTALL_GIT_EXAMPLE,
|
||||
installGuideGitHint: 'The address of the plugin\'s open-source repository on GitHub; other Git hosts work too.',
|
||||
installGuidePathTitle: 'Local plugin directory',
|
||||
installGuidePathExample: INSTALL_PATH_EXAMPLE,
|
||||
installGuidePathHint: 'The absolute path of a plugin directory on this machine, developed here or downloaded.',
|
||||
installGuideExampleLabel: 'Example: ',
|
||||
installGitTemplateHint: 'Replace this with the actual Git repository address.',
|
||||
installPathTemplateHint: 'Replace this with the actual path to your local plugin directory.',
|
||||
installGuideFill: 'Use example',
|
||||
installGuideFillAria: 'Use the example {example}',
|
||||
installGuideSafety: 'Install only plugins you trust: they run with your permissions and can damage DeepSeek Harness or leak your data.',
|
||||
installUpgradeNotice: 'Installed plugins do not update automatically yet. To upgrade a plugin, uninstall it and install the new version. Later releases will keep improving the upgrade experience.',
|
||||
registryToggle: 'Registry',
|
||||
registryLegend: 'The npm registry the plugin is downloaded from',
|
||||
registryDefault: 'Default registry',
|
||||
|
||||
@@ -15,7 +15,7 @@ import { PluginRefreshToast } from '../src/client/PluginRefreshToast.tsx'
|
||||
import type { PluginManagerPageProps } from '../src/client/index.ts'
|
||||
import type { ConfigLedger } from '../src/client/config-ledger.ts'
|
||||
import { rowKey, type InstallState, type PackageRow, type PackageView, type PluginManagerState } from '../src/client/manager-store.ts'
|
||||
import { en, zh, type PluginManagerLocaleKey } from '../src/client/locales.ts'
|
||||
import { INSTALL_GIT_EXAMPLE, INSTALL_PATH_EXAMPLE, en, zh, type PluginManagerLocaleKey } from '../src/client/locales.ts'
|
||||
import type { PluginActivationOwnerProps, PluginDetailProps, PluginsSubject } from '../src/client/slot-contract.ts'
|
||||
|
||||
afterEach(cleanup)
|
||||
@@ -887,6 +887,7 @@ describe('PluginManagerPage', () => {
|
||||
const { actions, setLanguage } = renderTab({ install: { ...IDLE_INSTALL, open: true } })
|
||||
setLanguage(locale)
|
||||
expect(screen.getByPlaceholderText(placeholder)).toBeTruthy()
|
||||
expect(screen.getByText(locale.installUpgradeNotice)).toBeTruthy()
|
||||
fireEvent.click(screen.getByRole('button', { name: locale.installGuideToggle }))
|
||||
expect(screen.getByText('dsh-plugin-whale-pet')).toBeTruthy()
|
||||
fireEvent.click(screen.getByRole('button', { name: locale.installGuideFillAria.replace('{example}', 'dsh-plugin-whale-pet') }))
|
||||
@@ -894,8 +895,8 @@ describe('PluginManagerPage', () => {
|
||||
})
|
||||
|
||||
it.each([
|
||||
{ example: en.installGuideGitExample, key: 'installGitTemplateHint' as const },
|
||||
{ example: en.installGuidePathExample, key: 'installPathTemplateHint' as const },
|
||||
{ example: INSTALL_GIT_EXAMPLE, key: 'installGitTemplateHint' as const },
|
||||
{ example: INSTALL_PATH_EXAMPLE, key: 'installPathTemplateHint' as const },
|
||||
])('asks for a real value when the field holds $example, including after a language change', ({ example, key }) => {
|
||||
const install = { ...IDLE_INSTALL, open: true, spec: example }
|
||||
const { set, setLanguage } = renderTab({ install })
|
||||
@@ -904,7 +905,7 @@ describe('PluginManagerPage', () => {
|
||||
expect(screen.getByRole('textbox', { name: en.installSpecLabel }).getAttribute('aria-describedby')).toBe(hint.id)
|
||||
setLanguage(zh)
|
||||
expect(screen.getByRole('status').textContent).toBe(zh[key])
|
||||
expect(screen.getByRole('note').textContent).toBe(zh.installGuideSafety)
|
||||
expect(screen.getByRole('note').textContent).toContain(zh.installGuideSafety)
|
||||
set({ install: { ...install, spec: '@actual/plugin' } })
|
||||
expect(screen.queryByRole('status')).toBeNull()
|
||||
expect(screen.getByRole('textbox', { name: zh.installSpecLabel }).getAttribute('aria-describedby')).toBeNull()
|
||||
@@ -918,7 +919,7 @@ describe('PluginManagerPage', () => {
|
||||
fireEvent.click(toggle)
|
||||
expect(screen.getByRole('button', { name: en.installGuideHide }).getAttribute('aria-expanded')).toBe('true')
|
||||
expect(screen.getByText(en.installGuideIdHint)).toBeTruthy()
|
||||
expect(screen.getByText(en.installGuideGitExample)).toBeTruthy()
|
||||
expect(screen.getAllByRole('listitem')).toHaveLength(1)
|
||||
fireEvent.click(screen.getByRole('button', { name: en.installGuideFillAria.replace('{example}', en.installGuideIdExample) }))
|
||||
expect(actions.editInstallSpec).toHaveBeenCalledExactlyOnceWith(en.installGuideIdExample)
|
||||
fireEvent.click(screen.getByRole('button', { name: en.installGuideHide }))
|
||||
@@ -1432,10 +1433,10 @@ describe('PluginManagerPage', () => {
|
||||
fireEvent.click(screen.getByRole('button', { name: en.installTryAnotherWay }))
|
||||
expect(actions.useGithubMirror).toHaveBeenCalledOnce()
|
||||
expect(actions.runInstall).not.toHaveBeenCalled()
|
||||
// The form it returns to opens the guide to the other kinds of spec.
|
||||
// The form it returns to opens the guide to the package-name example.
|
||||
set({ install: { ...IDLE_INSTALL, open: true, mirrorRecovery: true, registries: REGISTRIES, registry: failed.registry } })
|
||||
expect(screen.getByRole('button', { name: en.installGuideHide }).getAttribute('aria-expanded')).toBe('true')
|
||||
expect(screen.getByText(en.installGuidePathExample)).toBeTruthy()
|
||||
expect(screen.getByText(en.installGuideIdHint)).toBeTruthy()
|
||||
// A typed address other than the mirror can still switch to it.
|
||||
set({ install: { ...failed, registry: { kind: 'custom', url: 'npm.corp' } } })
|
||||
expect(screen.getByRole('button', { name: en.installUseGithubMirror })).toBeTruthy()
|
||||
|
||||
Reference in new issue
Block a user