@jidekaixin2dian/dsh-file-actions 0.1.19 → 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 CHANGED
@@ -1,5 +1,82 @@
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.
38
+ ## 0.1.20 — 2026-11-06
39
+
40
+ - 修复右键「已编辑 …」文件变更卡片无反应:卡片每行的已解析路径由宿主写在
41
+ `aria-describedby` 指向的隐藏节点里,直接读取即可,不解析本地化按钮文案;
42
+ 悬停差异预览则读 `data-changes-preview-path`。
43
+ - Fix the dead right-click on "edited …" changed-file cards: each row's
44
+ resolved path is published by the host in the hidden `aria-describedby`
45
+ target, so read that instead of parsing localized labels; the hover diff
46
+ preview exposes `data-changes-preview-path`.
47
+ - 修复右键指向图片的 Markdown 链接无反应:宿主把图片渲染成自带预览按钮而非
48
+ `<a href>`,现从内部 `<img>` 的 `/api/file?path=…` 文件路由 URL 解析出绝对
49
+ 路径(issue #16、#17)。
50
+ - Fix the dead right-click on Markdown links pointing at images: the host
51
+ renders them as its own preview button rather than `<a href>`; the absolute
52
+ path is now recovered from the inner `<img>`'s `/api/file?path=…` file-route
53
+ URL (issues #16, #17).
54
+
55
+ - 设置页导航图标迁移到官方 `settings.section.icon` 槽位(DSH 0.2.2 新增,按分区 id
56
+ 匹配),插件卸载后还原默认图标;未声明该槽位的宿主(rc.2–rc.5)自动回退到原有
57
+ DOM 装饰方式,行为不变。
58
+ - Migrate the settings navigation icon to the official `settings.section.icon`
59
+ slot (new in DSH 0.2.2, matched by section id) with clean unregistration;
60
+ hosts that do not declare the slot (rc.2–rc.5) keep the previous DOM
61
+ decoration fallback unchanged.
62
+ - 兼容验证扩展到 DSH 0.2.2-alpha.3 与 0.2.2-rc.1:0.2.2 系列引入统一右键菜单等
63
+ 客户端变化,43 项宿主套件在两档宿主全部通过,右键菜单共存无冲突;rc.5 仍是
64
+ 默认固定宿主,保留 rc.2–rc.4 回归。
65
+ - Extend verified host coverage to DSH 0.2.2-alpha.3 and 0.2.2-rc.1. The 0.2.2
66
+ line introduces a unified context menu and other client changes; the 43-item
67
+ host suite passes on both hosts with the right-click behavior coexisting, and
68
+ rc.5 stays the default pinned host with rc.2–rc.4 retained.
69
+ - 「在浏览器中打开」的非活动内容窗口收紧 sandbox:媒体、图片与纯文本不再授予
70
+ `allow-scripts`,仅内置 PDF 查看器保留脚本上下文;opaque origin 不变。
71
+ - Tighten the browser-preview sandbox for non-active content: media, images and
72
+ plain text no longer get `allow-scripts`; only the built-in PDF viewer keeps a
73
+ scripting context. The opaque origin is unchanged.
74
+ - 宿主套件加固:全局测试超时与重量级 runtime 用例超时上调,toast 断言改为对
75
+ 事件记录轮询——Windows CI runner 停顿不再被误判为失败;断言语义不变。
76
+ - Harden the host suite: longer global and heavy-runtime-test budgets, and toast
77
+ assertions that poll a recorded log, so stalled Windows CI runners no longer
78
+ read as failures; assertions are unchanged.
79
+
3
80
  ## 0.1.19 — 2026-10-31
4
81
 
5
82
  - 设置页新增中英文「项目与反馈」区域,可打开 File Actions GitHub 项目或新建反馈。
package/README.en.md CHANGED
@@ -1,33 +1,45 @@
1
1
  # File Actions · 文件与链接操作
2
2
 
3
- **Turn a file reference in your conversation into the next action.**
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.19) · [Marketplace](https://awesome-dsh-plugin.com/p/jidekaixin2dian/dsh-file-actions/) · [Download](https://github.com/jidekaixin2dian/dsh-file-actions/releases/latest) · [Changelog](CHANGELOG.md)
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
- Once a model gives you a file, the next step is usually to open it, keep editing or take its contents elsewhere. File Actions puts application choices, reveal, copy, preview and save into one context menu across chat references, delivery cards, tool results and sidebars that expose file paths.
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
- ![File menu appearance example](assets/preview-glass.png)
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
- ## Continue from a file reference
16
+ ## Read the context, keep the source
12
17
 
13
- | Your next step | Available actions |
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
- ## Downloads
20
+ ![Reference context and copying an excerpt with its source](assets/preview-reference.png)
21
21
 
22
- | GitHub release assets · all releases | npm 0.1.17 · past 7 days |
23
- |---|---|
24
- | [**350 downloads**](https://api.github.com/repos/jidekaixin2dian/dsh-file-actions/releases?per_page=100) | [**191 downloads**](https://api.npmjs.org/versions/@jidekaixin2dian%2Fdsh-file-actions/last-week) |
22
+ ## Keep working from delivered files
23
+
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.
25
+
26
+ ![File menu with associated applications and preferences](assets/preview-apps.png)
27
+
28
+ ## Preview images and videos
29
+
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.
25
31
 
26
- Snapshot: **2026-10-29**. GitHub counts release-asset requests, including checksums; npm counts downloads of the named version. Requests can include repeat installs and automation, so these are not unique-user counts and the two columns are not added together. Click a number for its live source.
32
+ ![Image preview and file actions](assets/preview-media.png)
33
+
34
+ ## Adjust the menu to your workflow
35
+
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.
37
+
38
+ ![File Actions settings](assets/preview-settings.png)
27
39
 
28
40
  ## Install and update
29
41
 
30
- Requires **DSH >=0.2.1-rc.2 and Node >=24**. CI verifies DSH rc.2 / rc.3 / rc.4 / rc.5.
42
+ Requires **DSH >=0.2.1-rc.2 and Node >=24**. CI verifies DSH rc.2 / rc.3 / rc.4 / rc.5 / 0.2.2-alpha.3 / 0.2.2-rc.1.
31
43
 
32
44
  Search for **dsh-file-actions** in the marketplace and verify author **jidekaixin2dian**. Existing users can check updates under installed plugins. Catalog and registry mirrors may take time to refresh.
33
45
 
@@ -100,6 +112,14 @@ Use **Project and feedback** at the bottom of settings to visit this plugin's Gi
100
112
 
101
113
  </details>
102
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
+
103
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)
104
124
 
105
125
  MIT · Independent community plugin, not affiliated with DeepSeek.
package/README.md CHANGED
@@ -1,33 +1,45 @@
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.19) · [插件市场](https://awesome-dsh-plugin.com/p/jidekaixin2dian/dsh-file-actions/) · [下载](https://github.com/jidekaixin2dian/dsh-file-actions/releases/latest) · [更新记录](CHANGELOG.md)
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
- ![文件右键菜单外观示例](assets/preview-glass.png)
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
+ ![引用上下文与带来源复制](assets/preview-reference.png)
21
21
 
22
- | GitHub Release 资源 · 历史累计 | npm 0.1.17 · 近 7 日 |
23
- |---|---|
24
- | [**350 次下载**](https://api.github.com/repos/jidekaixin2dian/dsh-file-actions/releases?per_page=100) | [**191 次下载**](https://api.npmjs.org/versions/@jidekaixin2dian%2Fdsh-file-actions/last-week) |
22
+ ## 交付文件直接接着用
23
+
24
+ 在对话文件引用或「已编辑」变更卡片上右键,选择应用、在文件管理器中定位,或复制路径、文件名与内容。「打开方式」可以搜索系统关联应用,并按文件类型收藏首选。
25
+
26
+ ![交付文件菜单与首选应用](assets/preview-apps.png)
27
+
28
+ ## 图片和视频,先看再处理
29
+
30
+ 图片引用可以显示缩略图并放大查看;视频引用可以提取预览帧。需要继续查看时,用「在浏览器中打开」预览支持的文档、图片或媒体,也可另存到本地。
25
31
 
26
- 统计快照:**2026-10-29**。GitHub 包含安装包、校验文件等资源请求;npm 仅统计表中版本。下载可能包含重复安装和自动化请求,不代表独立用户数,两列不相加。点击数字可查看实时来源。
32
+ ![图片预览和文件操作](assets/preview-media.png)
33
+
34
+ ## 按习惯调整菜单
35
+
36
+ 在「设置 → 文件操作」切换完整或精简菜单,调整引用前后文行数,管理首选应用和关联应用缓存。键盘也能操作:`Shift+F10` 打开,方向键选择,`Enter` 执行。
37
+
38
+ ![文件操作设置](assets/preview-settings.png)
27
39
 
28
40
  ## 安装与更新
29
41
 
30
- 需要 **DSH >=0.2.1-rc.2、Node >=24**;持续验证 DSH rc.2 / rc.3 / rc.4 / rc.5。
42
+ 需要 **DSH >=0.2.1-rc.2、Node >=24**;持续验证 DSH rc.2 / rc.3 / rc.4 / rc.5 / 0.2.2-alpha.3 / 0.2.2-rc.1。
31
43
 
32
44
  在插件市场搜索 **dsh-file-actions**,确认作者为 **jidekaixin2dian** 后安装;已有用户在「已安装」中检查更新。市场数据与 npm 镜像可能有同步延迟。
33
45
 
@@ -102,6 +114,14 @@ dsh plugin --profile desktop remove @jidekaixin2dian/dsh-file-actions
102
114
 
103
115
  </details>
104
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
+
105
125
  [开发与验证](https://github.com/jidekaixin2dian/dsh-file-actions/blob/main/docs/development.md) · [安全说明](SECURITY.md) · [反馈问题](https://github.com/jidekaixin2dian/dsh-file-actions/issues)
106
126
 
107
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: '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: 'Office document',
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', 'svg'])
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', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp', 'rtf', 'pages', 'numbers', 'key'])
320
- const ARCHIVE_EXT = new Set(['zip', 'tar', 'gz', 'tgz', 'bz2', 'xz', '7z', 'rar', 'zst'])
321
- const VIDEO_EXT = new Set(['mp4', 'm4v', 'mov', 'webm', 'ogv', 'mkv', 'avi', 'wmv', 'flv', 'mpg', 'mpeg', '3gp', 'mts', 'm2ts'])
322
- const AUDIO_EXT = new Set(['mp3', 'wav', 'flac', 'm4a', 'aac', 'ogg', 'oga', 'opus', 'wma', 'aiff', 'mid', 'midi'])
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 CODE_EXT = new Set(['js', 'mjs', 'cjs', 'jsx', 'ts', 'mts', 'cts', 'tsx', 'vue', 'svelte', 'astro', 'css',
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', 'deb', 'rpm',
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 BROWSER_VIDEO = new Set(['mp4', 'm4v', 'mov', 'webm', 'ogv'])
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: true, canSaveAs: true }
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;
@@ -1138,6 +1194,7 @@ const factory = (require) => {
1138
1194
  .dfa-settings-app-info{min-width:0;display:flex;align-items:center;gap:12px;flex:1}.dfa-settings-app-info strong{display:inline-block;min-width:56px;padding:4px 7px;border-radius:5px;background:color-mix(in srgb,var(--dfa-accent) 7%,transparent);color:var(--dfa-accent);font:500 .73rem/1.5 Consolas,monospace}.dfa-settings-app-info span{overflow-wrap:anywhere;font-size:.8rem}.dfa-settings-empty{display:flex;align-items:center;gap:12px;padding:15px 16px 19px}.dfa-settings-empty>svg{flex:none;opacity:.4;width:25px;height:25px}.dfa-settings-empty strong{display:block;font-size:.8rem;font-weight:500;margin-bottom:4px}
1139
1195
  .dfa-settings-cache{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:13px 4px 15px}.dfa-settings-cache-title{display:flex;gap:7px;align-items:center;font-size:.8rem;font-weight:550;margin-bottom:4px}.dfa-settings-cache-title>svg{opacity:.5}.dfa-settings-cache button{display:flex;align-items:center;gap:7px;white-space:nowrap;font-size:.76rem}.dfa-settings-footer{padding:12px 4px 0;border-top:1px solid var(--dfa-line);display:flex;align-items:flex-start;gap:7px;font-size:.72rem;line-height:1.6;opacity:.55}.dfa-settings-footer svg{width:13px;height:13px;flex:none;margin-top:2px}.dfa-settings-status{min-height:1.5em;margin-top:8px;font-size:.76rem;padding:0 4px;overflow-wrap:anywhere}.dfa-settings-status[data-error="true"]{color:var(--dsw-alias-danger,#b42318)}
1140
1196
  button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-icon="file-actions"]::before{content:"";width:16px;height:16px;flex:none;background:currentColor;mask: url("data:image/svg+xml,${encodeURIComponent(iconSvg('fileActions').replace('<svg ', '<svg xmlns="http://www.w3.org/2000/svg" '))}") center/contain no-repeat}
1197
+ .dfa-nav-icon{display:inline-flex;flex:none}.dfa-nav-icon>svg{width:100%;height:100%}
1141
1198
  @media(max-width:500px){.dfa-settings-header{gap:10px;margin-bottom:18px}.dfa-settings h2{font-size:1rem}.dfa-settings-row{padding:13px 14px;gap:10px;align-items:flex-start;flex-wrap:wrap}.dfa-settings-copy{flex-basis:140px}.dfa-settings select{min-width:0;max-width:100%;font-size:.78rem}.dfa-settings-card-head,.dfa-settings-app{padding-left:14px;padding-right:14px}.dfa-settings-app-info{gap:8px}.dfa-settings-app-info strong{min-width:48px}.dfa-settings-cache{align-items:flex-start;flex-wrap:wrap}.dfa-settings-cache>div{flex-basis:180px;flex-grow:1}}
1142
1199
 
1143
1200
  .dfa-toast{position:fixed;left:50%;bottom:32px;transform:translateX(-50%);z-index:2147483002;
@@ -1149,6 +1206,24 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
1149
1206
  opacity:0;transition:opacity .16s ease}
1150
1207
  .dfa-toast[data-show="true"]{opacity:1}
1151
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}}
1152
1227
  `
1153
1228
 
1154
1229
  function ensureCss() {
@@ -1300,6 +1375,16 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
1300
1375
  } catch { /* not a directory either */ }
1301
1376
  return { error: failure }
1302
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
+ },
1303
1388
  async applications(path) {
1304
1389
  if (!sessionApi) return { state: 'failed', apps: [] }
1305
1390
  try {
@@ -1397,6 +1482,21 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
1397
1482
  * data attribute the GUI already writes) win; a bare text token is the
1398
1483
  * fallback for surfaces that only render the path as text.
1399
1484
  */
1485
+ /** Chat media renders as Host file-route URLs: the absolute path is the
1486
+ * `path` query parameter. Web (`https://…/api/file`) and Desktop
1487
+ * (`dsh-app://app/api/file`) share the route name. */
1488
+ function pathFromMediaUrl(value) {
1489
+ if (!value) return ''
1490
+ try {
1491
+ const url = new URL(value, location.href)
1492
+ if (!url.pathname.endsWith('/api/file')) return ''
1493
+ const path = url.searchParams.get('path') || ''
1494
+ return path && isAbsolutePath(path) && !/^[/\\]{2}/.test(path) ? path : ''
1495
+ } catch {
1496
+ return ''
1497
+ }
1498
+ }
1499
+
1400
1500
  function candidateFromEvent(event, doc) {
1401
1501
  const target = event.target
1402
1502
  if (!target || !target.closest) return null
@@ -1423,6 +1523,28 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
1423
1523
  }
1424
1524
  }
1425
1525
 
1526
+ // The changed-files card keeps every row's resolved path in a hidden
1527
+ // `aria-describedby` target — locale-proof, unlike the button labels. The
1528
+ // hover diff preview is a portal outside the card and names its file
1529
+ // through a dedicated path span.
1530
+ const trigger = target.closest('[data-changed-files] button[aria-describedby]')
1531
+ if (trigger) {
1532
+ const described = trigger.getAttribute('aria-describedby')
1533
+ const describedNode = described && doc.getElementById(described)
1534
+ const value = describedNode && describedNode.textContent.trim()
1535
+ if (value && looksLikePath(value)) {
1536
+ return { path: value, source: 'changed-files', element: trigger }
1537
+ }
1538
+ }
1539
+ const preview = target.closest('[data-changes-hover-preview]')
1540
+ if (preview) {
1541
+ const previewPath = preview.querySelector('[data-changes-preview-path]')
1542
+ const previewValue = previewPath && previewPath.textContent.trim()
1543
+ if (previewValue && looksLikePath(previewValue)) {
1544
+ return { path: previewValue, source: 'changed-files', element: preview }
1545
+ }
1546
+ }
1547
+
1426
1548
  const card = target.closest('[data-presented-file]')
1427
1549
  if (card) {
1428
1550
  const titled = card.querySelector('[title]')
@@ -1466,6 +1588,15 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
1466
1588
  if (/^[a-z][a-z0-9+.-]*:/i.test(href)) return null
1467
1589
  }
1468
1590
 
1591
+ // Chat markdown images render as the Host's own preview button wrapping an
1592
+ // <img>; the resolved path rides in the file-route URL, not in an attribute.
1593
+ const mediaHolder = target.closest('button')
1594
+ const mediaImg = target.closest('img[src]') || (mediaHolder && mediaHolder.querySelector('img[src]'))
1595
+ if (mediaImg) {
1596
+ const mediaPath = pathFromMediaUrl(mediaImg.getAttribute('src'))
1597
+ if (mediaPath) return { path: mediaPath, source: 'media', element: mediaHolder || mediaImg }
1598
+ }
1599
+
1469
1600
  // Inline code in a transcript is a deliberate reference — the blue file names
1470
1601
  // the chat renders. Treat it as explicit so a cold right-click opens the menu
1471
1602
  // instead of falling through to the browser's own menu. Code inside a fenced
@@ -1650,6 +1781,7 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
1650
1781
  for (const [key, label, help, options] of [
1651
1782
  ['menuMode', c.menuMode, c.menuHint, [['full', c.full], ['compact', c.compact]]],
1652
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]]],
1653
1785
  ]) {
1654
1786
  const id = `dfa-setting-${key}`
1655
1787
  const selected = String(value[key])
@@ -1717,8 +1849,9 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
1717
1849
  }
1718
1850
  }
