@maxbill/dsh-file-explorer 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -27,7 +27,7 @@ Browse · preview · edit · organise — and hand files straight to your agent<
27
27
 
28
28
  </div>
29
29
 
30
- <p align="center"><img src="docs/panel.png" width="880" alt="File Explorer: the icon view you see right after opening it"></p>
30
+ <p align="center"><img src="docs/terminal-panel.png" width="880" alt="File Explorer: icon view with the built-in terminal docked below"></p>
31
31
 
32
32
  <table>
33
33
  <tr>
@@ -211,7 +211,7 @@ Do those four things once and you know the whole plugin.
211
211
 
212
212
  - The host side is plain ESM (`lib/index.js`); the browser side is a hand-written `window.__ModuleLoader__` factory module (`lib/client.js`). **There is no bundling step** — change it, reload the page, done.
213
213
  - The only third-party front-end dependency is the terminal renderer **@xterm/xterm**; the host hands it to the page on demand instead of bundling it.
214
- - The terminal can also use **node-pty** (an `optionalDependencies` entry with prebuilt macOS / Windows binaries, nothing to compile): when it loads, it provides the real pty; otherwise the `python3` bridge is used, and plain pipes are the last resort.
214
+ - The **node-pty** binaries behind the real pty ship inside the plugin (`vendor/node-pty`, prebuilt for macOS arm64/x64 and Windows x64), so installing downloads nothing extra and compiles nothing; if they fail to load, the `python3` bridge is used, and plain pipes are the last resort.
215
215
  - XLSX / DOCX / ZIP parsing happens in the host on Node's standard library; the terminal gets a pty from the machine's own `/usr/bin/python3`, so nothing native is compiled.
216
216
 
217
217
  ---
@@ -310,7 +310,7 @@ Do those four things once and you know the whole plugin.
310
310
  - **Where**: a Terminal button right after Sort in the toolbar, and Open in terminal on a folder context menu, which starts a shell in that directory.
311
311
  - **Layout**: it docks between the file list and the status bar; drag its top grip to change the height, capped at half the window, and the height is remembered.
312
312
  - **Tabs**: the header is a tab strip — one tab per shell, named after its folder (the full path is in the tooltip), and **double-clicking a tab name renames it**. The × closes that terminal and + opens another one; clicking a tab switches to it, and the shells you switch away from keep running.
313
- - **What it runs**: a real pty — **node-pty** when it is installed (macOS, Linux and Windows ConPTY), otherwise a `pty.fork` bridge through the host's `python3`. Colours and full-screen programs such as `vim` and `top` work, and dragging the dock passes the new size to the shell. Output is polled every 120 ms; keystrokes are batched every 12 ms.
313
+ - **What it runs**: a real pty — the bundled **node-pty** (macOS and Windows ConPTY), otherwise a `pty.fork` bridge through the host's `python3`. Colours and full-screen programs such as `vim` and `top` work, and dragging the dock passes the new size to the shell. Output is polled every 120 ms; keystrokes are batched every 12 ms.
314
314
  - **Look**: 13 px font with a 1.5 line height, and the palette follows the app between light and dark; there are no extra settings.
315
315
  - **Sessions**: only the close button ends the shell. Switching to a conversation and back reattaches the same shell and keeps what was on screen, and a terminal nobody has looked at for half an hour is reclaimed.
316
316
  - **Limits**: desktop only (the button and menu item are hidden over a remote connection), at most three sessions.
package/README.md CHANGED
@@ -27,7 +27,7 @@
27
27
 
28
28
  </div>
29
29
 
30
- <p align="center"><img src="docs/panel.png" width="880" alt="文件管理器:打开后是首页的图标视图"></p>
30
+ <p align="center"><img src="docs/terminal-panel.png" width="880" alt="文件管理器:图标视图 + 底部内置终端"></p>
31
31
 
32
32
  <table>
33
33
  <tr>
@@ -210,7 +210,7 @@ dsh plugin --profile desktop add @maxbill/dsh-file-explorer
210
210
 
