dsh-enhance 0.0.0-stage → 0.3.1
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 -0
- package/README.md +152 -2
- package/cordis.patch.yml +8 -0
- package/lib/client.js +4431 -0
- package/lib/index.js +11 -0
- package/package.json +70 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 laughmaker
|
|
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.md
CHANGED
|
@@ -1,3 +1,153 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-enhance
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
DeepSeek Harness(DSH)增强插件:Markdown 主题统一、划词批注、侧栏更窄、启动默认状态。
|
|
4
|
+
|
|
5
|
+
## 功能
|
|
6
|
+
|
|
7
|
+
- **Markdown 主题** — 统一主对话、侧栏对话、文件预览等所有 `MarkdownText` 渲染的排版:标题配色、加粗、行内代码、代码块、表格、引用块。浅色/深色两套配色自动跟随主题。
|
|
8
|
+
- **划词批注** — 选中文字弹出小面板写一句要求(Enter 确认,Esc 取消;弹窗出现即自动聚焦输入框,光标落在末尾)。确认后汇总为输入框内的 `N annotations` 胶囊:
|
|
9
|
+
- 悬停胶囊展开列表,每行显示要求与引文
|
|
10
|
+
- 悬停行会在正文高亮对应段落,点击行滚动定位到原文
|
|
11
|
+
- 每行右侧可编辑(弹窗)或删除,胶囊右侧一键清空
|
|
12
|
+
- 已批注段落在正文保留带序号的蓝色圆标(图钉与编号合为一个图标),点击圆标直接编辑该批注,并在正文保持该段落的高亮
|
|
13
|
+
- 编辑弹窗内可直接删除该批注
|
|
14
|
+
- 有批注挂起时发送按钮即刻可用,而输入框保持空白;发送瞬间才把引文拼进消息
|
|
15
|
+
- 弹窗输入框无内边距、贴合面板,高度随内容自动增长且不出现滚动条
|
|
16
|
+
- **侧栏提问** — 从同一面板把段落送到右侧栏的侧边对话,不打断当前对话。首次创建,之后复用同一标签页。
|
|
17
|
+
- **侧栏更窄** — 侧栏可拖到 214px(上游限制 264px),文字相应缩小一档;文件夹图标换成展开/收起三角,文件夹标题与会话标题同字号、左端对齐。
|
|
18
|
+
- **面板图标置顶** — Plugins / 自动化等面板图标移到侧栏顶部、工作区列表之上,并排成一行;每行最多 5 个,超出换行。上游是带文字的竖排列表,此前本插件把它放在右下角。只改位置与排版,宿主的选中态、悬停态和那个「更多」菜单都照旧。
|
|
19
|
+
- **插件图标也置顶** — 新装的插件如果把图标注册到侧栏底部(`sidebar.footer.action`,比如「远程访问」的电话图标),它的按钮会被搬进同一行顶部列表,同样按 5 个一行、超出换行。搬的是宿主自己的容器而不是插件的按钮,所以插件自己的选中态、悬停态和弹层都照常工作;折叠成图标轨时交回宿主布局。
|
|
20
|
+
- **启动即最窄** — 首次启动侧栏直接是 214px(上游每次加载都回到 280px),之后按你上次拖到的宽度打开。折叠/展开不会丢掉这个宽度。
|
|
21
|
+
- **窗口铺满屏幕** — 首次启动主窗口铺满可用区域(菜单栏与 Dock 保留,等同绿色按钮的缩放);之后按上次关闭时的窗口位置与大小重新打开。保存的窗口若超出当前显示器(换屏、改分辨率)会被拉回可见区域。
|
|
22
|
+
- **运行中彩色转圈** — 侧栏里正在运行的会话,状态环不再是宿主那样的灰色,而是一圈彩色:蓝→紫→洋红→琥珀的 4 秒色相循环,浅色与深色主题下都清晰。环的转动与虚线段仍由宿主驱动,本插件只改颜色;其他位置的状态点(任务、审批、工作流)保持原样。
|
|
23
|
+
- **Dock 完成角标** — macOS Dock 图标上的红色数字 = 侧栏「绿点未读会话」的数量:某会话跑完而你没在看它(切到别的会话或别的 App)就 +1,点开读一下即 -1,全部读完角标消失。直接映射宿主 `uiSession.sessionStatus.completionUnread`(与侧栏绿点同一数据源),走标准 Badging API(`navigator.setAppBadge`),宿主不支持时静默降级。
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
### 方式一:应用内安装(推荐)
|
|
28
|
+
|
|
29
|
+
DSH 打开 **Plugins** 页面 → 添加插件 → 输入 `dsh-enhance` → 安装后重启应用。
|
|
30
|
+
|
|
31
|
+
### 方式二:本地 tar 包
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# 从 Releases 下载 dsh-enhance-0.3.1.tgz 后
|
|
35
|
+
cd ~/.dsh/profiles/desktop
|
|
36
|
+
npx pnpm@11.28.5 add "file:/绝对路径/dsh-enhance-0.3.1.tgz"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
再编辑 `~/.dsh/profiles/desktop/package.json`,把 `dsh-enhance` 加入 `dsh.profile.bundles`:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"dsh": {
|
|
44
|
+
"profile": {
|
|
45
|
+
"bundles": [
|
|
46
|
+
"@deepseek-ai/dsh-base",
|
|
47
|
+
"@deepseek-ai/dsh-web-app",
|
|
48
|
+
"dsh-enhance"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
重启应用生效。
|
|
56
|
+
|
|
57
|
+
### 方式三:Git 仓库
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cd ~/.dsh/profiles/desktop
|
|
61
|
+
npx pnpm@11.28.5 add "github:<用户名>/dsh-enhance"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
同样需加入 `bundles` 后重启。
|
|
65
|
+
|
|
66
|
+
## 兼容性
|
|
67
|
+
|
|
68
|
+
| 项目 | 要求 |
|
|
69
|
+
|---|---|
|
|
70
|
+
| DSH 版本 | `>=0.2.1-rc.1 <0.3.0`(见 `package.json` 的 `engines.dsh`) |
|
|
71
|
+
| 平台 | macOS(其他平台未验证) |
|
|
72
|
+
| 运行时依赖 | 无。只值导入 `react` / `react-dom`,其余均为类型导入 |
|
|
73
|
+
|
|
74
|
+
DSH 大版本升级后,插件依赖的插槽与 DOM 契约可能变化,需要跟随适配。
|
|
75
|
+
|
|
76
|
+
## 卸载
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
cd ~/.dsh/profiles/desktop
|
|
80
|
+
npx pnpm@11.28.5 remove dsh-enhance
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
再从 `dsh.profile.bundles` 移除 `dsh-enhance`,重启应用。
|
|
84
|
+
|
|
85
|
+
## 已知限制
|
|
86
|
+
|
|
87
|
+
- 批注保存在浏览器内存,不落盘,**刷新页面后清空**。
|
|
88
|
+
- 批注按会话隔离,切换会话不会串。
|
|
89
|
+
- 划词手势只在主对话生效;侧边对话通过「侧栏提问」接收批注。
|
|
90
|
+
- 窗口几何与侧栏宽度存在渲染进程的 `localStorage`(`dsh-enhance.window-geometry.v1`、`dsh-enhance.sidebar-width.v1`),清缓存或换机器后回到默认:铺满 + 214px。
|
|
91
|
+
- 窗口由页面侧调用 `resizeTo`/`moveTo` 驱动,因此是「缩放铺满」而不是系统全屏;全屏仍走绿色按钮或系统菜单。
|
|
92
|
+
- macOS 下渲染进程收不到纯移动(`move`)事件,窗口位置在最后一次改变大小、失焦或页面隐藏时记录;只拖动位置未改大小就立即强退,位置可能停在上一次记录的点。
|
|
93
|
+
- 首次启动只有在没有任何已保存状态时才铺满;想回到默认,清掉上述两个键后重启。
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 开发
|
|
98
|
+
|
|
99
|
+
### 结构
|
|
100
|
+
|
|
101
|
+
| 文件 | 作用 |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `src/index.ts` | Node 侧入口(声明 bundle 归属) |
|
|
104
|
+
| `src/client/index.tsx` | 客户端 `apply(ctx)`:注册插槽、注入样式、侧栏宽度接管 |
|
|
105
|
+
| `src/client/SelectionToolbar.tsx` | 划词浮动面板 |
|
|
106
|
+
| `src/client/AnnotationSeat.tsx` | 输入框上的批注座位:胶囊、图钉、标记 |
|
|
107
|
+
| `src/client/AnnotationTray.tsx` | 胶囊列表与编辑弹窗 |
|
|
108
|
+
| `src/client/annotations.ts` | 批注存储(会话维度) |
|
|
109
|
+
| `src/client/anchors.ts` | 在转录区重新定位段落、绘制高亮与图钉 |
|
|
110
|
+
| `src/client/sidebar-floor.ts` | 侧栏拖拽下限(264 → 214)、启动宽度应用与拖拽落定回调 |
|
|
111
|
+
| `src/client/sidebar-width.ts` | 记住侧栏宽度(首次 214,之后按上次拖到的值) |
|
|
112
|
+
| `src/client/window-geometry.ts` | 窗口几何:首次铺满可用区域,之后恢复上次的窗口位置与大小 |
|
|
113
|
+
| `src/client/turn-badge.ts` | Dock 未读会话角标(映射宿主 completionUnread) |
|
|
114
|
+
| `src/client/side-chat.ts` | 侧栏对话资源与标签页 |
|
|
115
|
+
| `src/client/styles/` | 各样式表(每个文件导出一个 `String.raw` 模板);`running-spinner.ts` 负责侧栏运行中色环 |
|
|
116
|
+
| `lib/` | 构建产物,即 `npm pack` 打包内容 |
|
|
117
|
+
|
|
118
|
+
### 构建与测试
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# 用 DSH 源码 checkout 里的 tsdown
|
|
122
|
+
./node_modules/.bin/tsdown --config plugins/dsh-enhance/tsdown.config.mjs
|
|
123
|
+
|
|
124
|
+
# 测试
|
|
125
|
+
./node_modules/.bin/vitest run plugins/dsh-enhance/tests
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
本机 `tsdown`/`vitest` 依赖的 rolldown 原生绑定存在代码签名问题,可能无法运行(报 `Cannot find module '@rolldown/binding-darwin-universal'` 或 `different Team IDs`)。这种情况下改样式表后可用同步脚本落地,它只替换 `lib/client.js` 中对应 `//#region` 的 `String.raw` 负载,其余字节保持不变:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
node script/sync-style.mjs # 同步全部样式表
|
|
132
|
+
node script/sync-style.mjs toolbar # 只同步某一张
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
脚本会拒绝含反引号或 `${` 的 CSS——样式表被包在 `String.raw` 模板里,这类字符会提前闭合模板并静默截断整张表。
|
|
136
|
+
|
|
137
|
+
### 发布
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
cd plugins/dsh-enhance
|
|
141
|
+
npm version patch # 或 minor / major
|
|
142
|
+
# 先构建出 lib/
|
|
143
|
+
npm pack # 产出 dsh-enhance-x.y.z.tgz
|
|
144
|
+
npm publish # 发布到 npm
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`files` 字段限定打包内容,`lib/` 虽被 `.gitignore` 忽略,但会正常打进 tar 包。
|
|
148
|
+
|
|
149
|
+
### 注意事项
|
|
150
|
+
|
|
151
|
+
- 浏览器侧必须是 `window.__ModuleLoader__.load({ id, factory })` 形式,由 `tsdown.config.mjs` 的 banner 包装。
|
|
152
|
+
- 值导入仅限基线模块表(`react`、`react-dom`、`zod`、`@deepseek-ai/cordis` 等),其余服务必须通过 `ctx` 获取。
|
|
153
|
+
- 样式表是单个 `String.raw` 模板字面量,文件内**只能有首尾两个反引号**,注释里也不能出现反引号。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# dsh-enhance bundle patch
|
|
2
|
+
#
|
|
3
|
+
# The single row this bundle contributes. A profile that lists `dsh-enhance`
|
|
4
|
+
# under `dsh.profile.bundles` mounts that row, and the host's client module
|
|
5
|
+
# system then serves the browser half from the package's `./client` export.
|
|
6
|
+
- insert:
|
|
7
|
+
- id: dsh-enhance
|
|
8
|
+
name: 'dsh-enhance'
|