@jidekaixin2dian/dsh-file-actions 0.1.20 → 0.1.21
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/CHANGELOG.md +35 -0
- package/README.en.md +30 -28
- package/README.md +30 -28
- package/assets/preview-apps.png +0 -0
- package/assets/preview-media.png +0 -0
- package/assets/preview-reference.png +0 -0
- package/assets/preview-settings.png +0 -0
- package/lib/client.js +208 -15
- package/package.json +1 -1
- package/assets/preview-conversation-files.png +0 -0
- package/assets/preview-conversation-open-with.png +0 -0
- package/assets/preview-conversation.png +0 -0
- package/assets/preview-glass.png +0 -0
- package/assets/preview-image.png +0 -0
- package/assets/preview-search.png +0 -0
- package/assets/preview-video.png +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.21 — 2026-11-10
|
|
4
|
+
|
|
5
|
+
- 菜单、子菜单与提示条接入壁纸插件的玻璃效果:只在它的浮层玻璃门
|
|
6
|
+
(`body[data-we-glass-floaters]`)打开时生效,模糊与透明度沿用它写出的
|
|
7
|
+
`--we-floaters-*` 变量,底色仍用插件自己按主题算出的可读性底,深色主题实测
|
|
8
|
+
8.0:1、浅色 14.9:1;设置页新增「玻璃效果」开关,系统开启「减少透明度」时自动
|
|
9
|
+
退回不透明。
|
|
10
|
+
- Glass surfaces for the menu, submenu and toast, driven by the wallpaper plugin's
|
|
11
|
+
floating-glass gate (`body[data-we-glass-floaters]`): its `--we-floaters-*` values
|
|
12
|
+
supply blur and alpha while this plugin keeps its own theme-derived floor — 8.0:1
|
|
13
|
+
measured in dark and 14.9:1 in light. A new "Glass effect" setting can switch it
|
|
14
|
+
off, and system-level reduced transparency falls back to an opaque surface.
|
|
15
|
+
- 相对路径找不到时向下查找:散文里常写 `docs/x.md` 而文件在更深的子目录,现在会
|
|
16
|
+
逐层(最多 3 层)并行探测,命中即停,最多 48 次 stat、900ms 预算,只接受唯一命中;
|
|
17
|
+
命中缓存 60s、未命中 5 分钟,缓存上限 200 条。
|
|
18
|
+
- Resolve a relative reference that only exists deeper in the tree: walk up to three
|
|
19
|
+
levels in parallel batches, stop at the first matching level, cap at 48 stats and a
|
|
20
|
+
900 ms budget, and accept only a single match. Hits are cached for 60 s, misses for
|
|
21
|
+
5 minutes, with a 200-entry ceiling.
|
|
22
|
+
- 指定应用打开没有真正拉起程序时给出提示:宿主在 shell 接受请求时就返回成功,因此
|
|
23
|
+
点击后 1.8 秒若焦点仍在本页,提示「已请求打开;若没有窗口出现,可能是该应用启动
|
|
24
|
+
失败或被系统拦截」,连续点击只保留最后一次。
|
|
25
|
+
- Say something when a specific-application open does not actually raise a window: the
|
|
26
|
+
Host reports success as soon as the shell accepts the request, so 1.8 s after the
|
|
27
|
+
click a still-focused page raises a hint instead of a silent no-op. Repeated clicks
|
|
28
|
+
keep only the latest hint.
|
|
29
|
+
- 文件类型扩展:新增脚本、表格、幻灯片、矢量图、Notebook、数据库、电子书七类,
|
|
30
|
+
各有独立图标与色相;补齐 wps/et/dps、msix/appx/scr/sys、vbs/reg/inf/psd1 等扩展名,
|
|
31
|
+
修复 `.exe` 一直在用兜底图标的问题;「在浏览器中打开」只对 Chromium 真能解码的
|
|
32
|
+
图片格式开放,避免打开一张破图。
|
|
33
|
+
- More file kinds: scripts, spreadsheets, slides, vector graphics, notebooks,
|
|
34
|
+
databases and e-books now each have their own glyph and hue; extensions such as
|
|
35
|
+
wps/et/dps, msix/appx/scr/sys and vbs/reg/inf/psd1 are recognised, `.exe` no longer
|
|
36
|
+
falls back to the generic glyph, and "Open in browser" is limited to the image
|
|
37
|
+
formats Chromium can actually decode.
|
|
3
38
|
## 0.1.20 — 2026-11-06
|
|
4
39
|
|
|
5
40
|
- 修复右键「已编辑 …」文件变更卡片无反应:卡片每行的已解析路径由宿主写在
|
package/README.en.md
CHANGED
|
@@ -1,47 +1,41 @@
|
|
|
1
1
|
# File Actions · 文件与链接操作
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Copy code with its source. Keep working from delivered files.**
|
|
4
4
|
|
|
5
|
-
[中文](README.md) · [npm](https://www.npmjs.com/package/@jidekaixin2dian/dsh-file-actions/v/0.1.
|
|
5
|
+
[中文](README.md) · [npm · 0.1.20](https://www.npmjs.com/package/@jidekaixin2dian/dsh-file-actions/v/0.1.20) · [Marketplace](https://awesome-dsh-plugin.com/p/jidekaixin2dian/dsh-file-actions/) · [Download](https://github.com/jidekaixin2dian/dsh-file-actions/releases/latest) · [Changelog](CHANGELOG.md)
|
|
6
6
|
|
|
7
|
-
File Actions
|
|
7
|
+
File Actions adds file and link actions to DeepSeek Harness (DSH) conversations. Right-click a code reference, delivery card or image to continue from what the agent has shown you.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
| Your next step | File Actions |
|
|
10
|
+
|---|---|
|
|
11
|
+
| Understand a code reference | Read surrounding lines with the referenced range highlighted |
|
|
12
|
+
| Share the exact excerpt | Copy code together with its source path and line range |
|
|
13
|
+
| Continue editing a delivered file | Search associated applications and save a preference per file type |
|
|
14
|
+
| Check an image or video | Preview a thumbnail, enlarge images or open a browser preview |
|
|
10
15
|
|
|
11
|
-
##
|
|
16
|
+
## Read the context, keep the source
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
|---|---|
|
|
15
|
-
| Keep editing | Open with the default app, search applications, save a preference per file type |
|
|
16
|
-
| Locate and reference | Reveal in the file manager; copy paths, names or references with line numbers |
|
|
17
|
-
| View and export | Preview supported documents and media, copy text, save a local file |
|
|
18
|
-
| Share a link | Open, copy the URL or text, copy as Markdown |
|
|
18
|
+
Right-click a reference such as `src/app.ts:42:7` or `notes.md#L42-L48` to preview its context. Copy the excerpt with its source, or copy just the referenced lines.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+

|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
- **Video preview:** the menu can show a thumbnail extracted from a video. Open supported formats in the browser to play the full video. Thumbnails depend on browser decoding and are unavailable for files over 8 MiB or when decoding fails; browser previews and saved copies are limited to 64 MiB.
|
|
24
|
-
- **Continue editing a delivered file:** use **Open with** from its conversation reference to search associated applications and save a preference by file type without changing OS defaults.
|
|
25
|
-
- **Code reference context:** when a reference retains line numbers, preview the referenced lines and surrounding context or copy the excerpt with its source path. These actions cannot recover line numbers hidden by the host.
|
|
26
|
-
- **Paths, text and links:** copy absolute or relative paths, filenames, valid UTF-8 text and referenced lines; copy a web link's URL, text or Markdown. File-content and referenced-line reads are limited to 2 MiB.
|
|
27
|
-
- **Keyboard and menu settings:** open the menu with `Shift+F10` and navigate with arrows and Enter. Choose a full or compact menu and adjust the number of context lines in reference previews.
|
|
22
|
+
## Keep working from delivered files
|
|
28
23
|
|
|
29
|
-
|
|
24
|
+
Open a file's conversation reference or changed-file card menu to choose an application, reveal the file, or copy its path, name or text. Save a preferred application for each file type.
|
|
30
25
|
|
|
31
|
-

|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
## Preview images and videos
|
|
34
29
|
|
|
35
|
-
|
|
30
|
+
See available thumbnails in the menu, enlarge images, or open a browser preview. Video thumbnails use a frame decoded by the browser; you can also save a local copy.
|
|
31
|
+
|
|
32
|
+

|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
## Adjust the menu to your workflow
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|---|---|---:|
|
|
41
|
-
| [npm package](https://api.npmjs.org/downloads/point/2026-10-23:2026-10-31/@jidekaixin2dian%2Fdsh-file-actions) | All versions, 2026-10-23 through 2026-10-31 | 1,799 |
|
|
42
|
-
| [GitHub Releases](https://api.github.com/repos/jidekaixin2dian/dsh-file-actions/releases?per_page=100) | `dsh-file-actions.tgz` across all releases, excluding checksums | 440 |
|
|
36
|
+
Choose the full or compact menu, set the number of surrounding context lines, and manage application preferences. Open the menu with `Shift+F10`, then navigate with arrows and Enter.
|
|
43
37
|
|
|
44
|
-
|
|
38
|
+

|
|
45
39
|
|
|
46
40
|
## Install and update
|
|
47
41
|
|
|
@@ -118,6 +112,14 @@ Use **Project and feedback** at the bottom of settings to visit this plugin's Gi
|
|
|
118
112
|
|
|
119
113
|
</details>
|
|
120
114
|
|
|
115
|
+
## Downloads
|
|
116
|
+
|
|
117
|
+
| GitHub archives | npm | Combined |
|
|
118
|
+
|---:|---:|---:|
|
|
119
|
+
| [623](https://api.github.com/repos/jidekaixin2dian/dsh-file-actions/releases?per_page=100) | [2,255](https://api.npmjs.org/downloads/point/2026-10-23:2026-11-04/@jidekaixin2dian%2Fdsh-file-actions) | **2,878 requests** |
|
|
120
|
+
|
|
121
|
+
Snapshot: 2026-11-06; npm data through 2026-11-04. GitHub counts installation archives; npm excludes `0.0.0-stage`. Includes repeat installs and automation, not unique users.
|
|
122
|
+
|
|
121
123
|
[Development and verification](https://github.com/jidekaixin2dian/dsh-file-actions/blob/main/docs/development.md) · [Security](SECURITY.md) · [Issues](https://github.com/jidekaixin2dian/dsh-file-actions/issues)
|
|
122
124
|
|
|
123
125
|
MIT · Independent community plugin, not affiliated with DeepSeek.
|
package/README.md
CHANGED
|
@@ -1,47 +1,41 @@
|
|
|
1
1
|
# 文件与链接操作 · File Actions
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**代码引用连同来源一起带走,交付文件右键就能接着用。**
|
|
4
4
|
|
|
5
|
-
[English](README.en.md) · [npm](https://www.npmjs.com/package/@jidekaixin2dian/dsh-file-actions/v/0.1.
|
|
5
|
+
[English](README.en.md) · [npm · 0.1.20](https://www.npmjs.com/package/@jidekaixin2dian/dsh-file-actions/v/0.1.20) · [插件市场](https://awesome-dsh-plugin.com/p/jidekaixin2dian/dsh-file-actions/) · [下载](https://github.com/jidekaixin2dian/dsh-file-actions/releases/latest) · [更新记录](CHANGELOG.md)
|
|
6
6
|
|
|
7
|
-
File Actions
|
|
7
|
+
File Actions 为 DeepSeek Harness(DSH)里的文件引用提供右键菜单。从代码行号、交付卡片或图片进入,直接查看上下文、选择应用、预览、定位和复制。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
| 你想接着做什么 | File Actions 提供什么 |
|
|
10
|
+
|---|---|
|
|
11
|
+
| 看清 Agent 引用的代码 | 只读预览引用行和前后文,高亮所引用的范围 |
|
|
12
|
+
| 把引用交给别人或另一个会话 | 一次复制引用正文、文件路径和行号 |
|
|
13
|
+
| 继续编辑交付文件 | 搜索「打开方式」,按文件类型记住首选应用 |
|
|
14
|
+
| 先看看图片和视频 | 菜单缩略图、图片放大、支持格式的浏览器预览 |
|
|
10
15
|
|
|
11
|
-
##
|
|
16
|
+
## 看上下文,也带走来源
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
|---|---|
|
|
15
|
-
| 接着编辑文件 | 用默认应用打开,或搜索「打开方式」并收藏首选应用 |
|
|
16
|
-
| 找到文件与引用 | 在文件管理器定位,复制绝对 / 相对路径、文件名或带行号引用 |
|
|
17
|
-
| 查看与带走内容 | 预览支持的文档、图片或媒体;复制文本;另存为本地文件 |
|
|
18
|
-
| 分享链接 | 打开网页,复制链接、链接文字或 Markdown |
|
|
18
|
+
右键 `src/app.ts:42:7` 或 `notes.md#L42-L48`,选择「查看引用上下文」。看懂以后,用「复制片段及来源」带走引用行、相对路径和行号;也可以只复制引用行。
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+

|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
- **视频预览**:右键视频引用,可在菜单中查看从视频提取的画面缩略图;支持的格式还能通过「在浏览器中打开」播放完整视频。缩略图依赖浏览器解码,文件超过 8 MiB 或无法解码时不会显示;浏览器预览及另存上限为 64 MiB。
|
|
24
|
-
- **交付文件接着编辑**:从当前对话的文件引用进入「打开方式」,搜索系统关联的应用并按文件类型收藏首选,不修改系统默认应用。
|
|
25
|
-
- **代码引用上下文**:保留行号的引用可只读查看引用行及前后文,也可复制引用片段和来源路径;宿主未暴露行号时无法使用这些操作。
|
|
26
|
-
- **路径、正文与链接**:复制绝对或相对路径、文件名、有效 UTF-8 文本与引用行;网页链接可复制地址、文字或 Markdown。文件内容和引用行限 2 MiB。
|
|
27
|
-
- **键盘操作与菜单设置**:用 `Shift+F10` 打开菜单,方向键与 Enter 选择执行;可切换完整或精简菜单,并调整引用预览的前后文行数。
|
|
22
|
+
## 交付文件直接接着用
|
|
28
23
|
|
|
29
|
-
|
|
24
|
+
在对话文件引用或「已编辑」变更卡片上右键,选择应用、在文件管理器中定位,或复制路径、文件名与内容。「打开方式」可以搜索系统关联应用,并按文件类型收藏首选。
|
|
30
25
|
|
|
31
|
-

|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
## 图片和视频,先看再处理
|
|
34
29
|
|
|
35
|
-
|
|
30
|
+
图片引用可以显示缩略图并放大查看;视频引用可以提取预览帧。需要继续查看时,用「在浏览器中打开」预览支持的文档、图片或媒体,也可另存到本地。
|
|
31
|
+
|
|
32
|
+

|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
## 按习惯调整菜单
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|---|---|---:|
|
|
41
|
-
| [npm 包](https://api.npmjs.org/downloads/point/2026-10-23:2026-10-31/@jidekaixin2dian%2Fdsh-file-actions) | 2026-10-23 至 2026-10-31,全部版本 | 1,799 |
|
|
42
|
-
| [GitHub Release](https://api.github.com/repos/jidekaixin2dian/dsh-file-actions/releases?per_page=100) | 全部版本的 `dsh-file-actions.tgz`,不含校验文件 | 440 |
|
|
36
|
+
在「设置 → 文件操作」切换完整或精简菜单,调整引用前后文行数,管理首选应用和关联应用缓存。键盘也能操作:`Shift+F10` 打开,方向键选择,`Enter` 执行。
|
|
43
37
|
|
|
44
|
-
|
|
38
|
+

|
|
45
39
|
|
|
46
40
|
## 安装与更新
|
|
47
41
|
|
|
@@ -120,6 +114,14 @@ dsh plugin --profile desktop remove @jidekaixin2dian/dsh-file-actions
|
|
|
120
114
|
|
|
121
115
|
</details>
|
|
122
116
|
|
|
117
|
+
## 下载情况
|
|
118
|
+
|
|
119
|
+
| GitHub 安装包 | npm | 合计 |
|
|
120
|
+
|---:|---:|---:|
|
|
121
|
+
| [623](https://api.github.com/repos/jidekaixin2dian/dsh-file-actions/releases?per_page=100) | [2,255](https://api.npmjs.org/downloads/point/2026-10-23:2026-11-04/@jidekaixin2dian%2Fdsh-file-actions) | **2,878 次** |
|
|
122
|
+
|
|
123
|
+
统计于 2026-11-06;npm 数据截至 2026-11-04。GitHub 仅计安装包,npm 排除 `0.0.0-stage`。下载包含重复安装与自动化请求,不是独立用户数。
|
|
124
|
+
|
|
123
125
|
[开发与验证](https://github.com/jidekaixin2dian/dsh-file-actions/blob/main/docs/development.md) · [安全说明](SECURITY.md) · [反馈问题](https://github.com/jidekaixin2dian/dsh-file-actions/issues)
|
|
124
126
|
|
|
125
127
|
MIT · 独立社区插件,与 DeepSeek 官方无隶属关系。
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -40,6 +40,7 @@ const factory = (require) => {
|
|
|
40
40
|
github: 'GitHub 项目', feedback: '反馈问题',
|
|
41
41
|
scope: '仅保存在当前浏览器或 Desktop 客户端;不会修改系统默认应用。',
|
|
42
42
|
display: '菜单与预览', menuMode: '菜单显示', full: '完整菜单', compact: '精简菜单',
|
|
43
|
+
glass: '玻璃效果', glassHint: '跟随壁纸插件的磨砂与透明度;底色始终保留可读性', glassOn: '跟随壁纸', glassOff: '关闭',
|
|
43
44
|
menuHelp: '精简模式保留打开、打开方式、定位、引用预览、复制路径与正文、另存等常用操作。',
|
|
44
45
|
contextLines: '引用前后文', contextOption: '前后各 {count} 行',
|
|
45
46
|
defaults: '恢复菜单与预览默认设置',
|
|
@@ -97,10 +98,12 @@ const factory = (require) => {
|
|
|
97
98
|
binary: '二进制文件,无法复制为文本',
|
|
98
99
|
confirmOutsideCopy: '该文件在会话工作区之外,不是本对话的一部分。确认要把它的内容复制到剪贴板吗?\n{path}',
|
|
99
100
|
openFailed: '打开失败',
|
|
101
|
+
openNoEffect: '已请求打开;若没有窗口出现,可能是该应用启动失败或被系统拦截',
|
|
100
102
|
revealFailed: '无法定位该文件',
|
|
101
103
|
popupBlocked: '浏览器拦截了新窗口',
|
|
102
104
|
noSession: '没有可用的会话',
|
|
103
105
|
notFound: '找不到该文件',
|
|
106
|
+
locating: '正在查找同名文件…',
|
|
104
107
|
outsideWorkspace: '工作区外',
|
|
105
108
|
defaultApp: '默认',
|
|
106
109
|
appsUnit: '个应用',
|
|
@@ -139,12 +142,19 @@ const factory = (require) => {
|
|
|
139
142
|
html: '网页',
|
|
140
143
|
pdf: 'PDF',
|
|
141
144
|
image: '图片',
|
|
142
|
-
office: '
|
|
145
|
+
office: 'Word 文档',
|
|
146
|
+
sheet: '表格',
|
|
147
|
+
slides: '幻灯片',
|
|
148
|
+
svg: '矢量图',
|
|
149
|
+
notebook: 'Notebook',
|
|
150
|
+
database: '数据库',
|
|
151
|
+
ebook: '电子书',
|
|
143
152
|
archive: '压缩包',
|
|
144
153
|
video: '视频',
|
|
145
154
|
audio: '音频',
|
|
146
155
|
subtitle: '字幕',
|
|
147
156
|
code: '代码',
|
|
157
|
+
script: '脚本',
|
|
148
158
|
data: '数据',
|
|
149
159
|
font: '字体',
|
|
150
160
|
design: '设计稿',
|
|
@@ -169,6 +179,7 @@ const factory = (require) => {
|
|
|
169
179
|
github: 'GitHub project', feedback: 'Report an issue',
|
|
170
180
|
scope: 'Saved in this browser or Desktop client only. System default applications stay unchanged.',
|
|
171
181
|
display: 'Menu and preview', menuMode: 'Menu display', full: 'Full menu', compact: 'Compact menu',
|
|
182
|
+
glass: 'Glass effect', glassHint: 'Follows the wallpaper plugin’s blur and alpha; the base colour keeps text readable', glassOn: 'Follow wallpaper', glassOff: 'Off',
|
|
172
183
|
menuHelp: 'Compact mode keeps open, open with, reveal, reference context, path and text copying, and save actions.',
|
|
173
184
|
contextLines: 'Reference context', contextOption: '{count} lines before and after',
|
|
174
185
|
defaults: 'Reset menu and preview defaults',
|
|
@@ -226,10 +237,12 @@ const factory = (require) => {
|
|
|
226
237
|
binary: 'Binary file cannot be copied as text',
|
|
227
238
|
confirmOutsideCopy: 'This file is outside the session workspace and not part of this conversation. Copy its contents to the clipboard?\n{path}',
|
|
228
239
|
openFailed: 'Open failed',
|
|
240
|
+
openNoEffect: 'Open requested; if no window appeared, the app may have failed to start or was blocked',
|
|
229
241
|
revealFailed: 'Could not reveal this file',
|
|
230
242
|
popupBlocked: 'The browser blocked the new window',
|
|
231
243
|
noSession: 'No active session',
|
|
232
244
|
notFound: 'File not found',
|
|
245
|
+
locating: 'Looking for the file…',
|
|
233
246
|
outsideWorkspace: 'Outside workspace',
|
|
234
247
|
defaultApp: 'Default',
|
|
235
248
|
appsUnit: 'apps',
|
|
@@ -268,12 +281,19 @@ const factory = (require) => {
|
|
|
268
281
|
html: 'Web page',
|
|
269
282
|
pdf: 'PDF',
|
|
270
283
|
image: 'Image',
|
|
271
|
-
office: '
|
|
284
|
+
office: 'Word document',
|
|
285
|
+
sheet: 'Spreadsheet',
|
|
286
|
+
slides: 'Presentation',
|
|
287
|
+
svg: 'Vector graphic',
|
|
288
|
+
notebook: 'Notebook',
|
|
289
|
+
database: 'Database',
|
|
290
|
+
ebook: 'E-book',
|
|
272
291
|
archive: 'Archive',
|
|
273
292
|
video: 'Video',
|
|
274
293
|
audio: 'Audio',
|
|
275
294
|
subtitle: 'Subtitle',
|
|
276
295
|
code: 'Code',
|
|
296
|
+
script: 'Script',
|
|
277
297
|
data: 'Data',
|
|
278
298
|
font: 'Font',
|
|
279
299
|
design: 'Design',
|
|
@@ -312,18 +332,25 @@ const factory = (require) => {
|
|
|
312
332
|
// shaders, typesetting
|
|
313
333
|
'glsl', 'hlsl', 'wgsl', 'frag', 'vert', 'comp', 'shader', 'mtl', 'tex', 'bib', 'rtf',
|
|
314
334
|
])
|
|
315
|
-
const IMAGE_EXT = new Set(['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'ico', 'avif', 'tif', 'tiff', 'heic', 'heif', 'jfif'])
|
|
316
|
-
const HTML_EXT = new Set(['html', 'htm', 'xhtml'
|
|
335
|
+
const IMAGE_EXT = new Set(['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'ico', 'avif', 'tif', 'tiff', 'heic', 'heif', 'jfif', 'jxl', 'jp2', 'tga', 'dds', 'exr', 'hdr', 'psb', 'wmf', 'emf'])
|
|
336
|
+
const HTML_EXT = new Set(['html', 'htm', 'xhtml'])
|
|
317
337
|
const PDF_EXT = new Set(['pdf'])
|
|
318
338
|
const MD_EXT = new Set(['md', 'markdown', 'mdx'])
|
|
319
|
-
const OFFICE_EXT = new Set(['doc', 'docx', '
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
339
|
+
const OFFICE_EXT = new Set(['doc', 'docx', 'docm', 'dotx', 'odt', 'rtf', 'pages', 'wps'])
|
|
340
|
+
const SHEET_EXT = new Set(['xls', 'xlsx', 'xlsm', 'xlsb', 'ods', 'numbers', 'et'])
|
|
341
|
+
const SLIDES_EXT = new Set(['ppt', 'pptx', 'pps', 'ppsx', 'odp', 'key', 'dps'])
|
|
342
|
+
const SVG_EXT = new Set(['svg'])
|
|
343
|
+
const NOTEBOOK_EXT = new Set(['ipynb'])
|
|
344
|
+
const DATABASE_EXT = new Set(['db', 'sqlite', 'sqlite3', 'mdb', 'accdb', 'parquet', 'avro', 'orc', 'feather', 'dbf'])
|
|
345
|
+
const EBOOK_EXT = new Set(['epub', 'mobi', 'azw', 'azw3', 'fb2', 'djvu'])
|
|
346
|
+
const ARCHIVE_EXT = new Set(['zip', 'tar', 'gz', 'tgz', 'bz2', 'xz', '7z', 'rar', 'zst', 'lz4', 'cab', 'arj', 'lha', 'lzh'])
|
|
347
|
+
const VIDEO_EXT = new Set(['mp4', 'm4v', 'mov', 'webm', 'ogv', 'mkv', 'avi', 'wmv', 'flv', 'mpg', 'mpeg', '3gp', 'mts', 'm2ts', 'vob', 'rmvb', 'f4v', 'asf'])
|
|
348
|
+
const AUDIO_EXT = new Set(['mp3', 'wav', 'flac', 'm4a', 'aac', 'ogg', 'oga', 'opus', 'wma', 'aiff', 'mid', 'midi', 'ape', 'mka', 'amr', 'aif', 'ac3', 'dts', 'm4b'])
|
|
323
349
|
const SUBTITLE_EXT = new Set(['srt', 'ass', 'ssa', 'vtt', 'sub', 'sbv', 'lrc'])
|
|
324
350
|
const DATA_EXT = new Set(['json', 'jsonc', 'json5', 'jsonl', 'ndjson', 'har', 'yaml', 'yml', 'toml', 'ini',
|
|
325
|
-
'cfg', 'conf', 'properties', 'plist', 'lock', 'csv', 'tsv', 'xml', 'xsd', 'xsl', 'xslt', 'sql'])
|
|
326
|
-
const
|
|
351
|
+
'cfg', 'conf', 'properties', 'plist', 'lock', 'csv', 'tsv', 'xml', 'xsd', 'xsl', 'xslt', 'sql', 'reg', 'inf', 'psd1', 'ps1xml'])
|
|
352
|
+
const SCRIPT_EXT = new Set(['ps1', 'psm1', 'bat', 'cmd', 'sh', 'bash', 'zsh', 'fish', 'vbs', 'vbe', 'wsf', 'wsh', 'jse', 'ksh', 'csh', 'awk', 'sed', 'tcl'])
|
|
353
|
+
const CODE_EXT = new Set(['js', 'mjs', 'cjs', 'jsx', 'ts', 'mts', 'cts', 'tsx', 'vue', 'svelte', 'astro', 'css',
|
|
327
354
|
'scss', 'sass', 'less', 'styl', 'hbs', 'ejs', 'pug', 'twig', 'liquid', 'njk', 'py', 'pyi', 'rb', 'php', 'go',
|
|
328
355
|
'rs', 'java', 'kt', 'kts', 'scala', 'groovy', 'clj', 'cljs', 'ex', 'exs', 'erl', 'hrl', 'hs', 'elm', 'lua',
|
|
329
356
|
'pl', 'r', 'jl', 'dart', 'swift', 'm', 'mm', 'fs', 'fsx', 'cs', 'vb', 'pas', 'f90', 'for', 'asm', 's', 'v',
|
|
@@ -336,10 +363,11 @@ const factory = (require) => {
|
|
|
336
363
|
const MODEL_EXT = new Set(['blend', 'fbx', 'obj', 'glb', 'gltf', 'stl', 'step', 'stp', 'iges', 'igs', '3ds',
|
|
337
364
|
'max', 'c4d', 'ma', 'mb', 'abc', 'usd', 'usdz'])
|
|
338
365
|
const DISK_EXT = new Set(['iso', 'dmg', 'vhd', 'vhdx', 'vmdk', 'img'])
|
|
339
|
-
const EXEC_EXT = new Set(['exe', 'msi', 'dll', 'so', 'dylib', 'class', 'jar', 'war', 'apk', 'ipa',
|
|
340
|
-
'appimage', 'wasm'])
|
|
366
|
+
const EXEC_EXT = new Set(['exe', 'msi', 'msix', 'appx', 'dll', 'ocx', 'so', 'dylib', 'class', 'jar', 'war', 'apk', 'ipa',
|
|
367
|
+
'deb', 'rpm', 'appimage', 'wasm', 'scr', 'sys', 'cpl', 'msc'])
|
|
341
368
|
// Chromium can play these in a blob tab; the rest only get external actions.
|
|
342
|
-
const
|
|
369
|
+
const BROWSER_IMAGE = new Set(['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'ico', 'avif'])
|
|
370
|
+
const BROWSER_VIDEO = new Set(['mp4', 'm4v', 'mov', 'webm', 'ogv'])
|
|
343
371
|
const BROWSER_AUDIO = new Set(['mp3', 'wav', 'flac', 'm4a', 'ogg', 'oga', 'opus'])
|
|
344
372
|
|
|
345
373
|
const KNOWN_EXT = new Set([...TEXT_EXT, ...IMAGE_EXT, ...PDF_EXT, ...OFFICE_EXT, ...ARCHIVE_EXT, ...VIDEO_EXT, ...AUDIO_EXT,
|
|
@@ -548,11 +576,17 @@ const factory = (require) => {
|
|
|
548
576
|
function classify(path, isDir) {
|
|
549
577
|
if (isDir) return { kind: 'dir', ext: '', canCopyText: false, canBrowser: false, canSaveAs: false }
|
|
550
578
|
const ext = extname(path)
|
|
551
|
-
if (IMAGE_EXT.has(ext)) return { kind: 'image', ext, canCopyText: false, canBrowser:
|
|
579
|
+
if (IMAGE_EXT.has(ext)) return { kind: 'image', ext, canCopyText: false, canBrowser: BROWSER_IMAGE.has(ext), canSaveAs: true }
|
|
580
|
+
if (SVG_EXT.has(ext)) return { kind: 'svg', ext, canCopyText: true, canBrowser: true, canSaveAs: true }
|
|
552
581
|
if (HTML_EXT.has(ext)) return { kind: 'html', ext, canCopyText: true, canBrowser: true, canSaveAs: true }
|
|
553
582
|
if (PDF_EXT.has(ext)) return { kind: 'pdf', ext, canCopyText: false, canBrowser: true, canSaveAs: true }
|
|
554
583
|
if (MD_EXT.has(ext)) return { kind: 'markdown', ext, canCopyText: true, canBrowser: true, canSaveAs: true }
|
|
584
|
+
if (SHEET_EXT.has(ext)) return { kind: 'sheet', ext, canCopyText: false, canBrowser: false, canSaveAs: true }
|
|
585
|
+
if (SLIDES_EXT.has(ext)) return { kind: 'slides', ext, canCopyText: false, canBrowser: false, canSaveAs: true }
|
|
555
586
|
if (OFFICE_EXT.has(ext)) return { kind: 'office', ext, canCopyText: false, canBrowser: false, canSaveAs: true }
|
|
587
|
+
if (NOTEBOOK_EXT.has(ext)) return { kind: 'notebook', ext, canCopyText: true, canBrowser: false, canSaveAs: true }
|
|
588
|
+
if (DATABASE_EXT.has(ext)) return { kind: 'database', ext, canCopyText: false, canBrowser: false, canSaveAs: true }
|
|
589
|
+
if (EBOOK_EXT.has(ext)) return { kind: 'ebook', ext, canCopyText: false, canBrowser: false, canSaveAs: true }
|
|
556
590
|
if (ARCHIVE_EXT.has(ext)) return { kind: 'archive', ext, canCopyText: false, canBrowser: false, canSaveAs: true }
|
|
557
591
|
if (VIDEO_EXT.has(ext)) return { kind: 'video', ext, canCopyText: false, canBrowser: BROWSER_VIDEO.has(ext), canSaveAs: true }
|
|
558
592
|
if (AUDIO_EXT.has(ext)) return { kind: 'audio', ext, canCopyText: false, canBrowser: BROWSER_AUDIO.has(ext), canSaveAs: true }
|
|
@@ -562,6 +596,7 @@ const factory = (require) => {
|
|
|
562
596
|
if (MODEL_EXT.has(ext)) return { kind: 'model', ext, canCopyText: false, canBrowser: false, canSaveAs: true }
|
|
563
597
|
if (DISK_EXT.has(ext)) return { kind: 'disk', ext, canCopyText: false, canBrowser: false, canSaveAs: true }
|
|
564
598
|
if (EXEC_EXT.has(ext)) return { kind: 'exec', ext, canCopyText: false, canBrowser: false, canSaveAs: true }
|
|
599
|
+
if (SCRIPT_EXT.has(ext)) return { kind: 'script', ext, canCopyText: true, canBrowser: false, canSaveAs: true }
|
|
565
600
|
if (CODE_EXT.has(ext)) return { kind: 'code', ext, canCopyText: true, canBrowser: false, canSaveAs: true }
|
|
566
601
|
if (DATA_EXT.has(ext)) return { kind: 'data', ext, canCopyText: true, canBrowser: false, canSaveAs: true }
|
|
567
602
|
if (TEXT_EXT.has(ext)) return { kind: 'text', ext, canCopyText: true, canBrowser: false, canSaveAs: true }
|
|
@@ -630,6 +665,7 @@ const factory = (require) => {
|
|
|
630
665
|
const CLIENT_SETTINGS_KEY = 'dsh-file-actions.settings.v1'
|
|
631
666
|
function clientPreferences(storage) {
|
|
632
667
|
const sanitize = value => ({ menuMode: value?.menuMode === 'compact' ? 'compact' : 'full',
|
|
668
|
+
glass: value?.glass === 'off' ? 'off' : 'on',
|
|
633
669
|
contextLines: [4, 8, 16].includes(value?.contextLines) ? value.contextLines : 8 })
|
|
634
670
|
return {
|
|
635
671
|
get() { try { return sanitize(JSON.parse(storage.getItem(CLIENT_SETTINGS_KEY) || '{}')) } catch { return sanitize(null) } },
|
|
@@ -918,6 +954,11 @@ const factory = (require) => {
|
|
|
918
954
|
web: '<rect x="3" y="4.5" width="18" height="15" rx="2.6"/><path d="M3 9.4h18"/><circle cx="6.6" cy="6.9" r=".75" fill="currentColor" stroke="none"/><circle cx="9.3" cy="6.9" r=".75" fill="currentColor" stroke="none"/>',
|
|
919
955
|
doc: '<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/><path d="M8.5 13h7"/><path d="M8.5 17h4.5"/>',
|
|
920
956
|
office: '<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/><path d="M8.6 12.4h6.8"/><path d="M8.6 16.4h6.8"/><path d="M12 12.4v4"/>',
|
|
957
|
+
sheet: '<rect x="4" y="3.5" width="16" height="17" rx="2"/><path d="M4 9.2h16"/><path d="M4 14.8h16"/><path d="M10.2 3.5v17"/>',
|
|
958
|
+
slides: '<rect x="3.5" y="4.2" width="17" height="11.2" rx="2"/><path d="M12 15.4v3.4"/><path d="M9 20h6"/>',
|
|
959
|
+
notebook: '<rect x="4.5" y="3.5" width="15" height="17" rx="2"/><path d="M8.2 3.5v17"/><path d="M11.5 8.6h5"/><path d="M11.5 12.4h5"/>',
|
|
960
|
+
database: '<ellipse cx="12" cy="6.2" rx="7" ry="2.8"/><path d="M5 6.2v5.6c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8V6.2"/><path d="M5 11.8v6c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8v-6"/>',
|
|
961
|
+
ebook: '<path d="M4 5.6a2 2 0 0 1 2-2h5v16.8H6a2 2 0 0 1-2-2z"/><path d="M20 5.6a2 2 0 0 0-2-2h-5v16.8h5a2 2 0 0 0 2-2z"/>',
|
|
921
962
|
archive: '<rect x="3" y="4" width="18" height="4.6" rx="1.6"/><path d="M5 8.6V18a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8.6"/><path d="M10 12.6h4"/>',
|
|
922
963
|
binary: '<rect x="4" y="4" width="6.2" height="7" rx="2"/><rect x="13.8" y="13" width="6.2" height="7" rx="2"/><path d="M5.4 20.2h3.4"/><path d="M15.2 10.8h3.4"/><path d="M6.8 7.6h1.1v3"/><path d="M16.6 16.6h1.1v3"/>',
|
|
923
964
|
bookmark: '<path d="M7 4.6h10a1.6 1.6 0 0 1 1.6 1.6V21L12 16.8 5.4 21V6.2A1.6 1.6 0 0 1 7 4.6z"/>',
|
|
@@ -932,6 +973,7 @@ const factory = (require) => {
|
|
|
932
973
|
model: '<path d="M12 3.2 3.8 7.6v8.8L12 20.8l8.2-4.4V7.6z"/><path d="M3.8 7.6 12 12l8.2-4.4"/><path d="M12 12v8.8"/>',
|
|
933
974
|
disk: '<circle cx="12" cy="12" r="8.6"/><circle cx="12" cy="12" r="2.6"/><path d="M12 3.4v3.6"/>',
|
|
934
975
|
exec: '<rect x="3" y="4.6" width="18" height="14.8" rx="2.6"/><path d="m7.4 10 2.9 2.4-2.9 2.4"/><path d="M13.2 14.8h3.6"/>',
|
|
976
|
+
script: '<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/><path d="m8.8 12.6 2.2 2-2.2 2"/><path d="M12.8 16.6h3"/>',
|
|
935
977
|
unknown: '<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/><circle cx="9.6" cy="14.2" r=".95" fill="currentColor" stroke="none"/><circle cx="12" cy="14.2" r=".95" fill="currentColor" stroke="none"/><circle cx="14.4" cy="14.2" r=".95" fill="currentColor" stroke="none"/>',
|
|
936
978
|
}
|
|
937
979
|
|
|
@@ -943,6 +985,12 @@ const factory = (require) => {
|
|
|
943
985
|
pdf: 'doc',
|
|
944
986
|
image: 'image',
|
|
945
987
|
office: 'office',
|
|
988
|
+
sheet: 'sheet',
|
|
989
|
+
slides: 'slides',
|
|
990
|
+
svg: 'image',
|
|
991
|
+
notebook: 'notebook',
|
|
992
|
+
database: 'database',
|
|
993
|
+
ebook: 'ebook',
|
|
946
994
|
archive: 'archive',
|
|
947
995
|
binary: 'unknown',
|
|
948
996
|
dir: 'folder',
|
|
@@ -957,6 +1005,7 @@ const factory = (require) => {
|
|
|
957
1005
|
model: 'model',
|
|
958
1006
|
disk: 'disk',
|
|
959
1007
|
exec: 'exec',
|
|
1008
|
+
script: 'script',
|
|
960
1009
|
}
|
|
961
1010
|
|
|
962
1011
|
function iconSvg(name) {
|
|
@@ -1046,6 +1095,12 @@ const factory = (require) => {
|
|
|
1046
1095
|
.dfa-tile[data-kind="pdf"]{--dfa-hue:#e5484d}
|
|
1047
1096
|
.dfa-tile[data-kind="image"]{--dfa-hue:#2fa46b}
|
|
1048
1097
|
.dfa-tile[data-kind="office"]{--dfa-hue:#2f6fdb}
|
|
1098
|
+
.dfa-tile[data-kind="sheet"]{--dfa-hue:#1f8f5f}
|
|
1099
|
+
.dfa-tile[data-kind="slides"]{--dfa-hue:#d97727}
|
|
1100
|
+
.dfa-tile[data-kind="svg"]{--dfa-hue:#12a594}
|
|
1101
|
+
.dfa-tile[data-kind="notebook"]{--dfa-hue:#0e9aa7}
|
|
1102
|
+
.dfa-tile[data-kind="database"]{--dfa-hue:#6b6ef0}
|
|
1103
|
+
.dfa-tile[data-kind="ebook"]{--dfa-hue:#a455d8}
|
|
1049
1104
|
.dfa-tile[data-kind="archive"]{--dfa-hue:#c9971f}
|
|
1050
1105
|
.dfa-tile[data-kind="binary"]{--dfa-hue:#8b8d98}
|
|
1051
1106
|
.dfa-tile[data-kind="dir"]{--dfa-hue:#c9971f}
|
|
@@ -1060,6 +1115,7 @@ const factory = (require) => {
|
|
|
1060
1115
|
.dfa-tile[data-kind="model"]{--dfa-hue:#6f5cff}
|
|
1061
1116
|
.dfa-tile[data-kind="disk"]{--dfa-hue:#a06a3a}
|
|
1062
1117
|
.dfa-tile[data-kind="exec"]{--dfa-hue:#5f6b7a}
|
|
1118
|
+
.dfa-tile[data-kind="script"]{--dfa-hue:#7a8f3c}
|
|
1063
1119
|
.dfa-headtext{display:flex;flex-direction:column;gap:1px;min-width:0;flex:1}
|
|
1064
1120
|
.dfa-name{font-weight:600;font-size:1em;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1065
1121
|
.dfa-path{font-family:var(--ds-font-family-code,Consolas,monospace);font-size:.85em;line-height:1.4;
|
|
@@ -1150,6 +1206,24 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
|
|
|
1150
1206
|
opacity:0;transition:opacity .16s ease}
|
|
1151
1207
|
.dfa-toast[data-show="true"]{opacity:1}
|
|
1152
1208
|
.dfa-toast[data-error="true"]{color:var(--dsw-alias-state-error-primary,#f85149)}
|
|
1209
|
+
/* Wallpaper-engine integration: when its floaters glass gate is open on <body>, borrow
|
|
1210
|
+
its blur and alpha knobs but keep this plugin's own theme-derived floor. The floor — not
|
|
1211
|
+
the tint — is what holds text contrast over any wallpaper, in light and dark themes. */
|
|
1212
|
+
html[data-dfa-glass="on"] body[data-we-glass-floaters] .dfa-menu,
|
|
1213
|
+
html[data-dfa-glass="on"] body[data-we-glass-floaters] .dfa-sub,
|
|
1214
|
+
html[data-dfa-glass="on"] body[data-we-glass-floaters] .dfa-toast{
|
|
1215
|
+
background-color:color-mix(in srgb,var(--we-surface-tint-light,#fff) calc(var(--we-floaters-alpha,.55) * 35%),var(--dfa-floor,Canvas) calc(max(var(--we-readability-floor,.82),.86) * 100%));
|
|
1216
|
+
background-image:linear-gradient(180deg,rgba(255,255,255,.16),rgba(255,255,255,.04) 42%,rgba(255,255,255,.01));
|
|
1217
|
+
-webkit-backdrop-filter:blur(var(--we-floaters-blur,18px)) saturate(1.25);
|
|
1218
|
+
backdrop-filter:blur(var(--we-floaters-blur,18px)) saturate(1.25);
|
|
1219
|
+
box-shadow:0 18px 48px rgba(0,0,0,.38),inset 0 1px 0 rgba(255,255,255,.2)}
|
|
1220
|
+
/* System-level transparency preference wins over the wallpaper look. */
|
|
1221
|
+
@media (prefers-reduced-transparency:reduce){
|
|
1222
|
+
html[data-dfa-glass="on"] body[data-we-glass-floaters] .dfa-menu,
|
|
1223
|
+
html[data-dfa-glass="on"] body[data-we-glass-floaters] .dfa-sub,
|
|
1224
|
+
html[data-dfa-glass="on"] body[data-we-glass-floaters] .dfa-toast{
|
|
1225
|
+
background-color:var(--dfa-floor,Canvas);background-image:none;
|
|
1226
|
+
-webkit-backdrop-filter:none;backdrop-filter:none}}
|
|
1153
1227
|
`
|
|
1154
1228
|
|
|
1155
1229
|
function ensureCss() {
|
|
@@ -1301,6 +1375,16 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
|
|
|
1301
1375
|
} catch { /* not a directory either */ }
|
|
1302
1376
|
return { error: failure }
|
|
1303
1377
|
},
|
|
1378
|
+
/** Immediate children of one directory, or null when it is not a directory. */
|
|
1379
|
+
async list(sessionId, path) {
|
|
1380
|
+
if (!files) return null
|
|
1381
|
+
try {
|
|
1382
|
+
const listing = unwrap(await boundedCall(() => files.list(sessionId, path)))
|
|
1383
|
+
return listing && Array.isArray(listing.entries) ? listing.entries : null
|
|
1384
|
+
} catch {
|
|
1385
|
+
return null
|
|
1386
|
+
}
|
|
1387
|
+
},
|
|
1304
1388
|
async applications(path) {
|
|
1305
1389
|
if (!sessionApi) return { state: 'failed', apps: [] }
|
|
1306
1390
|
try {
|
|
@@ -1697,6 +1781,7 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
|
|
|
1697
1781
|
for (const [key, label, help, options] of [
|
|
1698
1782
|
['menuMode', c.menuMode, c.menuHint, [['full', c.full], ['compact', c.compact]]],
|
|
1699
1783
|
['contextLines', c.contextLines, c.contextHint, [4, 8, 16].map(n => [String(n), c.contextOption.replace('{count}', n)])],
|
|
1784
|
+
['glass', c.glass, c.glassHint, [['on', c.glassOn], ['off', c.glassOff]]],
|
|
1700
1785
|
]) {
|
|
1701
1786
|
const id = `dfa-setting-${key}`
|
|
1702
1787
|
const selected = String(value[key])
|
|
@@ -2831,6 +2916,14 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
|
|
|
2831
2916
|
return { text, version: result.version }
|
|
2832
2917
|
}
|
|
2833
2918
|
|
|
2919
|
+
// A specific-application open is reported as success as soon as the shell accepts the
|
|
2920
|
+
// request, so a handler that dies on launch still looks fine. Only a focus change
|
|
2921
|
+
// proves a real window took over; otherwise the click would stay silent.
|
|
2922
|
+
let silentHintTimer = 0
|
|
2923
|
+
function shouldHintSilentOpen(hadFocus, focusedAfter) {
|
|
2924
|
+
return hadFocus === true && focusedAfter === true
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2834
2927
|
async function dispatch(item, target, context) {
|
|
2835
2928
|
const { bridge, t, sessionId } = context
|
|
2836
2929
|
const path = target.absolutePath
|
|
@@ -2850,10 +2943,19 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
|
|
|
2850
2943
|
toast(t.appUnavailable, { error: true })
|
|
2851
2944
|
return
|
|
2852
2945
|
}
|
|
2946
|
+
// The Host reports success as soon as the shell accepts the request, so a handler
|
|
2947
|
+
// that dies on launch still looks fine. Only a focus change proves a window took
|
|
2948
|
+
// over; otherwise a specific-application open would stay completely silent.
|
|
2949
|
+
const hadFocus = typeof document.hasFocus === 'function' && document.hasFocus()
|
|
2853
2950
|
const ok = await bridge.open(path, item.appId)
|
|
2854
2951
|
if (!ok) {
|
|
2855
2952
|
toast(t.openFailed, { error: true })
|
|
2856
2953
|
context.onOpenFailed?.(path)
|
|
2954
|
+
} else if (item.appId && hadFocus) {
|
|
2955
|
+
clearTimeout(silentHintTimer)
|
|
2956
|
+
silentHintTimer = setTimeout(() => {
|
|
2957
|
+
if (!disposed && shouldHintSilentOpen(hadFocus, document.hasFocus())) toast(t.openNoEffect)
|
|
2958
|
+
}, 1800)
|
|
2857
2959
|
}
|
|
2858
2960
|
return
|
|
2859
2961
|
}
|
|
@@ -2985,6 +3087,83 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
|
|
|
2985
3087
|
const cached = probeCache.get(locate(candidate).key)
|
|
2986
3088
|
return cached && Date.now() - cached.at < 5000 ? cached.value : null
|
|
2987
3089
|
}
|
|
3090
|
+
|
|
3091
|
+
// A relative reference in prose often names a file that only exists one directory
|
|
3092
|
+
// down — `docs/HANDOFF.md` while the session root is its parent. Try the root's
|
|
3093
|
+
// immediate subdirectories once: a single hit is unambiguous, several are a guess.
|
|
3094
|
+
const RESCUE_TTL_MS = 60 * 1000
|
|
3095
|
+
const rescueCache = new Map()
|
|
3096
|
+
const RESCUE_CACHE_MAX = 200
|
|
3097
|
+
function rememberRescue(key, path) {
|
|
3098
|
+
if (rescueCache.size >= RESCUE_CACHE_MAX && !rescueCache.has(key)) rescueCache.delete(rescueCache.keys().next().value)
|
|
3099
|
+
rescueCache.set(key, { path, at: Date.now() })
|
|
3100
|
+
}
|
|
3101
|
+
// Prose often abbreviates a path that lives several directories down — `docs/x.md`
|
|
3102
|
+
// while the session root is three levels above it. Walk the tree breadth-first with a
|
|
3103
|
+
// hard call/time budget and accept a result only when exactly one descendant matches;
|
|
3104
|
+
// a second hit means the name is ambiguous, which is the caller's problem, not ours.
|
|
3105
|
+
const RESCUE_MAX_DEPTH = 3
|
|
3106
|
+
const RESCUE_MAX_PROBES = 48
|
|
3107
|
+
const RESCUE_BUDGET_MS = 900
|
|
3108
|
+
const RESCUE_MISS_TTL_MS = 5 * 60 * 1000
|
|
3109
|
+
const RESCUE_PARALLEL = 6
|
|
3110
|
+
// Build output never holds the file a message refers to, and walking it costs the
|
|
3111
|
+
// whole budget on its own.
|
|
3112
|
+
const RESCUE_SKIP = new Set(['node_modules', 'dist', 'build', 'out', 'bin', 'obj', 'target', 'vendor', 'coverage'])
|
|
3113
|
+
|
|
3114
|
+
async function eachLimited(items, worker, limit = RESCUE_PARALLEL) {
|
|
3115
|
+
let cursor = 0
|
|
3116
|
+
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, async () => {
|
|
3117
|
+
while (cursor < items.length) {
|
|
3118
|
+
const index = cursor++
|
|
3119
|
+
await worker(items[index])
|
|
3120
|
+
}
|
|
3121
|
+
}))
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3124
|
+
// Prose often abbreviates where a file lives on disk. Walk the tree breadth-first, one
|
|
3125
|
+
// level at a time in small parallel batches, and stop at the first matching level:
|
|
3126
|
+
// shallower wins, and two hits at that level mean the name is ambiguous, not usable.
|
|
3127
|
+
async function resolveBelowRoot(session, relativePath) {
|
|
3128
|
+
if (!session || !relativePath || isAbsolutePath(relativePath)) return null
|
|
3129
|
+
// A bare file name matches half the tree; only a path with a directory part is
|
|
3130
|
+
// specific enough to be worth the walk.
|
|
3131
|
+
if (!relativePath.includes('/') && !relativePath.includes('\\')) return null
|
|
3132
|
+
const cacheKey = JSON.stringify([session.id, relativePath])
|
|
3133
|
+
const cached = rescueCache.get(cacheKey)
|
|
3134
|
+
const ttl = cached && cached.path ? RESCUE_TTL_MS : RESCUE_MISS_TTL_MS
|
|
3135
|
+
if (cached && Date.now() - cached.at < ttl) return cached.path
|
|
3136
|
+
const deadline = Date.now() + RESCUE_BUDGET_MS
|
|
3137
|
+
let level = [session.cwd]
|
|
3138
|
+
let probes = 0
|
|
3139
|
+
let found = null
|
|
3140
|
+
for (let depth = 0; depth < RESCUE_MAX_DEPTH && level.length && !found; depth += 1) {
|
|
3141
|
+
if (Date.now() > deadline) break
|
|
3142
|
+
const listings = await Promise.all(level.map((dir) => bridge.list(session.id, dir)))
|
|
3143
|
+
const children = []
|
|
3144
|
+
listings.forEach((entries, index) => {
|
|
3145
|
+
if (!entries) return
|
|
3146
|
+
for (const entry of entries) {
|
|
3147
|
+
if (!entry || (entry.type !== 'directory' && entry.type !== 'symlink')) continue
|
|
3148
|
+
const name = String(entry.name || '')
|
|
3149
|
+
if (!name || name.startsWith('.') || RESCUE_SKIP.has(name.toLowerCase())) continue
|
|
3150
|
+
children.push(joinPath(level[index], name))
|
|
3151
|
+
}
|
|
3152
|
+
})
|
|
3153
|
+
const hits = []
|
|
3154
|
+
await eachLimited(children, async (dir) => {
|
|
3155
|
+
if (found || probes >= RESCUE_MAX_PROBES || Date.now() > deadline) return
|
|
3156
|
+
probes += 1
|
|
3157
|
+
const probe = await bridge.probe(session.id, joinPath(dir, relativePath))
|
|
3158
|
+
if (probe && !probe.error) hits.push(probe.absolutePath)
|
|
3159
|
+
})
|
|
3160
|
+
if (hits.length > 1) { rememberRescue(cacheKey, null); return null }
|
|
3161
|
+
if (hits.length === 1) found = hits[0]
|
|
3162
|
+
level = children
|
|
3163
|
+
}
|
|
3164
|
+
rememberRescue(cacheKey, found)
|
|
3165
|
+
return found
|
|
3166
|
+
}
|
|
2988
3167
|
function warmCandidate(candidate) {
|
|
2989
3168
|
if (!candidate || candidate.link) return
|
|
2990
3169
|
const { session, path, key } = locate(candidate)
|
|
@@ -3016,6 +3195,9 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
|
|
|
3016
3195
|
async function openAt(candidate, x, y, keyboard) {
|
|
3017
3196
|
if (disposed) return
|
|
3018
3197
|
closeMenu()
|
|
3198
|
+
// Glass is a per-open decision: the wallpaper plugin can switch its gate at any
|
|
3199
|
+
// time, and the menu is rebuilt on every right-click anyway.
|
|
3200
|
+
try { document.documentElement.dataset.dfaGlass = config.get().glass === 'off' ? 'off' : 'on' } catch { /* no document */ }
|
|
3019
3201
|
const attempt = ++generation
|
|
3020
3202
|
let handle
|
|
3021
3203
|
try {
|
|
@@ -3070,7 +3252,14 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
|
|
|
3070
3252
|
handle.setModel(buildStatusModel(path, t.noSession, t, true))
|
|
3071
3253
|
return
|
|
3072
3254
|
}
|
|
3073
|
-
|
|
3255
|
+
let probe = cachedProbe(candidate) || await bridge.probe(session.id, path)
|
|
3256
|
+
if (probe && probe.error === 'notFound') {
|
|
3257
|
+
// Prose often abbreviates a nested path; the walk is bounded, so tell the user
|
|
3258
|
+
// what the extra beat is for before spending it.
|
|
3259
|
+
handle.setModel(buildStatusModel(path, t.locating, t))
|
|
3260
|
+
const rescued = await resolveBelowRoot(session, located.path)
|
|
3261
|
+
if (rescued) probe = await bridge.probe(session.id, rescued)
|
|
3262
|
+
}
|
|
3074
3263
|
if (disposed || attempt !== generation || handle.closed) return
|
|
3075
3264
|
if (!probe || probe.error) {
|
|
3076
3265
|
handle.setModel(buildStatusModel(path, t[probe?.error] || t.probeFailed, t, true))
|
|
@@ -3522,6 +3711,7 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
|
|
|
3522
3711
|
mimeOf,
|
|
3523
3712
|
pickEditor,
|
|
3524
3713
|
orderApplications,
|
|
3714
|
+
shouldHintSilentOpen,
|
|
3525
3715
|
applicationPreferences,
|
|
3526
3716
|
clientPreferences,
|
|
3527
3717
|
visibleMenuSections,
|
|
@@ -3550,6 +3740,9 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
|
|
|
3550
3740
|
}
|
|
3551
3741
|
|
|
3552
3742
|
if (typeof window !== 'undefined' && window.__ModuleLoader__) {
|
|
3743
|
+
// One console line per load: the desktop client only picks up a new bundle on app
|
|
3744
|
+
// start, so this is the cheapest way to tell which build the window is running.
|
|
3745
|
+
try { console.debug('[dsh-file-actions] bundle ready') } catch (error) { /* console is optional */ }
|
|
3553
3746
|
window.__ModuleLoader__.load({ id: '@jidekaixin2dian/dsh-file-actions', factory })
|
|
3554
3747
|
}
|
|
3555
3748
|
})()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jidekaixin2dian/dsh-file-actions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Act on files and links in chat: open, reveal, preview or save; choose preferred apps, inspect reference context and copy excerpts with their source.",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"type": "module",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/assets/preview-glass.png
DELETED
|
Binary file
|
package/assets/preview-image.png
DELETED
|
Binary file
|
|
Binary file
|
package/assets/preview-video.png
DELETED
|
Binary file
|