1719
1851
 
1720
- // rc.5 draws a fixed gear for third-party sections. Decorate only our unique,
1721
- // exact-label row; body observation is shallow and nav observation stays local.
1852
+ // Hosts without the settings.section.icon slot draw a fixed gear for
1853
+ // third-party sections. Decorate only our unique, exact-label row; body
1854
+ // observation is shallow and nav observation stays local.
1722
1855
  function settingsNavigationIcon(slots) {
1723
1856
  if (typeof document === 'undefined' || typeof MutationObserver === 'undefined') return () => {}
1724
1857
  const navObserver = new MutationObserver(() => sync())
@@ -1765,8 +1898,27 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
1765
1898
  name: 'settings.section', id: 'file-actions', order: 19,
1766
1899
  label: () => messages(detectLanguage(ctx)).settings.nav,
1767
1900
  }, SettingsPage))
1768
- const stopIcon = settingsNavigationIcon(slots)
1769
- return () => { stopIcon(); if (typeof dispose === 'function') dispose() }
1901
+ // 0.2.2 declares settings.section.icon keyed by the section id. Older hosts
1902
+ // throw "is not declared" from register(): keep the DOM decoration as the
1903
+ // fallback there, and rethrow anything that is not that declaration gap.
1904
+ const disposeIcon = slots.inject('settings.section.icon', () => {
1905
+ try {
1906
+ return slots.register({
1907
+ name: 'settings.section.icon', id: 'file-actions', label: 'File Actions',
1908
+ }, ({ size }) => React.createElement('span', {
1909
+ className: 'dfa-nav-icon', 'aria-hidden': 'true',
1910
+ style: { width: size, height: size },
1911
+ dangerouslySetInnerHTML: { __html: iconSvg('fileActions') },
1912
+ }))
1913
+ } catch (error) {
1914
+ if (!/is not declared/.test(error && error.message || '')) throw error
1915
+ return settingsNavigationIcon(slots)
1916
+ }
1917
+ })
1918
+ return () => {
1919
+ if (typeof disposeIcon === 'function') disposeIcon()
1920
+ if (typeof dispose === 'function') dispose()
1921
+ }
1770
1922
  }