211
211
  - 宿主端是普通 ESM(`lib/index.js`),浏览器端是手写的 `window.__ModuleLoader__` 工厂模块(`lib/client.js`),**没有打包步骤**,改完重载页面即生效。
212
212
  - 前端唯一的第三方依赖是终端渲染器 **@xterm/xterm**:宿主按需从 `node_modules` 交给页面,不打进 client 模块。
213
- - 终端另外可选装 **node-pty**(`optionalDependencies`,带 macOS / Windows 预编译,无需编译):装上就用它开真 PTY;没装或加载失败时回退到 `python3` 中继,再不行退到管道。
213
+ - 真 PTY 用的 **node-pty** 预编译(macOS arm64/x64、Windows x64)已随插件打包在 `vendor/node-pty`,安装时不用再下载或编译;加载失败时回退到 `python3` 中继,再不行退到管道。
214
214
  - XLSX / DOCX / ZIP 的解析都在宿主用 Node 标准库完成;终端用宿主自带的 `/usr/bin/python3` 建 PTY,不需要编译原生模块。
215
215
 
216
216
  ---
@@ -309,7 +309,7 @@ dsh plugin --profile desktop add @maxbill/dsh-file-explorer
309
309
  - **入口**:工具栏「排序」之后的「终端」按钮;文件夹右键「在终端打开」,直接在该目录起一个 shell。
310
310
  - **位置**:停在文件区与状态栏之间,拖动顶部把手可调高度,**最高不超过窗口一半**,高度记在浏览器里。
311
311
  - **页签**:标题栏就是标签栏 —— 每个终端一个标签(名字取目录名,完整路径在悬停提示里),**双击标签名可以改名**;点 × 关掉这个终端、点 + 再开一个;标签之间点一下就切换,切走的终端在后台继续跑。
312
- - **能力**:真 PTY —— 优先用 `node-pty`(macOS / Linux / Windows 的 ConPTY),没装时用 `python3` 的 `pty.fork` 中继,都可跑彩色输出与 `vim` / `top` 这类全屏程序,拖动高度会同步窗口大小;输出按 120 ms 轮询拉取,输入按 12 ms 合并发送。
312
+ - **能力**:真 PTY —— 插件自带 `node-pty` 预编译(macOS / Windows 的 ConPTY),其它平台用 `python3` 的 `pty.fork` 中继,都可跑彩色输出与 `vim` / `top` 这类全屏程序,拖动高度会同步窗口大小;输出按 120 ms 轮询拉取,输入按 12 ms 合并发送。
313
313
  - **外观**:字号 13、行高 1.5,配色跟随界面深浅自动切换,不提供额外设置。
314
314
  - **会话**:点 × 关闭终端才结束 shell;切到会话再切回来会接回同一个 shell,屏幕内容保留;半小时无人查看的终端自动回收。
315
315
  - **限制**:仅桌面端可用(远程访问时按钮与菜单项隐藏);同时最多保留 3 个会话。
@@ -348,7 +348,7 @@ dsh plugin --profile desktop add @maxbill/dsh-file-explorer
348
348
  | 移到废纸篓 | ✅ `~/.Trash` | ✅ 系统回收站(PowerShell,失败退回 `~/.Trash`) | ✅ freedesktop(`.trashinfo`,可还原) |
349
349
  | 地址栏路径 | ✅ POSIX | ✅ 盘符与 UNC | ✅ POSIX |
350
350
  | 上传整个文件夹 | ✅ | ✅ | ✅ `webkitdirectory`(Chrome / Edge / Firefox;Safari 退化为选文件) |
351
- | 终端 | ✅ 真 PTY(node-pty / python3) | ✅ ConPTY(装 node-pty 后;否则管道) | ✅ 真 PTY(node-pty / python3) |
351
+ | 终端 | ✅ 真 PTY(内置 node-pty / python3) | ✅ ConPTY(内置 node-pty) | ✅ 真 PTY(python3) |
352
352
 
