@jidekaixin2dian/dsh-file-actions 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,127 +1,132 @@
1
- # File Actions · 文件与链接操作
2
-
3
- [English](README.en.md)
4
-
5
- **0.1.13** 对齐 npm 与 GitHub Release 两个安装渠道(同源构建),npm 发布附带 provenance 来源证明;延续 0.1.12 的引用行号、复制动作与工作区外复制确认。安装包见 [npm](https://www.npmjs.com/package/@jidekaixin2dian/dsh-file-actions) 和 [Release](https://github.com/jidekaixin2dian/dsh-file-actions/releases/latest),修复记录见[变更记录](CHANGELOG.md)。
6
-
7
- 右键文件和链接,直接打开、定位、复制或另存。
8
-
9
- ![文件右键菜单](assets/preview-dark.png)
10
-
11
- ## 安装
12
-
13
- 先完全退出 DSH 桌面端,再执行:
14
-
15
- ```powershell
16
- dsh plugin --profile desktop add @jidekaixin2dian/dsh-file-actions --registry=https://registry.npmjs.org
17
- ```
18
-
19
- 装完重开 DSH 生效。指定官方 npm 源可以避开镜像同步延迟;安装固定版本时,在包名后加 `@0.1.13`。
20
-
21
- 也可继续通过 GitHub Release 安装:
22
-
23
- ```powershell
24
- dsh plugin --profile desktop add https://github.com/jidekaixin2dian/dsh-file-actions/releases/latest/download/dsh-file-actions.tgz
25
- ```
26
-
27
- 只下载 npm 安装包、不安装插件:
28
-
29
- ```powershell
30
- npm pack @jidekaixin2dian/dsh-file-actions --registry=https://registry.npmjs.org
31
- ```
32
-
33
- 普通 `npm install` 不会把插件注册到 DSH;请使用上面的 `dsh plugin` 命令。想跟 main 源码走可以用 `dsh plugin --profile desktop add github:jidekaixin2dian/dsh-file-actions`。
34
-
35
- 卸载:dsh plugin --profile desktop remove @jidekaixin2dian/dsh-file-actions,然后重开 DSH。
36
-
37
- ## 怎么用
38
-
39
- 在聊天里右键这些位置的文件名:
40
-
41
- - 正文里的行内代码(蓝色、点线下划线)
42
- - 交付卡片和「已编辑」文件列表
43
- - 工具调用行(读取、写入、编辑)里的文件链接
44
- - 右侧文件树
45
- - 文档预览标题
46
- - GitHub 等网页链接(同一个蓝色样式)
47
-
48
- ![打开方式](assets/preview-open-with.png)
49
-
50
- 菜单按文件类型给不同的项:
51
-
52
- | 文件 | 能做什么 |
53
- |---|---|
54
- | 代码、文本、配置、字幕 | 打开、在编辑器中打开、打开方式、在资源管理器中显示、复制路径、复制相对路径、复制文件名、复制文件内容、另存为 |
55
- | Markdown、HTML、SVG、PDF、图片 | 同上,多一项「在浏览器中打开」;图片和 SVG 会在菜单里显示缩略图 |
56
- | 视频、音频 | 打开、打开方式、在浏览器中播放(mp4 / mov / webm、mp3 / wav / flac 等)、另存为 |
57
- | Office、压缩包、设计稿、3D、磁盘镜像、二进制 | 打开、打开方式、在资源管理器中显示、复制路径、另存为 |
58
- | 文件夹 | 打开文件夹、在资源管理器中打开、复制路径、复制相对路径 |
59
- | 网页链接 | 打开链接、复制链接、复制链接文字、复制为 Markdown |
60
-
61
- 「打开方式」完整保留系统关联应用,按首选、系统默认、编辑器、其他应用排序;超过 7 个会出现搜索框。
62
-
63
- 点击应用旁的 ☆,将它设为该文件类型的首选;再次点击 ★ 取消。键盘选中应用后也可用 `Shift+Enter` 设置或取消。首选仅保存在当前浏览器中,不修改系统文件关联;若应用不再可用,自动回落到可用编辑器。
64
-
65
- 引用里带行号(src/app.ts:42:7、
66
- otes.md#L42-L48)时,菜单头部会显示「第 42 行」,并多出「复制引用」——原样复制这段引用,粘回聊天就能对上位置。宿主暂时不能把编辑器定位到该行。
67
-
68
- 明确的文件引用会先显示读取状态,失败时可重试。普通文本中猜测的路径先在悬停或聚焦时验证,验证前保留原生菜单。任何位置按住 `Shift` 再右键,都保留原生菜单。
69
-
70
- ![搜索应用](assets/preview-search.png)
71
-
72
- 图片文件的缩略图:
73
-
74
- ![图片缩略图](assets/preview-image.png)
75
-
76
- 键盘也能用:`Shift+F10` 或菜单键打开,`↑ ↓` 移动,`→` 进子菜单,`Enter` 执行,`Esc` 关闭。
77
-
78
- 壁纸 + 液态玻璃主题下也能看清(菜单底下垫了一层接近不透明的底):
79
-
80
- ![玻璃主题下的可读性](assets/preview-glass.png)
81
-
82
- ![浅色主题](assets/preview-light.png)
83
-
84
- ## 限制
85
-
86
- - 不是系统原生菜单;字号跟随页面根字号和页面缩放,不直接读取操作系统的文字大小设置。
87
- - 「打开方式」只列系统已注册的关联应用;首选设置不修改系统默认关联。
88
- - 打开编辑器目前只定位到文件;固定版本宿主的打开接口不支持传入行号和列号。
89
- - 另存为走浏览器的下载对话框,文件名固定为原文件名。
90
- - 复制文件内容上限 2 MiB。另存为和浏览器预览受宿主整文件读取上限约束,DSH 0.2.1-rc.2 默认 32 MiB;更大的文件请使用外部应用。
91
- - HTML/SVG 预览在独立来源的 sandbox iframe 内运行脚本,不能读取 DSH 页面或 Cookie;相邻文件的相对资源、顶层跳转和同源存储可能不可用。
92
- - 只支持网页版界面,终端里的 DSH 没有可右键的元素。
93
-
94
- ## 常见问题
95
-
96
- **右键出现原生菜单?** 普通文字与输入框保留原生菜单。猜测的文件路径需要先在悬停或聚焦时验证;未验证或验证失败时也保留原生菜单。明确文件引用失败时,菜单内会显示原因与重试入口。
97
-
98
- **「打开方式」不可用?** 菜单会分别显示正在查询、没有关联应用和查询失败;查询失败可以点击重试。
99
-
100
- **「在浏览器中打开」没反应?** 浏览器可能拦了新窗口,允许弹窗后重试。
101
-
102
- **怎么指定首选应用?** 在「打开方式」中点击应用旁的 ☆。未指定首选时,快捷打开行采用系统关联里能识别的编辑器;「打开文件」仍按系统默认方式打开。
103
-
104
- ## 开发与验证
105
-
106
- 需要 Node >=24、Git、pnpm:
107
-
108
- ```sh
109
- npm ci --ignore-scripts
110
- npm test
111
- npm run setup:host
112
- npm run test:host
113
- npm run pack:check
114
- ```
115
-
116
- 固定宿主为 DSH **0.2.1-rc.2**(`687f282e8625c6b8d11ff58211a90524be2e4317`)。`DFA_HOST` 可复用相同 commit 的干净 checkout。Windows 使用 headless Edge;Linux 先运行 `npx --no-install playwright install --with-deps chromium`。CI 同时覆盖两种系统。插件仍无运行时依赖、无构建步骤。
117
-
118
- 浏览器套件把实际 client bundle 与真实 WorkspaceFiles 接到合成文件引用上,检查会话身份、预览脚本隔离、真实 3 MiB 下载及卸载行为;另用确定性 Remote 响应检查右键回退、首选应用、异步菜单稳定性、搜索和大字号。这不是完整 Desktop 或外部应用启动验收。可选完整 Web 驱动和历史断言计数见 [test-e2e](test-e2e/README.md)。
119
-
120
- ## 版本
121
-
122
- - [最新版本](https://github.com/jidekaixin2dian/dsh-file-actions/releases/latest)
123
- - [讨论帖](https://github.com/deepseek-ai/deepseek-harness/discussions/10576)
124
-
125
- ## 许可
126
-
127
- MIT
1
+ # File Actions · 文件与链接操作
2
+
3
+ [English](README.en.md)
4
+
5
+ **0.1.15** 补齐行内引用、视频预览与菜单交互,并修复文件读取、预览隔离和应用缓存问题。npm 与 GitHub Release 使用同一份校验归档,npm 发布附带 provenance 来源证明。安装包见 [npm](https://www.npmjs.com/package/@jidekaixin2dian/dsh-file-actions) 和 [Release](https://github.com/jidekaixin2dian/dsh-file-actions/releases/latest),详情见[变更记录](CHANGELOG.md)。
6
+
7
+ 右键文件和链接,直接打开、定位、复制或另存。
8
+
9
+ ![文件右键菜单](assets/preview-dark.png)
10
+
11
+ ## 安装
12
+
13
+ 需要 DSH `>=0.2.1-rc.2`(CI 持续验证 0.2.1-rc.2 与 0.2.1-rc.3 双版本)与 Node >=24。先完全退出 DSH 桌面端,再执行:
14
+
15
+ ```powershell
16
+ dsh plugin --profile desktop add @jidekaixin2dian/dsh-file-actions --registry=https://registry.npmjs.org
17
+ ```
18
+
19
+ 装完重开 DSH 生效。指定官方 npm 源可以避开镜像同步延迟;安装固定版本时,在包名后加 `@0.1.13`。
20
+
21
+ 也可继续通过 GitHub Release 安装:
22
+
23
+ ```powershell
24
+ dsh plugin --profile desktop add https://github.com/jidekaixin2dian/dsh-file-actions/releases/latest/download/dsh-file-actions.tgz
25
+ ```
26
+
27
+ 只下载 npm 安装包、不安装插件:
28
+
29
+ ```powershell
30
+ npm pack @jidekaixin2dian/dsh-file-actions --registry=https://registry.npmjs.org
31
+ ```
32
+
33
+ 普通 `npm install` 不会把插件注册到 DSH;请使用上面的 `dsh plugin` 命令。想跟 main 源码走可以用 `dsh plugin --profile desktop add github:jidekaixin2dian/dsh-file-actions`。
34
+
35
+ 卸载:dsh plugin --profile desktop remove @jidekaixin2dian/dsh-file-actions,然后重开 DSH。
36
+
37
+ ## 怎么用
38
+
39
+ 在聊天里右键这些位置的文件名:
40
+
41
+ - 正文里的行内代码(蓝色、点线下划线)
42
+ - 交付卡片和「已编辑」文件列表
43
+ - 工具调用行(读取、写入、编辑)里的文件链接
44
+ - 右侧文件树
45
+ - 文档预览标题
46
+ - GitHub 等网页链接(同一个蓝色样式)
47
+
48
+ ![打开方式](assets/preview-open-with.png)
49
+
50
+ 菜单按文件类型给不同的项:
51
+
52
+ | 文件 | 能做什么 |
53
+ |---|---|
54
+ | 代码、文本、配置、字幕 | 打开、在编辑器中打开、打开方式、在资源管理器中显示、复制路径、复制相对路径、复制文件名、复制文件内容、另存为 |
55
+ | Markdown、HTML、SVG、PDF、图片 | 同上,多一项「在浏览器中打开」;图片和 SVG 会在菜单里显示缩略图 |
56
+ | 视频、音频 | 打开、打开方式、在浏览器中播放(mp4 / mov / webm、mp3 / wav / flac 等)、另存为 |
57
+ | Office、压缩包、设计稿、3D、磁盘镜像、二进制 | 打开、打开方式、在资源管理器中显示、复制路径、另存为 |
58
+ | 文件夹 | 打开文件夹、在资源管理器中打开、复制路径、复制相对路径 |
59
+ | 网页链接 | 打开链接、复制链接、复制链接文字、复制为 Markdown |
60
+
61
+ 网页链接的菜单:
62
+
63
+ ![链接菜单](assets/preview-link.png)
64
+
65
+ 「打开方式」完整保留系统关联应用,按首选、系统默认、编辑器、其他应用排序;超过 7 个会出现搜索框。
66
+
67
+ 点击应用旁的星标,将它设为该文件类型的首选;再次点击取消。键盘选中应用后也可用 `Shift+Enter` 设置或取消。首选仅保存在当前浏览器中,不修改系统文件关联。持久缓存先展示、后台重新核对;失效首选会从快捷行回落到可用编辑器。打开失败会刷新关联,不自动重复打开文件。
68
+
69
+ 引用里带行号(src/app.ts:42:7、
70
+ otes.md#L42-L48)时,菜单头部会显示「第 42 行」,并多出「复制引用」——原样复制这段引用,粘回聊天就能对上位置。宿主暂时不能把编辑器定位到该行。
71
+
72
+ 明确的文件引用会先显示读取状态,失败时可重试。普通文本中猜测的路径先在悬停或聚焦时验证,验证前保留原生菜单。任何位置按住 `Shift` 再右键,都保留原生菜单。
73
+
74
+ ![搜索应用](assets/preview-search.png)
75
+
76
+ 图片文件的缩略图:
77
+
78
+ ![图片缩略图](assets/preview-image.png)
79
+
80
+ 键盘也能用:`Shift+F10` 或菜单键打开,`↑ ↓` 移动,`→` 进子菜单,`Enter` 执行,`Esc` 关闭。
81
+
82
+ 壁纸 + 液态玻璃主题下也能看清(菜单底下垫了一层接近不透明的底):
83
+
84
+ ![玻璃主题下的可读性](assets/preview-glass.png)
85
+
86
+ ![浅色主题](assets/preview-light.png)
87
+
88
+ ## 限制
89
+
90
+ - 不是系统原生菜单;字号跟随页面根字号和页面缩放,不直接读取操作系统的文字大小设置。
91
+ - 「打开方式」只列系统已注册的关联应用;首选设置不修改系统默认关联。
92
+ - 打开编辑器目前只定位到文件;固定版本宿主的打开接口不支持传入行号和列号。
93
+ - 另存为走浏览器的下载对话框,文件名固定为原文件名。
94
+ - 复制文件内容上限 2 MiB,只接受有效 UTF-8;其它编码请用编辑器打开。工作区外复制需要确认,确认失败时取消读取。
95
+ - 另存为和浏览器预览分块读取,总上限 64 MiB;读取期间文件版本变化会中止,避免导出混合内容。更大的文件请使用外部应用。
96
+ - HTML/SVG 默认静态预览,关闭脚本、表单、自动跳转和外部资源加载;可信文件可点「信任此文件,启用脚本与联网」。启用后仍在独立来源的 sandbox iframe 内,不能读取 DSH 页面或 Cookie。相邻文件的相对资源、顶层跳转和同源存储可能不可用;点击文件内超链接属于用户主动导航。
97
+ - 只支持网页版界面,终端里的 DSH 没有可右键的元素。
98
+
99
+ ## 常见问题
100
+
101
+ **右键出现原生菜单?** 普通文字与输入框保留原生菜单。猜测的文件路径需要先在悬停或聚焦时验证;未验证或验证失败时也保留原生菜单。明确文件引用失败时,菜单内会显示原因与重试入口。
102
+
103
+ **「打开方式」不可用?** 查询时保留加载占位;空结果或失败时隐藏关联行,下次右键重新查询。系统里有损坏的应用关联时,宿主可能整批查询失败,插件无法自行修复注册表。
104
+
105
+ **「在浏览器中打开」没反应?** 浏览器可能拦了新窗口,允许弹窗后重试。
106
+
107
+ **怎么指定首选应用?** 在「打开方式」中点击应用旁的星标。未指定首选时,快捷打开行采用系统关联里能识别的编辑器;「打开文件」仍按系统默认方式打开。
108
+
109
+ ## 开发与验证
110
+
111
+ 需要 Node >=24、Git、pnpm:
112
+
113
+ ```sh
114
+ npm ci --ignore-scripts
115
+ npm test
116
+ npm run setup:host
117
+ npm run test:host
118
+ npm run pack:check
119
+ ```
120
+
121
+ 默认固定宿主为 DSH **0.2.1-rc.3**(`1f81c047fc48fa190a683e469daa699857e9afe8`);`DFA_HOST_VERSION=rc.2` 可验证最低支持版本(`687f282e8625c6b8d11ff58211a90524be2e4317`)。`DFA_HOST` 可复用对应 commit 的干净 checkout。Windows 使用 headless Edge;Linux 先运行 `npx --no-install playwright install --with-deps chromium`。CI 在两种系统中分别覆盖 rc.2/rc.3。插件仍无运行时依赖、无构建步骤。
122
+
123
+ 浏览器套件把实际 client bundle 与真实 WorkspaceFiles 接到合成文件引用上,检查会话身份、预览脚本隔离、真实 3 MiB 下载及卸载行为;另用确定性 Remote 响应检查右键回退、首选应用、异步菜单稳定性、搜索和大字号。这不是完整 Desktop 或外部应用启动验收。可选完整 Web 驱动和历史断言计数见 [test-e2e](test-e2e/README.md)。
124
+
125
+ ## 版本
126
+
127
+ - [最新版本](https://github.com/jidekaixin2dian/dsh-file-actions/releases/latest)
128
+ - [讨论帖](https://github.com/deepseek-ai/deepseek-harness/discussions/10576)
129
+
130
+ ## 许可
131
+
132
+ MIT
package/SECURITY.md CHANGED
@@ -1,30 +1,44 @@
1
- # Security
2
-
3
- File operations use the host's existing Session and WorkspaceFiles remotes. The
4
- plugin adds no command execution endpoint or filesystem permissions. File reads
5
- can include paths outside a workspace when the host's composed filesystem permits
6
- them; the workspace label is not a containment guarantee. Copying the contents of
7
- a file outside the session workspace requires an explicit confirmation, because
8
- chat text can plant absolute paths; a declined copy reads no bytes.
9
-
10
- Browser previews run in a sandboxed iframe with an opaque origin. Scripts and
11
- forms can run, but file content cannot access the enclosing DSH document, its
12
- cookies, or its opener. Relative resources beside a file are not served by a
13
- Blob URL. Opening the same file externally delegates trust to the chosen app.
14
-
15
- Versions through 0.1.5 opened active HTML/SVG directly at the DSH Blob origin.
16
- Preview isolation is included in release 0.1.7 and later. Historical release
17
- assets have not been replaced.
18
-
19
- Preferred applications are stored locally in the browser, by extension. Only
20
- application IDs are saved; a preference must match a currently returned Host
21
- association before it can be used. Preferences neither execute commands nor
22
- change OS file associations.
23
-
24
- Automated host tests serve only synthetic files on loopback. Optional full-Web
25
- drivers require a separate `DFA_HOME`; they do not copy personal profiles, and
26
- stop only a recorded launcher with matching creation time and command line.
27
- Launch URLs and files under `test-e2e/run/` are private, ignored test state.
28
-
29
- Report vulnerabilities privately through GitHub where available. Do not include
30
- real file contents, cookies, API keys or authenticated launch URLs in an issue.
1
+ # Security
2
+
3
+ File operations use the host's existing Session and WorkspaceFiles remotes. The
4
+ plugin adds no command execution endpoint or filesystem permissions. File reads
5
+ can include paths outside a workspace when the host's composed filesystem permits
6
+ them; the workspace label is not a containment guarantee. Copying the contents of
7
+ a file outside the session workspace requires an explicit confirmation, because
8
+ chat text can plant absolute paths; a declined or unavailable confirmation reads
9
+ no bytes. Invalid UTF-8 is rejected rather than silently replaced. Chunked exports
10
+ check file identity, version, offsets and reported size, stopping on changes;
11
+ this detects inconsistent responses but does not create an atomic Host snapshot.
12
+
13
+ Browser previews run in a sandboxed iframe with an opaque origin. HTML/SVG start
14
+ as static previews: scripts, forms, automatic refresh and external resource loads
15
+ are blocked. An explicit button enables scripts and network access for that
16
+ preview only. Trusted file scripts can transmit their own content and contact
17
+ external services, while the sandbox still isolates DSH DOM, cookies and opener.
18
+ User-clicked hyperlinks are explicit navigations, not blocked resource loads.
19
+ Relative resources beside a file are not served by a Blob URL. Opening the same
20
+ file externally delegates trust to the chosen app.
21
+
22
+ Versions through 0.1.5 opened active HTML/SVG directly at the DSH Blob origin.
23
+ Preview isolation is included in release 0.1.7 and later. Historical release
24
+ assets have not been replaced.
25
+
26
+ Preferred applications are stored locally in the browser, by extension. Only
27
+ application IDs are saved; a preference must match a currently returned Host
28
+ association before it can be used. Preferences neither execute commands nor
29
+ change OS file associations.
30
+
31
+ Association results also cache application IDs, display names, default flags and
32
+ optional icons locally, up to 24 hours for storage reuse. Persisted answers are
33
+ revalidated in the background; explicit opens wait for that validation. Failed
34
+ opens invalidate the cache without replaying the action. File contents are not
35
+ stored in localStorage. Thumbnail Blob/data URLs remain in memory, under a
36
+ 16 MiB byte budget and a 12-entry cap, and are revoked on disposal.
37
+
38
+ Automated host tests serve only synthetic files on loopback. Optional full-Web
39
+ drivers require a separate `DFA_HOME`; they do not copy personal profiles, and
40
+ stop only a recorded launcher with matching creation time and command line.
41
+ Launch URLs and files under `test-e2e/run/` are private, ignored test state.
42
+
43
+ Report vulnerabilities privately through GitHub where available. Do not include
44
+ real file contents, cookies, API keys or authenticated launch URLs in an issue.
Binary file
package/cordis.patch.yml CHANGED
@@ -1,5 +1,5 @@
1
- # Bundle patch: one row mounts the (stateless) host half; `dsh.client` in
2
- # package.json makes the web app load ./client as the browser half.
3
- - insert:
4
- - id: dsh-file-actions
5
- name: '@jidekaixin2dian/dsh-file-actions'
1
+ # Bundle patch: one row mounts the (stateless) host half; `dsh.client` in
2
+ # package.json makes the web app load ./client as the browser half.
3
+ - insert:
4
+ - id: dsh-file-actions
5
+ name: '@jidekaixin2dian/dsh-file-actions'
package/icon.svg CHANGED
@@ -1,7 +1,7 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-label="dsh-file-actions">
2
- <rect width="64" height="64" rx="14" fill="#1b1d21"/>
3
- <path d="M18 16h18l10 10v22a4 4 0 0 1-4 4H18a4 4 0 0 1-4-4V20a4 4 0 0 1 4-4z" fill="none" stroke="#e8e8e8" stroke-width="2.4" stroke-linejoin="round"/>
4
- <path d="M36 16v10h10" fill="none" stroke="#e8e8e8" stroke-width="2.4" stroke-linejoin="round"/>
5
- <circle cx="45" cy="45" r="11" fill="#c8f663"/>
6
- <path d="M40.5 45h9M45 40.5v9" stroke="#1b1d21" stroke-width="2.6" stroke-linecap="round"/>
7
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-label="dsh-file-actions">
2
+ <rect width="64" height="64" rx="14" fill="#1b1d21"/>
3
+ <path d="M18 16h18l10 10v22a4 4 0 0 1-4 4H18a4 4 0 0 1-4-4V20a4 4 0 0 1 4-4z" fill="none" stroke="#e8e8e8" stroke-width="2.4" stroke-linejoin="round"/>
4
+ <path d="M36 16v10h10" fill="none" stroke="#e8e8e8" stroke-width="2.4" stroke-linejoin="round"/>
5
+ <circle cx="45" cy="45" r="11" fill="#c8f663"/>
6
+ <path d="M40.5 45h9M45 40.5v9" stroke="#1b1d21" stroke-width="2.6" stroke-linecap="round"/>
7
+ </svg>