@maxbill/dsh-file-explorer 1.2.1 → 1.2.3
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 +3 -3
- package/README.md +4 -4
- package/docs/awesome-list.md +41 -0
- package/docs/ego-browser-debug.md +79 -0
- package/docs/terminal-panel.png +0 -0
- package/lib/client.js +25 -5
- package/lib/index.js +67 -22
- package/package.json +3 -5
- package/screenshots.json +1 -0
- package/vendor/node-pty/LICENSE +69 -0
- package/vendor/node-pty/lib/conpty_console_list_agent.js +16 -0
- package/vendor/node-pty/lib/eventEmitter2.js +47 -0
- package/vendor/node-pty/lib/index.js +52 -0
- package/vendor/node-pty/lib/interfaces.js +7 -0
- package/vendor/node-pty/lib/shared/conout.js +11 -0
- package/vendor/node-pty/lib/terminal.js +190 -0
- package/vendor/node-pty/lib/types.js +7 -0
- package/vendor/node-pty/lib/unixTerminal.js +346 -0
- package/vendor/node-pty/lib/utils.js +39 -0
- package/vendor/node-pty/lib/windowsConoutConnection.js +125 -0
- package/vendor/node-pty/lib/windowsPtyAgent.js +320 -0
- package/vendor/node-pty/lib/windowsTerminal.js +199 -0
- package/vendor/node-pty/lib/worker/conoutSocketWorker.js +22 -0
- package/vendor/node-pty/package.json +41 -0
- package/vendor/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
- package/vendor/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
- package/vendor/node-pty/prebuilds/darwin-x64/pty.node +0 -0
- package/vendor/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
- package/vendor/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
- package/vendor/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
- package/vendor/node-pty/prebuilds/win32-x64/conpty.node +0 -0
- package/vendor/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/vendor/node-pty/prebuilds/win32-x64/pty.node +0 -0
- package/vendor/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
- package/vendor/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
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:
|
|
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
|
|
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**
|
|
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="
|
|
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
|
-
-
|
|
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 ——
|
|
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
|
|
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/lib/client.js
CHANGED
|
@@ -28,9 +28,9 @@ window.__ModuleLoader__.load({
|
|
|
28
28
|
script.src = API + "/vendor?name=xterm.js";
|
|
29
29
|
script.onload = function () {
|
|
30
30
|
if (window.Terminal) resolve(window.Terminal);
|
|
31
|
-
else reject(new Error("xterm did not register"));
|
|
31
|
+
else { xtermPromise = null; reject(new Error("xterm did not register")); }
|
|
32
32
|
};
|
|
33
|
-
script.onerror = function () { reject(new Error("xterm failed to load")); };
|
|
33
|
+
script.onerror = function () { xtermPromise = null; reject(new Error("xterm failed to load")); };
|
|
34
34
|
document.head.appendChild(script);
|
|
35
35
|
});
|
|
36
36
|
return xtermPromise;
|
|
@@ -109,6 +109,8 @@ window.__ModuleLoader__.load({
|
|
|
109
109
|
function TerminalDock(props) {
|
|
110
110
|
var hostRef = useRef(null);
|
|
111
111
|
var termRef = useRef(null);
|
|
112
|
+
var [loadFailed, setLoadFailed] = useState(false);
|
|
113
|
+
var [retryTick, setRetryTick] = useState(0);
|
|
112
114
|
var [revision, setRevision] = useState(function () {
|
|
113
115
|
if (termTabs.length === 0) termEnsureTab(props.cwd);
|
|
114
116
|
else if (!termActiveKey) termActiveKey = termTabs[0].key;
|
|
@@ -136,6 +138,7 @@ window.__ModuleLoader__.load({
|
|
|
136
138
|
useEffect(function () {
|
|
137
139
|
var disposed = false;
|
|
138
140
|
var terminal = null;
|
|
141
|
+
setLoadFailed(false);
|
|
139
142
|
loadXterm().then(function (Terminal) {
|
|
140
143
|
if (disposed) return;
|
|
141
144
|
var host = hostRef.current;
|
|
@@ -155,13 +158,13 @@ window.__ModuleLoader__.load({
|
|
|
155
158
|
terminal.resize(grid.cols, grid.rows);
|
|
156
159
|
termCenter(host, terminal);
|
|
157
160
|
setRevision(function (count) { return count + 1; });
|
|
158
|
-
});
|
|
161
|
+
}).catch(function () { if (!disposed) setLoadFailed(true); });
|
|
159
162
|
return function () {
|
|
160
163
|
disposed = true;
|
|
161
164
|
if (terminal) terminal.dispose();
|
|
162
165
|
termRef.current = null;
|
|
163
166
|
};
|
|
164
|
-
}, []);
|
|
167
|
+
}, [retryTick]);
|
|
165
168
|
|
|
166
169
|
// bind the reused terminal to the active tab: replay its screen, then
|
|
167
170
|
// forward keys and poll its output
|
|
@@ -332,7 +335,18 @@ window.__ModuleLoader__.load({
|
|
|
332
335
|
"aria-label": t("隐藏终端"),
|
|
333
336
|
onClick: props.onClose,
|
|
334
337
|
}, glyph("chevronDown", 15))),
|
|
335
|
-
h("div", { className: "dfx-term-body", ref: hostRef }
|
|
338
|
+
h("div", { className: "dfx-term-body", ref: hostRef },
|
|
339
|
+
loadFailed
|
|
340
|
+
? h("div", { className: "dfx-term-fail" },
|
|
341
|
+
glyph("terminal", 18),
|
|
342
|
+
h("span", null, t("终端渲染器加载失败")),
|
|
343
|
+
h("span", { className: "dfx-term-fail-hint" }, t("插件里的 @xterm/xterm 没有找到,重装插件或刷新后重试")),
|
|
344
|
+
h("button", {
|
|
345
|
+
type: "button",
|
|
346
|
+
className: "dfx-btn",
|
|
347
|
+
onClick: function () { setLoadFailed(false); setRetryTick(function (count) { return count + 1; }); },
|
|
348
|
+
}, t("重试")))
|
|
349
|
+
: null));
|
|
336
350
|
}
|
|
337
351
|
|
|
338
352
|
/** Identity shared by the sidebar entry and the main panel it opens. */
|
|
@@ -555,6 +569,9 @@ window.__ModuleLoader__.load({
|
|
|
555
569
|
"添加为工作区": "Add as workspace",
|
|
556
570
|
"终端": "Terminal",
|
|
557
571
|
"新建终端": "New terminal",
|
|
572
|
+
"终端渲染器加载失败": "The terminal renderer failed to load",
|
|
573
|
+
"插件里的 @xterm/xterm 没有找到,重装插件或刷新后重试": "@xterm/xterm was not found in the plugin; reinstall it or reload and retry",
|
|
574
|
+
"重试": "Retry",
|
|
558
575
|
"隐藏终端": "Hide terminal",
|
|
559
576
|
"双击重命名": "Double-click to rename",
|
|
560
577
|
"在终端打开": "Open in terminal",
|
|
@@ -1075,6 +1092,9 @@ window.__ModuleLoader__.load({
|
|
|
1075
1092
|
.dfx-term-spacer { flex: 1 1 auto; }
|
|
1076
1093
|
.dfx-term-body { flex: 1 1 auto; min-height: 0; padding: 11px 10px 12px; overflow: hidden; }
|
|
1077
1094
|
.dfx-term-body .xterm { height: 100%; }
|
|
1095
|
+
.dfx-term-fail { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 100%; font-size: 12.5px; color: inherit; opacity: .75; text-align: center; }
|
|
1096
|
+
.dfx-term-fail-hint { font-size: 11.5px; opacity: .7; max-width: 420px; }
|
|
1097
|
+
.dfx-term-fail .dfx-btn { margin-top: 4px; }
|
|
1078
1098
|
.dfx-term .dfx-navbtn { color: inherit; opacity: .7; }
|
|
1079
1099
|
.dfx-term .dfx-navbtn:hover { opacity: 1; }
|
|
1080
1100
|
.dfx-term .dfx-navbtn--active { opacity: 1; }
|
package/lib/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import { chmodSync, createWriteStream, existsSync } from 'node:fs'
|
|
|
30
30
|
import { createRequire } from 'node:module'
|
|
31
31
|
import { access, cp, lstat, mkdir, readFile, readdir, realpath, rename, rm, stat, writeFile } from 'node:fs/promises'
|
|
32
32
|
import { homedir, platform } from 'node:os'
|
|
33
|
-
import { pathToFileURL } from 'node:url'
|
|
33
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
34
34
|
import { basename, dirname, extname, join, resolve, sep } from 'node:path'
|
|
35
35
|
import { Readable } from 'node:stream'
|
|
36
36
|
import { deflateRawSync, inflateRawSync } from 'node:zlib'
|
|
@@ -1186,30 +1186,47 @@ let termPtyModule = null
|
|
|
1186
1186
|
let termPtyTried = false
|
|
1187
1187
|
|
|
1188
1188
|
/**
|
|
1189
|
-
*
|
|
1190
|
-
*
|
|
1191
|
-
*
|
|
1189
|
+
* Make the macOS spawn helper executable: some package managers drop the bit,
|
|
1190
|
+
* and a non-executable helper makes spawn fail with posix_spawnp.
|
|
1191
|
+
* @param {string|null} root - node-pty package directory
|
|
1192
|
+
* @returns {void}
|
|
1193
|
+
*/
|
|
1194
|
+
function repairSpawnHelper(root) {
|
|
1195
|
+
if (!root) return
|
|
1196
|
+
for (const rel of ["prebuilds/" + process.platform + "-" + process.arch + "/spawn-helper", "build/Release/spawn-helper"]) {
|
|
1197
|
+
const helper = join(root, rel)
|
|
1198
|
+
try {
|
|
1199
|
+
if (existsSync(helper)) chmodSync(helper, 0o755)
|
|
1200
|
+
} catch {}
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* Load the pty backend. The copy vendored into this package is used first,
|
|
1206
|
+
* so nothing has to be installed; a separately installed node-pty still works
|
|
1207
|
+
* as a fallback for older setups.
|
|
1192
1208
|
* @returns {object|null} the node-pty module, or null when unavailable.
|
|
1193
1209
|
*/
|
|
1194
1210
|
function loadNodePty() {
|
|
1195
1211
|
if (termPtyTried) return termPtyModule
|
|
1196
1212
|
termPtyTried = true
|
|
1213
|
+
const require = createRequire(import.meta.url)
|
|
1214
|
+
let vendored = null
|
|
1197
1215
|
try {
|
|
1198
|
-
|
|
1199
|
-
|
|
1216
|
+
vendored = fileURLToPath(new URL("../vendor/node-pty/lib/index.js", import.meta.url))
|
|
1217
|
+
} catch {}
|
|
1218
|
+
for (const candidate of [vendored, "node-pty"]) {
|
|
1219
|
+
if (!candidate) continue
|
|
1200
1220
|
try {
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
}
|
|
1221
|
+
const loaded = require(candidate)
|
|
1222
|
+
termPtyModule = loaded
|
|
1223
|
+
if (candidate === vendored) {
|
|
1224
|
+
repairSpawnHelper(dirname(vendored))
|
|
1225
|
+
} else {
|
|
1226
|
+
try { repairSpawnHelper(dirname(require.resolve("node-pty/package.json"))) } catch {}
|
|
1208
1227
|
}
|
|
1228
|
+
break
|
|
1209
1229
|
} catch {}
|
|
1210
|
-
termPtyModule = loaded
|
|
1211
|
-
} catch {
|
|
1212
|
-
termPtyModule = null
|
|
1213
1230
|
}
|
|
1214
1231
|
return termPtyModule
|
|
1215
1232
|
}
|
|
@@ -1384,18 +1401,46 @@ function pollTerm(id, since) {
|
|
|
1384
1401
|
return { gone: false, data: parts.join(""), since: session.nextSeq, exited: session.exited, code: session.code }
|
|
1385
1402
|
}
|
|
1386
1403
|
|
|
1404
|
+
/**
|
|
1405
|
+
* Where @xterm/xterm may live. Node resolution comes first: a pnpm profile
|
|
1406
|
+
* with nodeLinker: hoisted keeps the package in the profile root rather than
|
|
1407
|
+
* inside the plugin, and only the resolver finds it there. The old plugin-
|
|
1408
|
+
* local path stays as a fallback.
|
|
1409
|
+
* @param {string} rel - path inside the package
|
|
1410
|
+
* @returns {string[]} candidate absolute paths, best first
|
|
1411
|
+
*/
|
|
1412
|
+
function vendorCandidates(rel) {
|
|
1413
|
+
const files = []
|
|
1414
|
+
try {
|
|
1415
|
+
const require = createRequire(import.meta.url)
|
|
1416
|
+
let root = null
|
|
1417
|
+
try {
|
|
1418
|
+
root = dirname(require.resolve("@xterm/xterm/package.json"))
|
|
1419
|
+
} catch {
|
|
1420
|
+
const main = require.resolve("@xterm/xterm")
|
|
1421
|
+
root = join(dirname(main), "..")
|
|
1422
|
+
}
|
|
1423
|
+
if (root) files.push(join(root, rel))
|
|
1424
|
+
} catch {}
|
|
1425
|
+
try {
|
|
1426
|
+
files.push(fileURLToPath(new URL("../node_modules/@xterm/xterm/" + rel, import.meta.url)))
|
|
1427
|
+
} catch {}
|
|
1428
|
+
return files
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1387
1431
|
/** Serve the terminal renderer from our own dependency. */
|
|
1388
1432
|
async function sendVendor(res, name) {
|
|
1389
1433
|
const allowed = { "xterm.js": "lib/xterm.js", "xterm.css": "css/xterm.css" }
|
|
1390
1434
|
const rel = allowed[name]
|
|
1391
1435
|
if (!rel) throw new RouteError(404, "unknown asset")
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1436
|
+
let data = null
|
|
1437
|
+
for (const file of vendorCandidates(rel)) {
|
|
1438
|
+
try {
|
|
1439
|
+
data = await readFile(file)
|
|
1440
|
+
break
|
|
1441
|
+
} catch {}
|
|
1398
1442
|
}
|
|
1443
|
+
if (!data) throw new RouteError(404, "xterm is not installed")
|
|
1399
1444
|
const type = name.endsWith(".css") ? "text/css; charset=utf-8" : "text/javascript; charset=utf-8"
|
|
1400
1445
|
res.writeHead(200, { "Content-Type": type, "Content-Length": data.length, "Cache-Control": "no-store" })
|
|
1401
1446
|
res.end(data)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maxbill/dsh-file-explorer",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
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",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"README.en.md",
|
|
23
23
|
"LICENSE",
|
|
24
24
|
"docs",
|
|
25
|
-
"screenshots.json"
|
|
25
|
+
"screenshots.json",
|
|
26
|
+
"vendor"
|
|
26
27
|
],
|
|
27
28
|
"keywords": [
|
|
28
29
|
"dsh",
|
|
@@ -66,8 +67,5 @@
|
|
|
66
67
|
},
|
|
67
68
|
"dependencies": {
|
|
68
69
|
"@xterm/xterm": "^5.5.0"
|
|
69
|
-
},
|
|
70
|
-
"optionalDependencies": {
|
|
71
|
-
"node-pty": "^1.1.0"
|
|
72
70
|
}
|
|
73
71
|
}
|
package/screenshots.json
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Copyright (c) 2012-2015, Christopher Jeffrey (https://github.com/chjj/)
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
The MIT License (MIT)
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2016, Daniel Imms (http://www.growingwiththeweb.com)
|
|
26
|
+
|
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
29
|
+
in the Software without restriction, including without limitation the rights
|
|
30
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
32
|
+
furnished to do so, subject to the following conditions:
|
|
33
|
+
|
|
34
|
+
The above copyright notice and this permission notice shall be included in all
|
|
35
|
+
copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
+
SOFTWARE.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
MIT License
|
|
48
|
+
|
|
49
|
+
Copyright (c) 2018 - present Microsoft Corporation
|
|
50
|
+
|
|
51
|
+
All rights reserved.
|
|
52
|
+
|
|
53
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
54
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
55
|
+
in the Software without restriction, including without limitation the rights
|
|
56
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
57
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
58
|
+
furnished to do so, subject to the following conditions:
|
|
59
|
+
|
|
60
|
+
The above copyright notice and this permission notice shall be included in all
|
|
61
|
+
copies or substantial portions of the Software.
|
|
62
|
+
|
|
63
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
64
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
65
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
66
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
67
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
68
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
69
|
+
SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2019, Microsoft Corporation (MIT License).
|
|
4
|
+
*
|
|
5
|
+
* This module fetches the console process list for a particular PID. It must be
|
|
6
|
+
* called from a different process (child_process.fork) as there can only be a
|
|
7
|
+
* single console attached to a process.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
var utils_1 = require("./utils");
|
|
11
|
+
var getConsoleProcessList = utils_1.loadNativeModule('conpty_console_list').module.getConsoleProcessList;
|
|
12
|
+
var shellPid = parseInt(process.argv[2], 10);
|
|
13
|
+
var consoleProcessList = getConsoleProcessList(shellPid);
|
|
14
|
+
process.send({ consoleProcessList: consoleProcessList });
|
|
15
|
+
process.exit(0);
|
|
16
|
+
//# sourceMappingURL=conpty_console_list_agent.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2019, Microsoft Corporation (MIT License).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EventEmitter2 = void 0;
|
|
7
|
+
var EventEmitter2 = /** @class */ (function () {
|
|
8
|
+
function EventEmitter2() {
|
|
9
|
+
this._listeners = [];
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(EventEmitter2.prototype, "event", {
|
|
12
|
+
get: function () {
|
|
13
|
+
var _this = this;
|
|
14
|
+
if (!this._event) {
|
|
15
|
+
this._event = function (listener) {
|
|
16
|
+
_this._listeners.push(listener);
|
|
17
|
+
var disposable = {
|
|
18
|
+
dispose: function () {
|
|
19
|
+
for (var i = 0; i < _this._listeners.length; i++) {
|
|
20
|
+
if (_this._listeners[i] === listener) {
|
|
21
|
+
_this._listeners.splice(i, 1);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return disposable;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return this._event;
|
|
31
|
+
},
|
|
32
|
+
enumerable: false,
|
|
33
|
+
configurable: true
|
|
34
|
+
});
|
|
35
|
+
EventEmitter2.prototype.fire = function (data) {
|
|
36
|
+
var queue = [];
|
|
37
|
+
for (var i = 0; i < this._listeners.length; i++) {
|
|
38
|
+
queue.push(this._listeners[i]);
|
|
39
|
+
}
|
|
40
|
+
for (var i = 0; i < queue.length; i++) {
|
|
41
|
+
queue[i].call(undefined, data);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return EventEmitter2;
|
|
45
|
+
}());
|
|
46
|
+
exports.EventEmitter2 = EventEmitter2;
|
|
47
|
+
//# sourceMappingURL=eventEmitter2.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License)
|
|
4
|
+
* Copyright (c) 2016, Daniel Imms (MIT License).
|
|
5
|
+
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.native = exports.open = exports.createTerminal = exports.fork = exports.spawn = void 0;
|
|
9
|
+
var utils_1 = require("./utils");
|
|
10
|
+
var terminalCtor;
|
|
11
|
+
if (process.platform === 'win32') {
|
|
12
|
+
terminalCtor = require('./windowsTerminal').WindowsTerminal;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
terminalCtor = require('./unixTerminal').UnixTerminal;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Forks a process as a pseudoterminal.
|
|
19
|
+
* @param file The file to launch.
|
|
20
|
+
* @param args The file's arguments as argv (string[]) or in a pre-escaped
|
|
21
|
+
* CommandLine format (string). Note that the CommandLine option is only
|
|
22
|
+
* available on Windows and is expected to be escaped properly.
|
|
23
|
+
* @param options The options of the terminal.
|
|
24
|
+
* @throws When the file passed to spawn with does not exists.
|
|
25
|
+
* @see CommandLineToArgvW https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391(v=vs.85).aspx
|
|
26
|
+
* @see Parsing C++ Comamnd-Line Arguments https://msdn.microsoft.com/en-us/library/17w5ykft.aspx
|
|
27
|
+
* @see GetCommandLine https://msdn.microsoft.com/en-us/library/windows/desktop/ms683156.aspx
|
|
28
|
+
*/
|
|
29
|
+
function spawn(file, args, opt) {
|
|
30
|
+
return new terminalCtor(file, args, opt);
|
|
31
|
+
}
|
|
32
|
+
exports.spawn = spawn;
|
|
33
|
+
/** @deprecated */
|
|
34
|
+
function fork(file, args, opt) {
|
|
35
|
+
return new terminalCtor(file, args, opt);
|
|
36
|
+
}
|
|
37
|
+
exports.fork = fork;
|
|
38
|
+
/** @deprecated */
|
|
39
|
+
function createTerminal(file, args, opt) {
|
|
40
|
+
return new terminalCtor(file, args, opt);
|
|
41
|
+
}
|
|
42
|
+
exports.createTerminal = createTerminal;
|
|
43
|
+
function open(options) {
|
|
44
|
+
return terminalCtor.open(options);
|
|
45
|
+
}
|
|
46
|
+
exports.open = open;
|
|
47
|
+
/**
|
|
48
|
+
* Expose the native API when not Windows, note that this is not public API and
|
|
49
|
+
* could be removed at any time.
|
|
50
|
+
*/
|
|
51
|
+
exports.native = (process.platform !== 'win32' ? utils_1.loadNativeModule('pty').module : null);
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2020, Microsoft Corporation (MIT License).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getWorkerPipeName = void 0;
|
|
7
|
+
function getWorkerPipeName(conoutPipeName) {
|
|
8
|
+
return conoutPipeName + "-worker";
|
|
9
|
+
}
|
|
10
|
+
exports.getWorkerPipeName = getWorkerPipeName;
|
|
11
|
+
//# sourceMappingURL=conout.js.map
|