353
353
  > ⚠️ **Windows 与 Linux 尚未实机完整验收**。两条分支按各自官方约定实现(Explorer 的 `/select,`、回收站的 `SendToRecycleBin`、freedesktop 的 `files`+`info` 目录结构),并在 `npm test` 里用「平台计划」用例模拟验证命令与路径拼接,但没有在真机点过一遍。
354
354
 
@@ -0,0 +1,41 @@
1
+ # 往 awesome-dsh-plugin 提交条目
2
+
3
+ 我们的列表条目在 `data/plugins/MaxBill__dsh-file-explorer.yml`,通过 fork + PR 提交。踩过的坑记在这里。
4
+
5
+ ## 推送前必做
6
+
7
+ 1. **YAML 只留一个结尾引号**
8
+ 替换 `description.en` / `description.zh` 时,单引号字符串的结尾只能有一个 `'`。
9
+ 写成 `...压缩解压。''` 会让 CI 报 `invalid YAML — deficient indentation`。
10
+ 本地先验:`node -e "require('js-yaml').load(require('fs').readFileSync('data/plugins/MaxBill__dsh-file-explorer.yml','utf8'))"`
11
+
12
+ 2. **README 必须与 data/plugins 一致**
13
+ CI 会检查 README 有没有和数据不符的改动。改完 yml 跑:
14
+ ```
15
+ node scripts/generate-readme.mjs
16
+ ```
17
+ 会重新生成 README.md 与 README.zh.md,只动我们这一行。
18
+
19
+ 3. **分支先 rebase 到最新 upstream/main**
20
+ 上游一天能合几百个 PR,分支几天就落后几百个提交,PR 会变成 `CONFLICTING`。
21
+ 推荐做法:把分支重置到 `upstream/main`,只保留一条干净的提交,再强推:
22
+ ```
23
+ git fetch upstream main
24
+ git reset --hard upstream/main
25
+ # 改 yml、生成 README、提交
26
+ git push --force origin HEAD:upstream-entry
27
+ ```
28
+
29
+ 4. **推完等 check 变绿**
30
+ ```
31
+ gh pr view <号> --repo awesome-dsh-plugin/awesome-dsh-plugin --json mergeable,statusCheckRollup
32
+ ```
33
+ 要看到 `mergeable: MERGEABLE` 且 `conclusion: SUCCESS`,否则维护者不会合。
34
+
35
+ ## 提交流程
36
+
37
+ 1. 在 fork 上建分支(如 `upstream-entry`),只改 `data/plugins/MaxBill__dsh-file-explorer.yml`
38
+ 2. 跑 `node scripts/generate-readme.mjs`
39
+ 3. 提交(中文提交信息),推到 fork
40
+ 4. `gh pr create --repo awesome-dsh-plugin/awesome-dsh-plugin --head <fork>:upstream-entry`
41
+ 5. 后续更新同一个分支,PR 会自动带上新提交
@@ -0,0 +1,79 @@
1
+ # 用 ego-browser 调试面板
2
+
3
+ 界面改动不用手动截图:起一个测试宿主,用 `ego-browser` 驱动浏览器,点开面板、执行操作、把截图存下来。
4
+
5
+ ## 1. 起测试宿主
6
+
7
+ 面板需要一个带插件的 DSH 实例,不要动正在用的那个:
8
+
9
+ ```bash
10
+ PID=$(lsof -nP -iTCP:3199 -sTCP:LISTEN -t 2>/dev/null | head -1)
11
+ [ -n "$PID" ] && kill -9 "$PID"
12
+ export DSH_HOME=/tmp/fe-compose
13
+ rm -f /tmp/host.log
14
+ nohup "/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh" \
15
+ --profile fe-check --no-open --port 3199 > /tmp/host.log 2>&1 &
16
+ for i in $(seq 1 30); do sleep 1; grep -q 'dsh web: http' /tmp/host.log && break; done
17
+ grep -o 'http://127.0.0.1:3199/?token=[A-Za-z0-9_-]*' /tmp/host.log | tail -1
18
+ ```
19
+
20
+ **必须用带 token 的 URL**:裸 `http://127.0.0.1:3199/` 会显示 `dsh web authentication required`。
21
+
22
+ ## 2. 一次调试脚本的样子
23
+
24
+ ```bash
25
+ ego-browser nodejs <<'EOF'
26
+ const task = await taskSpace("dsh-file-explorer dev");
27
+ const page = task.page("p1");
28
+ await page.goto("http://127.0.0.1:3199/?token=<TOKEN>", { timeout: 40000 });
29
+ await page.waitForTimeout(4500);
30
+
31
+ // 关掉首次进入的对话框
32
+ await page.evaluate(() => {
33
+ const d = document.querySelector('[role="dialog"]');
34
+ if (d) Array.from(d.querySelectorAll('button')).pop()?.click();
35
+ });
36
+
37
+ // 打开面板
38
+ await page.click('loc=css:button[aria-label="文件管理器"]', { label: "open file manager" });
39
+ await page.waitForSelector(".dfx-root", { state: "visible", timeout: 10000 });
40
+
41
+ // 断言 + 截图
42
+ const state = await page.evaluate(() => ({
43
+ rows: document.querySelectorAll(".dfx-rows > *").length,
44
+ tools: Array.from(document.querySelectorAll(".dfx-tool")).map((b) => b.textContent.trim()),
45
+ }));
46
+ await page.screenshot({ path: "/tmp/ego-dsh.png" });
47
+ console.log({ state });
48
+
49
+ await task.finish({ keep: [] });
50
+ EOF
51
+ ```
52
+
53
+ ## 3. 常用操作
54
+
55
+ | 目的 | 写法 |
56
+ |:--|:--|
57
+ | 看结构 / 找元素 | `await page.snapshot()`,元素带 `ref=N` 和 `loc=css:…` |
58
+ | 点元素 | `page.click('@10')` 或 `page.click('loc=css:button[aria-label="排序"]', { label: "open sort" })` |
59
+ | 等状态 | `page.waitForSelector('.dfx-term', { state: 'visible' })` |
60
+ | 读页面状态 | `page.evaluate(() => ({ … }))`(回调只在页面里跑) |
61
+ | 截图 | `page.screenshot({ path: '/tmp/x.png' })`,父目录会自动建 |
62
+ | 输入 | `page.fill(selector, text)` / `page.keyboard.type(text)` |
63
+ | 拖拽 | `page.mouse.move(x, y)` + `mouse.down()` + `move()` + `mouse.up()` |
64
+
65
+ ## 4. 规矩
66
+
67
+ - 一个调试目标用一个 TaskSpace,名字写清楚;同一目标的下一次调试复用它(先 `listTaskSpaces()` 找 id)
68
+ - 每次脚本最后 `task.finish({ keep: [] })`,只有需要给你留着看时才 `{ keep: ["p1"] }`
69
+ - 一次脚本里把「操作 + 等待 + 取样」串起来,少来回
70
+ - 每个 `ego-browser nodejs` 都是新进程,变量不跨脚本;任务空间、标签、页面标签会保留
71
+
72
+ ## 5. 常见坑
73
+
74
+ | 现象 | 原因 / 处理 |
75
+ |:--|:--|
76
+ | `dsh web authentication required` | 用了不带 token 的 URL |
77
+ | 点不到侧栏按钮 | 先 `snapshot()` 确认 `aria-label`,再 `loc=css:` 点 |
78
+ | 面板没出来 | 等 `.dfx-root`,首次进入还有对话框要关 |
79
+ | 截图是空白 | 页面还没渲染完,先 `waitForTimeout` 或 `waitForSelector` |
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxbill/dsh-file-explorer",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "文件管理器 — 浏览、预览并直接用起来:文件夹一键变成工作区,文档一键加进当前对话 · A file manager for DeepSeek Harness that turns folders into workspaces and documents into conversation attachments",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
package/screenshots.json CHANGED
@@ -1,4 +1,5 @@
1
1
  [
2
+ "docs/terminal-panel.png",
2
3
  "docs/panel.png",
3
4
  "docs/icon-view.png",
4
5
  "docs/grouped.png",