dsh-ui-tweaks 0.11.2 → 0.12.0
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/LICENSE +21 -21
- package/README.en.md +18 -26
- package/README.md +21 -21
- package/cordis.patch.yml +12 -12
- package/lib/client.js +564 -1001
- package/lib/client.js.map +1 -1
- package/lib/config.js +7 -41
- package/lib/config.js.map +1 -1
- package/lib/git-web.js +42 -4
- package/lib/git-web.js.map +1 -1
- package/lib/git.js +103 -391
- package/lib/git.js.map +1 -1
- package/lib/index.js +2 -7
- package/lib/index.js.map +1 -1
- package/lib/types/client/archive.d.ts +4 -3
- package/lib/types/client/archive.d.ts.map +1 -1
- package/lib/types/client/cachehit.d.ts +1 -1
- package/lib/types/client/cachehit.d.ts.map +1 -1
- package/lib/types/client/gitbar.d.ts +6 -5
- package/lib/types/client/gitbar.d.ts.map +1 -1
- package/lib/types/client/graphlayout.d.ts +58 -0
- package/lib/types/client/graphlayout.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +15 -29
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/notifier.d.ts +9 -1
- package/lib/types/client/notifier.d.ts.map +1 -1
- package/lib/types/client/whale.d.ts +2 -1
- package/lib/types/client/whale.d.ts.map +1 -1
- package/lib/types/config.d.ts +8 -61
- package/lib/types/config.d.ts.map +1 -1
- package/lib/types/git-web.d.ts.map +1 -1
- package/lib/types/git.d.ts +54 -50
- package/lib/types/git.d.ts.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +141 -123
- package/vendor/addon-fit.js +1 -1
- package/vendor/xterm.css +218 -218
- package/vendor/xterm.js +1 -1
- package/assets/dialog_box.png +0 -0
- package/assets/timeline.png +0 -0
- package/lib/timeline.js +0 -91
- package/lib/timeline.js.map +0 -1
- package/lib/types/client/timeline.d.ts +0 -64
- package/lib/types/client/timeline.d.ts.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 dsh-ui-tweaks contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-ui-tweaks contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# dsh-ui-tweaks
|
|
2
2
|
|
|
3
|
+
> **Version requirement**: this release (v0.12.0) requires **DSH v0.1.2-alpha.2 or newer** — the conversation timeline and dialog width now ship natively in DSH, so the plugin dropped its own duplicate implementations (the message font size and line-spacing settings were dropped alongside). On an older host, pin the previous version to keep those features: `npx -y @deepseek-ai/dsh plugin --profile web add dsh-ui-tweaks@0.11.2`.
|
|
4
|
+
|
|
3
5
|
A [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/) (DSH) web plugin that live-tunes the conversation UI from the Settings panel.
|
|
4
6
|
|
|
5
7
|
## Preview
|
|
6
8
|
|
|
7
9
|
| | |
|
|
8
10
|
|---|---|
|
|
9
|
-
|  |  |
|
|
12
|
-
| **Dialog width**: message column, composer and stats line widen together | **Settings panel**: font & code size / line spacing / table style / dialog width / timeline / GitBar / whale indicator toggles |
|
|
11
|
+
|  |  |
|
|
12
|
+
| **Table style**: the Claude Desktop look (light-gray rounded cards) | **Settings panel**: code font size / table style / GitBar / whale indicator toggles |
|
|
13
13
|
|  |  |
|
|
14
|
-
| **GitBar**: git pills inside the composer tool row (branch after the access-mode control, diff before the model select) — branch management, per-file diff, and commit & push from the diff panel | **Branch panel**: pops up from the branch pill — local / remote branch lists, click to switch, delete & push to remote, new-branch field at the bottom |
|
|
14
|
+
| **GitBar**: git pills inside the composer tool row (branch after the access-mode control, diff before the model select) — branch management, per-file diff, and commit & push from the diff panel | **Branch panel**: pops up from the branch pill — local / remote branch lists, click to switch, delete, pull & push to remote, new-branch field at the bottom, plus a **commit graph** dialog (colored SVG fork/merge lanes) |
|
|
15
15
|
|  |  |
|
|
16
16
|
| **Diff panel**: file list + per-file diff (changed hunks only by default) with a commit area (commit / commit & push) at the bottom; drag to resize | **Terminal panel**: a real PTY terminal (xterm.js over WebSocket) — full interactivity, drag to resize, one-click half-screen |
|
|
17
17
|
|  | |
|
|
@@ -21,12 +21,10 @@ A [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/) (DSH)
|
|
|
21
21
|
|
|
22
22
|
## Features
|
|
23
23
|
|
|
24
|
-
- **
|
|
24
|
+
- **Code font size (px)** — absolute 8–32px, default 13 (DSH's stock code-block size at a 16px body); applies to code blocks, with inline code following proportionally. The legacy percentage (`codeFontScale`) stays compatible and is overridden once a px value is set. Message text keeps DSH's stock sizing.
|
|
25
25
|
- **Table style** — choose `Default` or the **Claude Desktop** look (light-gray rounded cell cards with small gaps, no borders; cells share the inline-code background; header not bold).
|
|
26
|
-
- **Dialog width (px)** — type any value (600–1600); the message column, the composer input and the stats line below it widen together.
|
|
27
|
-
- **Conversation timeline (toggleable, off by default)** — a thin navigation rail at the right of the message area: one indicator line per user message, hover to expand a preview panel, scroll-highlighting of the current position, click to smooth-scroll to that message (loading older history on demand). Works in **light and dark mode**, and **always hugs the message area's right edge** — even with a right sidebar installed and expanded (e.g. dsh-better-sidebar), the rail dodges it instead of overlapping. Auto-hidden while a session has fewer than two user messages.
|
|
28
26
|
- **GitBar (toggleable, off by default)** — when the session's working directory is a git repository, two compact pills render **inside the composer's tool row** (styled like the native access-mode / model-select controls, so the input area no longer carries a separate row above the card):
|
|
29
|
-
- **Branch pill** — right after the access-mode control; shows the current branch and opens an upward branch panel (local / remote lists, `git switch` on click, new-branch field).
|
|
27
|
+
- **Branch pill** — right after the access-mode control; shows the current branch and opens an upward branch panel (local / remote lists, `git switch` on click, new-branch field). A **pull** button sits beside the current branch in the panel header (`git pull --ff-only` — fast-forward only: a diverged branch aborts with git's own error instead of silently merging; hidden when the branch has no upstream), so what gets pulled is always the branch in the header. The panel's **Graph** entry opens the **commit graph** dialog: the latest 150 commits (`git log --date-order --all`) are laid out into lanes and rendered as a colored SVG fork/merge graph — dots are commits, curves are forks/merges, each branch line keeps its own color and merge arcs adopt the color of the lane they join; rows highlight on hover, refresh in the header.
|
|
30
28
|
- **Diff pill** — right before the model select; shows `+N −M · K files` and opens the right slide-over diff panel (changed-file list + per-file diff, resizable, commit band kept at its foot for 提交 / 提交并推送). The standalone commit pill is gone — commit now happens from the diff panel.
|
|
31
29
|
- **Squeeze-aware**: the composer tool row is an inline-size container, so when it tightens (e.g. the stretched diff panel pushes the column), the pills degrade like the native chrome — first hiding the "· K files" meta, then collapsing to **icon-only** — never overlapping the access / model controls.
|
|
32
30
|
- **Header utilities** — beside "Session log", an icon group: **Open project** (a menu launching Explorer / VS Code / IDEA / GoLand / WebStorm / PyCharm at the session cwd), a **real PTY terminal** panel (xterm.js over WebSocket, drag to resize, one-click half-screen) and the **diff** panel toggle; the diff icon carries the uncommitted-changes dot.
|
|
@@ -48,10 +46,7 @@ All changes apply **live** — no reload needed. The same values can be hand-edi
|
|
|
48
46
|
|
|
49
47
|
```yaml
|
|
50
48
|
ui-tweaks:
|
|
51
|
-
fontSize: 16
|
|
52
49
|
tableStyle: claude
|
|
53
|
-
dialogWidth: 880
|
|
54
|
-
timelineEnabled: true # defaults to false (off); set true to enable
|
|
55
50
|
gitBarEnabled: true # defaults to false (off); set true to enable GitBar
|
|
56
51
|
archiveManagerEnabled: true # defaults to false (off); set true to show the Archive page
|
|
57
52
|
initCommandEnabled: true # defaults to false (off); set true to register the /init slash command
|
|
@@ -72,6 +67,14 @@ npx -y @deepseek-ai/dsh plugin --profile web add dsh-ui-tweaks
|
|
|
72
67
|
npx -y @deepseek-ai/dsh plugin --profile web add github:wlj521/dsh-ui-tweaks
|
|
73
68
|
```
|
|
74
69
|
|
|
70
|
+
The package spec after `add` is forwarded to pnpm verbatim, so versions can be
|
|
71
|
+
pinned — `@version` for the npm package, `#tag` for the GitHub source:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npx -y @deepseek-ai/dsh plugin --profile web add dsh-ui-tweaks@0.11.2 # pin the npm version
|
|
75
|
+
npx -y @deepseek-ai/dsh plugin --profile web add github:wlj521/dsh-ui-tweaks#v0.11.2 # pin a git tag
|
|
76
|
+
```
|
|
77
|
+
|
|
75
78
|
For GitHub installs, pnpm may ask you to approve the package's build script —
|
|
76
79
|
add the exact key it prints to the profile's `pnpm-workspace.yaml`:
|
|
77
80
|
|
|
@@ -106,22 +109,11 @@ npx -y @deepseek-ai/dsh plugin --profile web add . # bundle install from
|
|
|
106
109
|
- **Server** (`src/index.ts`) registers the `ui-tweaks` settings namespace and
|
|
107
110
|
mounts a same-origin route (`/_dsh/ui-tweaks/settings`) — the Web settings
|
|
108
111
|
RPC only exposes a fixed allowlist of namespaces since rc.6, so a custom route
|
|
109
|
-
is how a plugin owns a configuration page.
|
|
110
|
-
the `dshChatTimeline` session projection that durably enumerates user
|
|
111
|
-
messages.
|
|
112
|
+
is how a plugin owns a configuration page.
|
|
112
113
|
- **Browser** (`src/client/index.tsx`) reads/writes that route, renders the
|
|
113
114
|
Settings section, and applies the values live via a runtime `<style>` element
|
|
114
|
-
that overrides stable DSH anchors (`
|
|
115
|
-
`[data-
|
|
116
|
-
`[data-slot="conversation.chat.node"]`).
|
|
117
|
-
- **Timeline** (`src/client/timeline.tsx`) mounts in the
|
|
118
|
-
`conversation.input.dock` slot and portals to `body`. Data sources, fastest
|
|
119
|
-
first: session projection → loaded chat nodes → background `loadOlder`. Its
|
|
120
|
-
position is anchored by measuring the right edge and vertical center of
|
|
121
|
-
`[data-conversation-scroll]` (the message area), so it follows both the DSH
|
|
122
|
-
column grid and any right-sidebar layout push (`#root` margin-right);
|
|
123
|
-
colors ride DSH theme tokens (`--dsw-alias-*`) for correct light/dark
|
|
124
|
-
rendering.
|
|
115
|
+
that overrides stable DSH anchors (`body` markdown code-font tokens, markdown
|
|
116
|
+
tables inside `[data-slot="conversation.chat.node"]`).
|
|
125
117
|
- **Precise cache hit** (`src/client/cachehit.tsx`) mounts a null-rendering
|
|
126
118
|
seat in the `conversation.composer.dock` slot (the band hosting the stock
|
|
127
119
|
stats line) and reads the session's token usage through the framework's
|
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# dsh-ui-tweaks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **版本要求**:本版本(v0.12.0)需要 **DSH v0.1.2-alpha.2 及以上**——对话时间线与对话框宽度已由 DSH 原生提供,插件因此移除了自带的重复实现(消息字体大小与行高设置也一并移除)。宿主暂未升级时,可指定安装旧版继续使用这些功能:`npx -y @deepseek-ai/dsh plugin --profile web add dsh-ui-tweaks@0.11.2`。
|
|
4
|
+
|
|
5
|
+
[DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/)(DSH)Web UI 插件:在设置面板中实时调整对话界面——代码字号、表格样式、**GitBar**(输入框工具行内的 git 状态胶囊:分支在权限旁、差异在模型前),可开关的**归档管理**(设置中的「归档」页面:查看、恢复或彻底删除已归档会话),可开关的**任务提醒**(会话完成或需要交互时,通过标签页标题闪烁 / 系统通知 / 提示音把你唤回来),以及**缓存命中率两位小数**(把输入框下方统计条的缓存命中百分比改写为精确值)。
|
|
4
6
|
|
|
5
7
|
## 预览
|
|
6
8
|
|
|
7
9
|
| | |
|
|
8
10
|
|---|---|
|
|
9
|
-
|  |  |
|
|
12
|
-
| **对话框宽度**:消息列、输入框、统计栏同步变宽 | **设置面板**:字体大小 / 代码字号 / 行高 / 表格样式 / 对话框宽度 / 时间线 / Git 状态栏 / 鲸鱼指示器等功能开关 |
|
|
11
|
+
|  |  |
|
|
12
|
+
| **表格样式**:Claude Desktop 浅灰圆角卡片风格 | **设置面板**:代码字号 / 表格样式 / Git 状态栏 / 鲸鱼指示器等功能开关 |
|
|
13
13
|
|  |  |
|
|
14
|
-
| **GitBar**:输入框工具行内的 git 状态胶囊(分支在权限旁、差异在模型前),支持分支切换、删除、推送到远程,差异面板内可直接提交 | **分支面板**:点击分支胶囊向上弹出——本地 /
|
|
14
|
+
| **GitBar**:输入框工具行内的 git 状态胶囊(分支在权限旁、差异在模型前),支持分支切换、删除、推送到远程,差异面板内可直接提交 | **分支面板**:点击分支胶囊向上弹出——本地 / 远程分支列表,点击即切换,支持删除、拉取、推送远程,底部可新建分支,菜单里可打开**提交图谱**(彩色 SVG 分叉图) |
|
|
15
15
|
|  |  |
|
|
16
16
|
| **差异面板**:文件列表 + 逐文件 diff(默认只显示有差异的 hunk),底部提交区可提交 / 提交并推送,宽度可拖动 | **终端面板**:真 PTY 终端(xterm.js + WebSocket),完整终端交互,宽度可拖动、一键半屏 |
|
|
17
17
|
|  | |
|
|
@@ -21,13 +21,11 @@
|
|
|
21
21
|
|
|
22
22
|
## 功能
|
|
23
23
|
|
|
24
|
-
-
|
|
24
|
+
- **代码字号(px)**:绝对值 8–32,默认 13(正文 16 时的 DSH 原生代码块字号);作用于代码块,行内代码按比例跟随——旧版的百分比配置(`codeFontScale`)仍然兼容,一旦设置新的 px 值即以其为准。消息正文保持 DSH 原生字号。
|
|
25
25
|
- **表格样式**:可选 `默认` 或 **Claude Desktop** 风格(浅灰圆角单元格卡片、单元格间有间隙、无边框、单元格与行内代码同底色、表头不加粗)。Claude 风格下表格默认撑满列宽;放不下的宽表保持自然宽度、在表格内横向滚动(悬停出现滚动条),不会被挤压换行或裁掉后面的列。
|
|
26
|
-
- **对话框宽度(px)**:直接输入数字(600–1600);消息列、输入框、输入框下方的统计栏(轮数/步数/耗时/tok/s)**三者同步变宽**,宽表格的两侧「出血」量也随列宽同步计算——表格最多贴到消息区边缘(悬停出滚动条),不会伸出屏幕。
|
|
27
|
-
- **对话时间线(可开关,默认关闭)**:在消息区右侧显示细竖导航轨——每条用户消息一根指示线,悬停展开面板预览消息、随滚动高亮当前位置、点击平滑跳转到对应消息(自动加载更早历史)。**浅色/深色模式都正常显示**,且**始终贴在消息区右侧**:即使安装了右侧边栏(如 dsh-better-sidebar)并展开,时间线也会自动避让、不会与侧边栏重叠。会话中用户消息少于 2 条时自动隐藏。
|
|
28
26
|
- **GitBar(默认关闭,可在设置中开启)**:当会话的工作目录是一个 git 仓库时,在**输入框工具行内**显示两颗与输入框原生控件(权限 / 模型选择)同款样式的紧凑胶囊——不再占用输入框上方单独一行,输入区因此更矮:
|
|
29
|
-
- **分支胶囊**:位于权限(访问模式)控件之后;显示当前分支名(有未提交改动时在标题提示)。点击**向上**弹出分支面板——本地 / 远程分支列表(点击即 `git switch`),底部可**新建分支**(`git switch -c`
|
|
30
|
-
- **差异胶囊**:位于模型选择之前;显示 `+N −M · K 个文件`。点击从右侧滑出**差异面板**:文件列表 + 逐文件 diff(默认**只显示有差异的 hunk
|
|
27
|
+
- **分支胶囊**:位于权限(访问模式)控件之后;显示当前分支名(有未提交改动时在标题提示)。点击**向上**弹出分支面板——本地 / 远程分支列表(点击即 `git switch`),底部可**新建分支**(`git switch -c` 并自动切换)。**头部当前分支右侧是拉取按钮**(`git pull --ff-only`:只快进,分叉时中止并显示 git 报错而不悄悄合并;无 upstream 的分支不显示该按钮),拉的就是头部显示的那个分支。菜单里的**图谱**打开**提交图谱**对话框:最近 150 条提交(`git log --date-order --all`)按拓扑自动分 lane,渲染成彩色 SVG 分叉图——圆点是提交、曲线是 fork/merge,各分支线独立着色,合并弧线汇入目标分支并采用其颜色;行悬停高亮,右上角可刷新。
|
|
28
|
+
- **差异胶囊**:位于模型选择之前;显示 `+N −M · K 个文件`。点击从右侧滑出**差异面板**:文件列表 + 逐文件 diff(默认**只显示有差异的 hunk**,右上可切“完整文件”视图)。面板**支持拖动拉伸宽度**,展开时**自动把对话区往左挤**;面板内三段(文件列表 / diff 内容 / 提交区)之间的分隔线**可上下拖动调整高度**(双击复位;提交说明框随提交区高度拉伸,可写多行,Shift+Enter 换行)。**提交区保留在差异面板底部**(提交 / 提交并推送,提交说明必须自行填写)——原来的独立 commit 胶囊已移除。
|
|
31
29
|
- **挤压自适应**:输入框工具行变窄时(例如差异面板拉宽把对话列挤小),胶囊像原生控件一样自动降级——先隐藏“· K 个文件”元信息,行再窄时**收敛为纯图标**,分支名与差异文字绝不会和权限、模型选择重叠。
|
|
32
30
|
- 非 git 仓库或无会话 cwd 时胶囊自动隐藏;所有操作走服务端 `execFile('git', …)`(无 shell、带超时)。
|
|
33
31
|
- **归档管理(可开关,默认关闭)**:设置面板中的「归档」页面,列出所有已归档会话(标题 / 所在工作区 / 相对时间),支持**恢复**与**彻底删除**:
|
|
@@ -51,17 +49,13 @@
|
|
|
51
49
|
|
|
52
50
|
```yaml
|
|
53
51
|
ui-tweaks:
|
|
54
|
-
fontSize: 16
|
|
55
52
|
tableStyle: claude
|
|
56
|
-
dialogWidth: 880
|
|
57
|
-
timelineEnabled: true # 默认 false(关闭),设为 true 开启
|
|
58
53
|
gitBarEnabled: true # 默认 false(关闭),设为 true 开启 GitBar
|
|
59
54
|
archiveManagerEnabled: true # 默认 false(关闭),设为 true 开启「归档」页面
|
|
60
55
|
initCommandEnabled: true # 默认 false(关闭),设为 true 开启 /init 斜杠命令
|
|
61
56
|
whaleIndicatorEnabled: true # 默认 false(关闭),设为 true 开启鲸鱼指示器
|
|
62
57
|
preciseCacheHitEnabled: true # 默认 false(关闭),设为 true 开启缓存命中率两位小数
|
|
63
58
|
notificationsEnabled: true # 默认 false(关闭),设为 true 开启任务提醒(事件过滤与三个通道在设置里逐项开关)
|
|
64
|
-
# suggestModel: 'provider:model' # 可选:指定生成提交说明的模型
|
|
65
59
|
```
|
|
66
60
|
|
|
67
61
|
设置入口:**设置 → 界面调整**。
|
|
@@ -76,6 +70,13 @@ npx -y @deepseek-ai/dsh plugin --profile web add dsh-ui-tweaks
|
|
|
76
70
|
npx -y @deepseek-ai/dsh plugin --profile web add github:wlj521/dsh-ui-tweaks
|
|
77
71
|
```
|
|
78
72
|
|
|
73
|
+
`add` 后面的包说明会**原样转发给 pnpm**,因此可以指定版本——npm 包用 `@版本号`,GitHub 源码用 `#tag`:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npx -y @deepseek-ai/dsh plugin --profile web add dsh-ui-tweaks@0.11.2 # 锁定 npm 版本
|
|
77
|
+
npx -y @deepseek-ai/dsh plugin --profile web add github:wlj521/dsh-ui-tweaks#v0.11.2 # 锁定 git tag
|
|
78
|
+
```
|
|
79
|
+
|
|
79
80
|
从 GitHub 安装时,pnpm 可能要求批准该包的构建脚本——把提示的包键加进该 profile 的 `pnpm-workspace.yaml`:
|
|
80
81
|
|
|
81
82
|
```yaml
|
|
@@ -104,14 +105,13 @@ npx -y @deepseek-ai/dsh plugin --profile web add . # 从本目录作为 b
|
|
|
104
105
|
|
|
105
106
|
## 工作原理
|
|
106
107
|
|
|
107
|
-
- **服务端**(`src/index.ts`):注册 `ui-tweaks` 设置命名空间,并挂载同源路由 `/_dsh/ui-tweaks/settings`——自 rc.6 起,Web 设置 RPC
|
|
108
|
-
- **Git 后端**(`src/git.ts` + `src/git-web.ts`):通过 `ctx.get('sessions')`(可选服务)解析会话 header 的 `cwd` 作为“当前项目”,用 `child_process.execFile('git', …)`(无 shell、cwd 固定、超时 + 中止传播)执行只读/写操作;同源路由 `/_dsh/ui-tweaks/git/*` 提供 status / branches / diff(hunk 或完整文件,含绝对行号)/
|
|
109
|
-
- **浏览器端**(`src/client/index.tsx`):读写该路由、渲染设置页,并通过运行时 `<style>` 元素实时应用样式,覆盖稳定的 DSH 锚点(`
|
|
110
|
-
-
|
|
111
|
-
- **GitBar**(`src/client/gitbar.tsx`):拆成两个组件,分别挂在 composer 工具行**内部**的 `conversation.input.left`(分支,位于权限控件之后)与 `conversation.input.right`(差异,位于模型选择之前)插槽——输入区不再有独立的一行胶囊。样式与输入框原生控件一致(28px 高、radius 24px、`--dsw-alias-label-secondary` 颜色、hover 用 `--dsw-alias-interactive-bg-hover`)。工具行是 DSH 的 inline-size 容器(`container-type:inline-size`),胶囊用 `@container` 查询做挤压降级:行宽 <700px 隐藏差异的“· K 个文件”元信息,<620px 全部收敛为纯图标,避免与权限 / 模型选择重叠;分支名另加 `text-overflow:ellipsis` 上限。差异面板展开时通过 `#root { margin-right }` 把对话区往左挤,时间线 rail(锚定消息区右缘)因此不被遮挡;面板内的高度分配采用「只给被拖的那一段显式高度、diff 段 `flex:1` 吃掉余量」的方式,配合 45% 上限,拖动永远不会撑破面板。独立 commit 胶囊已移除,提交保留在差异面板底部的提交区。
|
|
108
|
+
- **服务端**(`src/index.ts`):注册 `ui-tweaks` 设置命名空间,并挂载同源路由 `/_dsh/ui-tweaks/settings`——自 rc.6 起,Web 设置 RPC 只暴露固定白名单命名空间,因此自定义路由是插件拥有配置页的方式。
|
|
109
|
+
- **Git 后端**(`src/git.ts` + `src/git-web.ts`):通过 `ctx.get('sessions')`(可选服务)解析会话 header 的 `cwd` 作为“当前项目”,用 `child_process.execFile('git', …)`(无 shell、cwd 固定、超时 + 中止传播)执行只读/写操作;同源路由 `/_dsh/ui-tweaks/git/*` 提供 status / branches / diff(hunk 或完整文件,含绝对行号)/ graph(结构化提交行,含父哈希,供前端排布分支 lane)/ commit / push / pull(仅快进)/ checkout / create / branch-delete / remote-delete。
|
|
110
|
+
- **浏览器端**(`src/client/index.tsx`):读写该路由、渲染设置页,并通过运行时 `<style>` 元素实时应用样式,覆盖稳定的 DSH 锚点(`body` 上的 markdown 代码字体 token、`[data-slot="conversation.chat.node"]` 内的 markdown 表格)。
|
|
111
|
+
- **GitBar**(`src/client/gitbar.tsx`):拆成两个组件,分别挂在 composer 工具行**内部**的 `conversation.input.left`(分支,位于权限控件之后)与 `conversation.input.right`(差异,位于模型选择之前)插槽——输入区不再有独立的一行胶囊。样式与输入框原生控件一致(28px 高、radius 24px、`--dsw-alias-label-secondary` 颜色、hover 用 `--dsw-alias-interactive-bg-hover`)。工具行是 DSH 的 inline-size 容器(`container-type:inline-size`),胶囊用 `@container` 查询做挤压降级:行宽 <700px 隐藏差异的“· K 个文件”元信息,<620px 全部收敛为纯图标,避免与权限 / 模型选择重叠;分支名另加 `text-overflow:ellipsis` 上限。差异面板展开时通过 `#root { margin-right }` 把对话区往左挤,面板不会与消息列重叠;面板内的高度分配采用「只给被拖的那一段显式高度、diff 段 `flex:1` 吃掉余量」的方式,配合 45% 上限,拖动永远不会撑破面板。独立 commit 胶囊已移除,提交保留在差异面板底部的提交区。提交图谱对话框的 lane 布局与 SVG 渲染拆在 `src/client/graphlayout.ts`(纯函数模块:父哈希 → 每行 lane / 边段,经典 first-parent 路由——第一父提交沿用原 lane 让线性历史始终一条线,合并与 fork 画贝塞尔弧线;`parents` 字段可选,兼容宿主里尚未重载的旧服务端)。
|
|
112
112
|
- **归档管理**(服务端 `src/archive.ts` + 浏览器端 `src/client/archive.tsx`):作为 `settings.section` 插槽(设置面板中的「归档」页面)。列表数据直接来自框架标准 hook `useSessions` + `useWorkspaces`(`archivedSessionIds`),无需额外查询;操作走同源路由 `/_dsh/ui-tweaks/archive`。**恢复**把会话 id 从工作区存储域的 `archivedSessionIds` 全局单例中移除(DSH 只暴露单向 `archiveSession`,无公开的取消归档 API,故直接写活体存储域句柄并同步工作区注册表的内存缓存)。**彻底删除**依次:拒绝正在运行的会话(agent `status === 'running'` 才拒绝,空闲会话先 `cancel` + `whenIdle`)→ 用持久化后端自身的 `findLog` 定位并 `rm` 会话日志目录 → 调用公开的 `WorkspaceEntity.detachSession` 摘除工作区记账 → 从归档集合移除并同步注册表内存缓存与 header 索引 → 清理 `session_projcache` → 从内存 SessionStore 摘除该会话(触发 `host/session-removed` 实时消失)。
|
|
113
113
|
- **MCP 管理**(服务端 `src/mcp.ts` + 浏览器端 `src/client/mcp.tsx`):同源路由 `/_dsh/ui-tweaks/mcp`。**列表**枚举 `ctx.loader.entries()` 中 `@deepseek-ai/dsh-mcp-client` 实例(id / config / fiber 状态:active=2、failed=3 等)并按 `mcp__<serverName>__` 前缀从工具注册表统计工具。**重启**调用 `entry.fiber.restart()`(仅运行时)。**添加 / 编辑 / 删除 / 启用停用**通过 `yaml`(eemeli)的 Document API 直接编辑 profile 的 `cordis.patch.yml`(保留注释与未知补丁结构,原子写 tmp+rename),随后由 DSH 内置的 `watchUserPatches` 热重载监视器重新应用补丁——`cordis-plugin-include` 对根组做**增量** `root.update`,因此只有被改动的 MCP 实例会重启,其它不受影响;环境变量值返回给同源浏览器(本机配置编辑需要),YAML 模式在服务端用 `yaml.parse` + 白名单校验。
|
|
114
|
-
- **鲸鱼指示器**(`src/client/whale.tsx`):挂在 `conversation.input.dock`(输入框卡片上方的整行插槽)。dock 行本身比卡片宽(卡片被 InputBar root 以 `--dsh-composer-card-max-width` 封顶居中、两侧留 `--dsh-composer-side-clearance`),因此鲸鱼行**复刻卡片的几何**——同 max-width、同样居中、同样侧留白——再右对齐 + 6px `translateY`,鲸鱼恰好「骑」在卡片右上角(Claude Desktop
|
|
114
|
+
- **鲸鱼指示器**(`src/client/whale.tsx`):挂在 `conversation.input.dock`(输入框卡片上方的整行插槽)。dock 行本身比卡片宽(卡片被 InputBar root 以 `--dsh-composer-card-max-width` 封顶居中、两侧留 `--dsh-composer-side-clearance`),因此鲸鱼行**复刻卡片的几何**——同 max-width、同样居中、同样侧留白——再右对齐 + 6px `translateY`,鲸鱼恰好「骑」在卡片右上角(Claude Desktop 小螃蟹位置)。开关走与 /init 相同的「按需注册」编排——`whaleIndicatorEnabled` 打开时才注册插槽与样式,关闭即卸载。工作状态 = 会话列表 feed 中当前会话的 `running`(`useSyncExternalStore` 直订)∪ 输入机 `phase` 的 claimed/submitting;鲸鱼 SVG 路径内置为常量,挂载时以 `[class*="brandMark"]` 从侧边栏实时徽标尝试刷新(class 前缀是构建哈希,按后缀匹配以抗版本变化),取不到则回退内置几何。
|
|
115
115
|
- **任务提醒**(`src/client/notifier.ts`):纯逻辑模块(无 React),在 `ctx.effect` 中直订 `ctx.sessions.list` 快照流(鲸鱼同款数据源),对全部非空、非子代理会话做前后对比:`running` true→false 且无挂起交互 → 完成事件;`pendingInteraction`('approval' / 'plan-review' / 'question',即侧边栏黄点分类)出现 → 交互事件;后台会话的宿主 `completed` 绿点升沿同样计为完成。结束原因来自服务端 [`dshTurnOutcome` 投影](D:/dsh-project/dsh-ui-tweaks/src/turn-outcome.ts)(last-wins fold 会话日志的 `turn/end.reason`)并随列表行 `projectionValues` 下发——completed/max-tokens 按「任务完成」、aborted/interrupted 按「任务已中断」、error 按「请求失败」(附截断错误消息)播报;投影缺失或未随本次跳变更新时退回普通完成播报。三通道各自静默降级——标题闪烁用 `setInterval` 交替写 `document.title`,`focus`/`visibilitychange` 时恢复;系统通知带 `tag` 去重、`onclick` 里 `window.focus()` + `sessionsService.open(id)` 直达会话、`silent` 跟随提示音开关避免双重响铃;提示音由 WebAudio 振荡器现场合成双音包络。防打扰:首帧只武装基线、只在跳变沿触发、同会话同类 2s 冷却;「仅页面不可见时」等开关经 `readState` 每拍重读实时生效,改动无需重装监视器。
|
|
116
116
|
- **缓存命中率两位小数**(`src/client/cachehit.tsx`):挂在 `conversation.composer.dock`(输入框卡片下方承载原生统计条的横条)的**空渲染座位**——组件本身不画任何东西,只通过框架第五标准 hook `useProjection('tokenUsage')` 读取会话的 token 用量投影(未缓存输入 / 缓存读取 / 缓存写入 / 输出四个不相交桶),按 `缓存读取 ÷ (未缓存输入 + 缓存读取 + 缓存写入)` 算出精确占比后 `.toFixed(2)`,再把统计条里匹配「缓存命中 N%」/ "Cache hit N%" 的 span 原地改写为两位小数——布局、截断省略与 tooltip 行为全部保留 DSH 原样。一个 MutationObserver 监听统计条子树,React 重绘统计行时自动重打(写入幂等,改写一次后即收敛);开关关闭或会话切换时恢复原始文本并断开监听。注册编排与鲸鱼一致:`preciseCacheHitEnabled` 打开才挂载,关闭即卸载。
|
|
117
117
|
|
package/cordis.patch.yml
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# dsh-ui-tweaks bundle patch
|
|
2
|
-
#
|
|
3
|
-
# Declared by `dsh.bundle.patch` in package.json: when the plugin is installed
|
|
4
|
-
# through the official CLI —
|
|
5
|
-
#
|
|
6
|
-
# dsh plugin --profile <name> add dsh-ui-tweaks
|
|
7
|
-
#
|
|
8
|
-
# — the command appends `dsh-ui-tweaks` to the profile's bundle stack and this
|
|
9
|
-
# patch mounts the server-side plugin row.
|
|
10
|
-
- insert:
|
|
11
|
-
- id: ui-tweaks
|
|
12
|
-
name: 'dsh-ui-tweaks'
|
|
1
|
+
# dsh-ui-tweaks bundle patch
|
|
2
|
+
#
|
|
3
|
+
# Declared by `dsh.bundle.patch` in package.json: when the plugin is installed
|
|
4
|
+
# through the official CLI —
|
|
5
|
+
#
|
|
6
|
+
# dsh plugin --profile <name> add dsh-ui-tweaks
|
|
7
|
+
#
|
|
8
|
+
# — the command appends `dsh-ui-tweaks` to the profile's bundle stack and this
|
|
9
|
+
# patch mounts the server-side plugin row.
|
|
10
|
+
- insert:
|
|
11
|
+
- id: ui-tweaks
|
|
12
|
+
name: 'dsh-ui-tweaks'
|