dsh-single-terminal 0.1.0 → 0.1.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.md +80 -10
- package/README.zh.md +67 -10
- package/lib/client.js +222 -3112
- package/lib/client.js.map +1 -1
- package/lib/types/client/controller.d.ts +3 -0
- package/lib/types/client/controller.d.ts.map +1 -1
- package/lib/types/client/controller.js +9 -1
- package/lib/types/client/drawer.d.ts +4 -2
- package/lib/types/client/drawer.d.ts.map +1 -1
- package/lib/types/client/drawer.js +5 -3
- package/lib/types/client/styles.d.ts +7 -0
- package/lib/types/client/styles.d.ts.map +1 -1
- package/lib/types/client/styles.js +67 -25
- package/lib/types/client/term.d.ts +3 -1
- package/lib/types/client/term.d.ts.map +1 -1
- package/lib/types/client/term.js +17 -30
- package/lib/types/client/theme.d.ts +13 -0
- package/lib/types/client/theme.d.ts.map +1 -0
- package/lib/types/client/theme.js +92 -0
- package/lib/types/client/toggle.d.ts +19 -4
- package/lib/types/client/toggle.d.ts.map +1 -1
- package/lib/types/client/toggle.js +22 -6
- package/package.json +6 -2
- package/src/client/controller.ts +10 -1
- package/src/client/drawer.tsx +6 -4
- package/src/client/styles.ts +67 -25
- package/src/client/term.tsx +17 -30
- package/src/client/theme.ts +104 -0
- package/src/client/toggle.tsx +33 -7
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# dsh-single-terminal
|
|
2
2
|
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="assets/preview/1.png" alt="dsh-single-terminal preview" width="800" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
3
7
|
**dsh-single-terminal** is a real-terminal drawer plugin for the DeepSeek
|
|
4
8
|
Harness (DSH) host. It docks an interactive PTY terminal (xterm.js) to the
|
|
5
9
|
bottom of the web app — type into it, Ctrl-C it, resize it, open as many tabs
|
|
@@ -13,16 +17,30 @@ as you need.
|
|
|
13
17
|
from config; POSIX: `$SHELL` / bash / zsh / fish
|
|
14
18
|
- **Two drawer modes** — *Docked* pushes the page content up (no occlusion),
|
|
15
19
|
*Overlay* floats above it; drag the top edge to resize, the drawer remembers
|
|
16
|
-
mode and height
|
|
20
|
+
mode and height. Both modes share the same frosted-glass style (translucent
|
|
21
|
+
background + `backdrop-filter` blur) — the mode only decides docking
|
|
22
|
+
behavior. Open/close slides with the host's
|
|
23
|
+
easing curve and honors `prefers-reduced-motion`.
|
|
24
|
+
- **Theme following** — the drawer and the terminal palette follow the host's
|
|
25
|
+
theme (light / dark / custom themes) live; no separate theme config.
|
|
17
26
|
- **Keep-alive sessions** — terminals survive page refreshes and drawer
|
|
18
27
|
close/reopen; on reconnect the recent output is replayed from a ring buffer.
|
|
19
28
|
Opening the drawer with no terminal yet auto-creates one with the default
|
|
20
29
|
shell.
|
|
30
|
+
- **Workspace-aware cwd** — when the current session belongs to a workspace,
|
|
31
|
+
new terminals (including the auto-created one) start in that workspace root
|
|
32
|
+
directory, no manual `cd` needed; with no session / no workspace the
|
|
33
|
+
`defaultCwd` rules apply.
|
|
21
34
|
- **Bilingual UI** — follows the host interface language (中文 / English);
|
|
22
35
|
`Alt+C` toggles the drawer
|
|
23
36
|
|
|
24
37
|
[中文文档](README.zh.md)
|
|
25
38
|
|
|
39
|
+
## Preview
|
|
40
|
+
|
|
41
|
+
Screenshot of the terminal drawer (dark theme following, frosted-glass style):
|
|
42
|
+
see [preview.md](preview.md).
|
|
43
|
+
|
|
26
44
|
## Features
|
|
27
45
|
|
|
28
46
|
- **Header entry** (`conversation.session.header.utilities`): a panel-bottom
|
|
@@ -67,8 +85,10 @@ profile `cordis.patch.yml`:
|
|
|
67
85
|
|
|
68
86
|
- `defaultShell` — shell used by the `+` button; when unavailable it falls
|
|
69
87
|
back (`powershell` on Windows, `$SHELL`/`bash` on POSIX).
|
|
70
|
-
- `defaultCwd` —
|
|
71
|
-
|
|
88
|
+
- `defaultCwd` — start directory when there is no workspace context: `home`
|
|
89
|
+
(default) starts in the user home; `workspace` is reserved (currently
|
|
90
|
+
resolves to home); an absolute path must exist. When the current session
|
|
91
|
+
belongs to a workspace the workspace root takes precedence (see above).
|
|
72
92
|
- `customShells` — extra launchers; `command` may be an absolute path or a
|
|
73
93
|
name resolved through `PATH` (with `PATHEXT` on Windows).
|
|
74
94
|
|
|
@@ -92,6 +112,35 @@ dsh --profile web # start (restart required for the host half to
|
|
|
92
112
|
> `pnpm install` to compile it. The browser half inlines xterm.js entirely —
|
|
93
113
|
> no runtime dependency there.
|
|
94
114
|
|
|
115
|
+
## Publish
|
|
116
|
+
|
|
117
|
+
The build toolchain is **tsc + tsdown** (no vite): `tsc -b` type-checks and
|
|
118
|
+
emits declarations, while `tsdown` (Rolldown core) bundles the host half
|
|
119
|
+
(`lib/index.js`, ESM) and the browser half (`lib/client.js`, single-file CJS
|
|
120
|
+
`__ModuleLoader__` factory with auto banner wrapping). Dependency management
|
|
121
|
+
uses **pnpm 10** (the `pnpm-lock.yaml` is committed and CI installs with
|
|
122
|
+
`--frozen-lockfile`). Build artifacts are committed to git, so git installs
|
|
123
|
+
need no build:
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
pnpm install # install per pnpm-lock.yaml
|
|
127
|
+
pnpm run build # clean lib → tsc -b (declarations) → tsdown (both halves)
|
|
128
|
+
pnpm run verify # simulate the host module table to check lib/client.js (optional)
|
|
129
|
+
pnpm run release # check + build + verify + npm version patch + push tags (triggers the publish workflow)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Automated publishing (GitHub Actions)
|
|
133
|
+
|
|
134
|
+
Pushing a `v*` tag (`pnpm run release` bumps the patch version, rebuilds, and
|
|
135
|
+
tags/pushes automatically) triggers
|
|
136
|
+
[`.github/workflows/publish.yml`](.github/workflows/publish.yml) — a single
|
|
137
|
+
`release` job that: sets up Node 26 → `pnpm install --frozen-lockfile` →
|
|
138
|
+
`pnpm run check` → `pnpm run build` → `pnpm run verify` → `pnpm pack` →
|
|
139
|
+
creates a GitHub Release (auto-generated changelog, tarball attached) →
|
|
140
|
+
publishes to npm via **Trusted Publishing** (OIDC `--provenance`, no
|
|
141
|
+
`NPM_TOKEN` secret; the npm package must have this repository configured as a
|
|
142
|
+
Trusted Publisher).
|
|
143
|
+
|
|
95
144
|
## Development
|
|
96
145
|
|
|
97
146
|
Requirements: **Node ≥ 22.19 (or ≥ 24) + pnpm 10** (the `packageManager` field
|
|
@@ -106,14 +155,22 @@ pnpm run verify # simulate the host seed table to check lib/client.js loa
|
|
|
106
155
|
```
|
|
107
156
|
|
|
108
157
|
```
|
|
109
|
-
├── src/
|
|
110
|
-
├──
|
|
111
|
-
|
|
112
|
-
├── lib/
|
|
113
|
-
├──
|
|
114
|
-
├──
|
|
158
|
+
├── src/ # Source
|
|
159
|
+
│ ├── host/ # Host half: index.ts (entry, ws route + config), hub.ts (session hub + frame protocol), shells.ts (registry + probing), types.ts
|
|
160
|
+
│ └── client/ # Browser half: plugin.tsx (slots), drawer.tsx, term.tsx, controller.ts, ws.ts, styles.ts, theme.ts, toggle.tsx, i18n.ts ...
|
|
161
|
+
├── lib/ # Build artifacts (committed: git installs need no build)
|
|
162
|
+
│ ├── index.js # Host half (tsdown, ESM)
|
|
163
|
+
│ ├── client.js # Browser half (tsdown → __ModuleLoader__ factory, xterm inlined)
|
|
164
|
+
│ └── types/ # Type declarations (generated by tsc -b)
|
|
165
|
+
├── assets/preview/ # Screenshots referenced by README / preview.md
|
|
166
|
+
├── scripts/ # verify-client.mjs (host-seed simulation check), gen-xterm-css.mjs (regenerates src/client/xterm-css.ts)
|
|
167
|
+
├── tsdown.config.ts # tsdown build config (node half + client bundle banner wrapper)
|
|
168
|
+
├── tsconfig.json # solution: references tsconfig.host.json / tsconfig.client.json
|
|
115
169
|
├── cordis.patch.yml # Bundle patch: plugin row referenced by package name (no paths)
|
|
116
|
-
|
|
170
|
+
├── package.json # dsh.bundle + dsh.client(web) manifests + peerDependencies
|
|
171
|
+
├── README.md # This file (English)
|
|
172
|
+
├── README.zh.md # 中文文档
|
|
173
|
+
└── preview.md # Screenshot preview (references assets/preview/*.png)
|
|
117
174
|
```
|
|
118
175
|
|
|
119
176
|
## Implementation notes
|
|
@@ -140,5 +197,18 @@ pnpm run verify # simulate the host seed table to check lib/client.js loa
|
|
|
140
197
|
`taskkill /T /F` on the session pid — ConPTY closure alone can leave
|
|
141
198
|
PowerShell (+PSReadLine) alive; POSIX kills the foreground process group
|
|
142
199
|
(`kill(-pid)`).
|
|
200
|
+
- **Theme following**: all plugin CSS consumes the host's semantic alias
|
|
201
|
+
tokens (`--dsw-alias-*`, defined on `body` and flipped by
|
|
202
|
+
`body[data-ds-dark-theme]`), so light / dark / custom themes apply without
|
|
203
|
+
plugin-side logic. The xterm palette is computed at runtime: alias token
|
|
204
|
+
values are read via a hidden probe element (`getComputedStyle`), the
|
|
205
|
+
background is re-composed with the frosted alpha, and a `MutationObserver`
|
|
206
|
+
on the body attribute re-applies the palette — theme switches (including
|
|
207
|
+
custom themes projected by the host's ThemePresenter) update live.
|
|
208
|
+
- **Renderer strategy**: xterm 5 ships DOM renderer only by default
|
|
209
|
+
(`allowTransparency` works there, while WebGL canvases are opaque). Both
|
|
210
|
+
modes share the frosted style, so the plugin stays on the DOM renderer with
|
|
211
|
+
a translucent terminal background under the frosted blur in every mode —
|
|
212
|
+
the WebGL addon was removed rather than swapped at runtime.
|
|
143
213
|
- **The official `deepseek-harness` project is not modified**; all UI sits in
|
|
144
214
|
existing slots (`shell.overlay`, `conversation.session.header.utilities`).
|
package/README.zh.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# dsh-single-terminal
|
|
2
2
|
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="assets/preview/1.png" alt="dsh-single-terminal 预览" width="800" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
3
7
|
**dsh-single-terminal** 是 DeepSeek Harness(DSH)宿主的真实终端抽屉插件。它在
|
|
4
8
|
Web 应用底部挂一条交互式 PTY 终端(xterm.js)——可以正常敲命令、Ctrl-C、拖拽
|
|
5
9
|
改大小、开任意多个标签。
|
|
@@ -9,13 +13,23 @@ Web 应用底部挂一条交互式 PTY 终端(xterm.js)——可以正常敲
|
|
|
9
13
|
- **Shell 选择** —— Windows:PowerShell(默认)/ pwsh 7 / CMD / Git Bash / WSL
|
|
10
14
|
(未安装的自动隐藏)+ config 自定义 shell;POSIX:`$SHELL` / bash / zsh / fish
|
|
11
15
|
- **两种抽屉模式** —— *占高度* 把页面内容顶起(无遮挡),*浮层* 悬浮于内容之上;
|
|
12
|
-
|
|
16
|
+
顶边可拖拽调高度,模式与高度自动记忆。两种模式共用同一磨砂玻璃样式
|
|
17
|
+
(半透明背景 + `backdrop-filter` 高斯模糊)——模式只决定停靠行为。开合带
|
|
18
|
+
滑入滑出动画(沿用宿主缓动曲线,尊重系统减动效设置)。
|
|
19
|
+
- **主题跟随** —— 抽屉与终端配色实时跟随宿主主题(浅色 / 深色 / 自定义主题),
|
|
20
|
+
无需单独配置。
|
|
13
21
|
- **会话保活** —— 终端在页面刷新、抽屉开合后继续存活;重连后从环形缓冲回放
|
|
14
22
|
近期输出。打开抽屉时若还没有任何终端,会自动用默认 shell 新建一个。
|
|
23
|
+
- **工作区路径感知** —— 当前会话归属某个工作区时,新建终端(含自动新建)直接
|
|
24
|
+
落在该工作区根目录,无需手动 `cd`;无会话 / 无工作区时回退 `defaultCwd` 规则。
|
|
15
25
|
- **双语 UI** —— 跟随宿主界面语言(中文 / English);`Alt+C` 开关抽屉
|
|
16
26
|
|
|
17
27
|
[English](README.md)
|
|
18
28
|
|
|
29
|
+
## 预览
|
|
30
|
+
|
|
31
|
+
终端抽屉截图(暗色主题跟随、磨砂玻璃样式):见 [preview.md](preview.md)。
|
|
32
|
+
|
|
19
33
|
## 功能
|
|
20
34
|
|
|
21
35
|
- **会话头部入口**(`conversation.session.header.utilities`):会话头部
|
|
@@ -58,8 +72,9 @@ Schemastery `Config`(宿主 Plugins 设置页自动渲染),和 / 或 profi
|
|
|
58
72
|
|
|
59
73
|
- `defaultShell` —— `+` 按钮使用的 shell;不可用时自动回退(Windows 回退
|
|
60
74
|
`powershell`,POSIX 回退 `$SHELL`/`bash`)。
|
|
61
|
-
- `defaultCwd` ——
|
|
62
|
-
home
|
|
75
|
+
- `defaultCwd` —— 无工作区上下文时的启动目录:`home`(默认)从用户主目录启动;
|
|
76
|
+
`workspace` 预留(当前等同 home);绝对路径必须存在。当前会话归属工作区时
|
|
77
|
+
优先使用工作区根目录(见上)。
|
|
63
78
|
- `customShells` —— 额外启动器;`command` 可为绝对路径或从 `PATH` 解析的名称
|
|
64
79
|
(Windows 上叠加 `PATHEXT`)。
|
|
65
80
|
|
|
@@ -82,6 +97,31 @@ dsh --profile web # 启动(宿主半边需重启后生效)
|
|
|
82
97
|
> `pnpm install` 时需要 C/C++ 工具链编译。浏览器半边完整内联 xterm.js,
|
|
83
98
|
> 无运行时依赖。
|
|
84
99
|
|
|
100
|
+
## 发布
|
|
101
|
+
|
|
102
|
+
构建工具链为 **tsc + tsdown**(无 vite):`tsc -b` 负责类型检查并产出声明文件,
|
|
103
|
+
`tsdown`(Rolldown 内核)打包宿主半(`lib/index.js`,ESM)与浏览器半
|
|
104
|
+
(`lib/client.js`,单文件 CJS `__ModuleLoader__` 工厂,自动 banner 包裹)。
|
|
105
|
+
依赖管理使用 **pnpm 10**(`pnpm-lock.yaml` 入库,CI 按 `--frozen-lockfile`
|
|
106
|
+
安装)。构建产物随 git 提交,git 安装无需本地构建:
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
pnpm install # 按 pnpm-lock.yaml 安装
|
|
110
|
+
pnpm run build # 清空 lib → tsc -b(声明)→ tsdown(双半产物)
|
|
111
|
+
pnpm run verify # 模拟宿主模块表检查 lib/client.js(可选)
|
|
112
|
+
pnpm run release # check + build + verify + npm version patch + 推送 tag(触发发布工作流)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 自动发布(GitHub Actions)
|
|
116
|
+
|
|
117
|
+
推送 `v*` tag(`pnpm run release` 会自动 bump 补丁版本、重建并打 tag 推送)会
|
|
118
|
+
触发 [`.github/workflows/publish.yml`](.github/workflows/publish.yml)——单个
|
|
119
|
+
`release` job:Setup Node 26 → `pnpm install --frozen-lockfile` →
|
|
120
|
+
`pnpm run check` → `pnpm run build` → `pnpm run verify` → `pnpm pack` →
|
|
121
|
+
创建 GitHub Release(自动生成 changelog,附带 tarball)→ 经 **Trusted
|
|
122
|
+
Publishing**(OIDC `--provenance`,无需 `NPM_TOKEN` secret)发布到 npm
|
|
123
|
+
(需先在 npmjs.com 把该包的本仓库配置为 Trusted Publisher)。
|
|
124
|
+
|
|
85
125
|
## 开发
|
|
86
126
|
|
|
87
127
|
环境要求:**Node ≥ 22.19(或 ≥ 24)+ pnpm 10**(`packageManager` 固定 pnpm 版本)。
|
|
@@ -95,14 +135,22 @@ pnpm run verify # 模拟宿主 seed 表检查 lib/client.js 可加载
|
|
|
95
135
|
```
|
|
96
136
|
|
|
97
137
|
```
|
|
98
|
-
├── src/
|
|
99
|
-
├──
|
|
100
|
-
|
|
101
|
-
├── lib/
|
|
102
|
-
├──
|
|
103
|
-
├──
|
|
138
|
+
├── src/ # 源码
|
|
139
|
+
│ ├── host/ # 宿主半边:index.ts(入口,ws 路由 + 配置)、hub.ts(会话 Hub + 帧协议)、shells.ts(注册表 + 探测)、types.ts
|
|
140
|
+
│ └── client/ # 浏览器半边:plugin.tsx(slots)、drawer.tsx、term.tsx、controller.ts、ws.ts、styles.ts、theme.ts、toggle.tsx、i18n.ts ...
|
|
141
|
+
├── lib/ # 构建产物(入库:git 安装无需本地构建)
|
|
142
|
+
│ ├── index.js # 宿主半边(tsdown,ESM)
|
|
143
|
+
│ ├── client.js # 浏览器半边(tsdown → __ModuleLoader__ 工厂,xterm 已内联)
|
|
144
|
+
│ └── types/ # 类型声明(tsc -b 生成)
|
|
145
|
+
├── assets/preview/ # README / preview.md 引用的截图
|
|
146
|
+
├── scripts/ # verify-client.mjs(宿主 seed 表模拟检查)、gen-xterm-css.mjs(重新生成 src/client/xterm-css.ts)
|
|
147
|
+
├── tsdown.config.ts # tsdown 构建配置(node 半 + client bundle banner 包裹)
|
|
148
|
+
├── tsconfig.json # solution:引用 tsconfig.host.json / tsconfig.client.json
|
|
104
149
|
├── cordis.patch.yml # Bundle patch:按包名引用的插件行(无路径)
|
|
105
|
-
|
|
150
|
+
├── package.json # dsh.bundle + dsh.client(web) manifests + peerDependencies
|
|
151
|
+
├── README.md # 英文文档
|
|
152
|
+
├── README.zh.md # 本文件(中文)
|
|
153
|
+
└── preview.md # 截图预览(引用 assets/preview/*.png)
|
|
106
154
|
```
|
|
107
155
|
|
|
108
156
|
## 实现说明
|
|
@@ -125,5 +173,14 @@ pnpm run verify # 模拟宿主 seed 表检查 lib/client.js 可加载
|
|
|
125
173
|
- **Windows 进程树**:关闭标签执行 `pty.kill()` 后追加 `taskkill /T /F` ——
|
|
126
174
|
仅关 ConPTY 时 PowerShell(+PSReadLine)可能存活;POSIX 杀前台进程组
|
|
127
175
|
(`kill(-pid)`)。
|
|
176
|
+
- **主题跟随**:插件 CSS 全部消费宿主语义 alias token(`--dsw-alias-*`,定义在
|
|
177
|
+
`body` 上,随 `body[data-ds-dark-theme]` 翻转),浅色 / 深色 / 自定义主题
|
|
178
|
+
无需插件侧逻辑即可生效。xterm 调色板在运行时现算:经隐藏探针元素读取
|
|
179
|
+
alias token 的 computed 值,按磨砂 alpha 重组背景色,并用 `MutationObserver`
|
|
180
|
+
监听 body 属性重新套用——主题切换(含宿主 ThemePresenter 投影的自定义主题)
|
|
181
|
+
实时生效。
|
|
182
|
+
- **渲染器策略**:xterm 5 默认仅有 DOM 渲染器(`allowTransparency` 在此有效,
|
|
183
|
+
WebGL canvas 不支持 alpha)。两种模式共用磨砂样式,因此统一保持 DOM 渲染器 +
|
|
184
|
+
半透明终端背景置于磨砂模糊之上——不做运行时渲染器切换,WebGL 插件已移除。
|
|
128
185
|
- **不修改官方 `deepseek-harness` 项目**;全部 UI 落在既有插槽
|
|
129
186
|
(`shell.overlay`、`conversation.session.header.utilities`)。
|