1771
1923
 
1772
1924
  class FileMenu {
@@ -2716,7 +2868,9 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
2716
2868
  frame.srcdoc = `<meta http-equiv="Content-Security-Policy" content="${policy}">` + new TextDecoder().decode(bytes)
2717
2869
  win.document.body.replaceChildren(bar, frame)
2718
2870
  } else {
2719
- frame.setAttribute('sandbox', 'allow-scripts')
2871
+ // Media, images and plain text render without scripts. The built-in PDF
2872
+ // viewer is the one resident that needs its own scripting context.
2873
+ frame.setAttribute('sandbox', mime === 'application/pdf' ? 'allow-scripts' : '')
2720
2874
  frame.src = url
2721
2875
  win.document.body.replaceChildren(frame)
2722
2876
  }
@@ -2762,6 +2916,14 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
2762
2916
  return { text, version: result.version }
2763
2917
  }
2764
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
+
2765
2927
  async function dispatch(item, target, context) {
2766
2928
  const { bridge, t, sessionId } = context
2767
2929
  const path = target.absolutePath
@@ -2781,10 +2943,19 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
2781
2943
  toast(t.appUnavailable, { error: true })
2782
2944
  return
2783
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()
2784
2950
  const ok = await bridge.open(path, item.appId)
2785
2951
  if (!ok) {
2786
2952
  toast(t.openFailed, { error: true })
2787
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)
2788
2959
  }
2789
2960
  return
2790
2961
  }
@@ -2916,6 +3087,83 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
2916
3087
  const cached = probeCache.get(locate(candidate).key)
2917
3088
  return cached && Date.now() - cached.at < 5000 ? cached.value : null
2918
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
+ }
2919
3167
  function warmCandidate(candidate) {
2920
3168
  if (!candidate || candidate.link) return
2921
3169
  const { session, path, key } = locate(candidate)
@@ -2947,6 +3195,9 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
2947
3195
  async function openAt(candidate, x, y, keyboard) {
2948
3196
  if (disposed) return
2949
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 */ }
2950
3201
  const attempt = ++generation
2951
3202
  let handle
2952
3203
  try {
@@ -3001,7 +3252,14 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
3001
3252
  handle.setModel(buildStatusModel(path, t.noSession, t, true))
3002
3253
  return
3003
3254
  }
3004
- const probe = cachedProbe(candidate) || await bridge.probe(session.id, path)
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
+ }
3005
3263
  if (disposed || attempt !== generation || handle.closed) return
3006
3264
  if (!probe || probe.error) {
3007
3265
  handle.setModel(buildStatusModel(path, t[probe?.error] || t.probeFailed, t, true))
@@ -3453,6 +3711,7 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
3453
3711
  mimeOf,
3454
3712
  pickEditor,
3455
3713
  orderApplications,
3714
+ shouldHintSilentOpen,
3456
3715
  applicationPreferences,
3457
3716
  clientPreferences,
3458
3717
  visibleMenuSections,
@@ -3481,6 +3740,9 @@ button[data-dfa-nav-icon="file-actions"]>svg{display:none}button[data-dfa-nav-ic
3481
3740
  }
3482
3741
 
3483
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 */ }
3484
3746
  window.__ModuleLoader__.load({ id: '@jidekaixin2dian/dsh-file-actions', factory })
3485
3747
  }
3486
3748
  })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jidekaixin2dian/dsh-file-actions",
3
- "version": "0.1.19",
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