dsh-enhance 0.0.0-stage → 0.1.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/README.md +128 -2
- package/cordis.patch.yml +9 -0
- package/lib/client.js +3431 -0
- package/lib/index.js +12 -0
- package/package.json +56 -4
package/README.md
CHANGED
|
@@ -1,3 +1,129 @@
|
|
|
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
|
+
- **侧栏更窄** — 侧栏可拖到 214px(上游限制 264px),文字相应缩小一档。
|
|
16
|
+
|
|
17
|
+
## 安装
|
|
18
|
+
|
|
19
|
+
### 方式一:应用内安装(推荐)
|
|
20
|
+
|
|
21
|
+
DSH 打开 **Plugins** 页面 → 添加插件 → 输入 `dsh-enhance` → 安装后重启应用。
|
|
22
|
+
|
|
23
|
+
### 方式二:本地 tar 包
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 从 Releases 下载 dsh-enhance-0.1.0.tgz 后
|
|
27
|
+
cd ~/.dsh/profiles/desktop
|
|
28
|
+
npx pnpm@11.28.5 add "file:/绝对路径/dsh-enhance-0.1.0.tgz"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
再编辑 `~/.dsh/profiles/desktop/package.json`,把 `dsh-enhance` 加入 `dsh.profile.bundles`:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"dsh": {
|
|
36
|
+
"profile": {
|
|
37
|
+
"bundles": [
|
|
38
|
+
"@deepseek-ai/dsh-base",
|
|
39
|
+
"@deepseek-ai/dsh-web-app",
|
|
40
|
+
"dsh-enhance"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
重启应用生效。
|
|
48
|
+
|
|
49
|
+
### 方式三:Git 仓库
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cd ~/.dsh/profiles/desktop
|
|
53
|
+
npx pnpm@11.28.5 add "github:<用户名>/dsh-enhance"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
同样需加入 `bundles` 后重启。
|
|
57
|
+
|
|
58
|
+
## 兼容性
|
|
59
|
+
|
|
60
|
+
| 项目 | 要求 |
|
|
61
|
+
|---|---|
|
|
62
|
+
| DSH 版本 | `>=0.2.1-rc.1 <0.3.0`(见 `package.json` 的 `engines.dsh`) |
|
|
63
|
+
| 平台 | macOS(其他平台未验证) |
|
|
64
|
+
| 运行时依赖 | 无。只值导入 `react` / `react-dom`,其余均为类型导入 |
|
|
65
|
+
|
|
66
|
+
DSH 大版本升级后,插件依赖的插槽与 DOM 契约可能变化,需要跟随适配。
|
|
67
|
+
|
|
68
|
+
## 卸载
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
cd ~/.dsh/profiles/desktop
|
|
72
|
+
npx pnpm@11.28.5 remove dsh-enhance
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
再从 `dsh.profile.bundles` 移除 `dsh-enhance`,重启应用。
|
|
76
|
+
|
|
77
|
+
## 已知限制
|
|
78
|
+
|
|
79
|
+
- 批注保存在浏览器内存,不落盘,**刷新页面后清空**。
|
|
80
|
+
- 批注按会话隔离,切换会话不会串。
|
|
81
|
+
- 划词手势只在主对话生效;侧边对话通过「侧栏提问」接收批注。
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 开发
|
|
86
|
+
|
|
87
|
+
### 结构
|
|
88
|
+
|
|
89
|
+
| 文件 | 作用 |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `src/index.ts` | Node 侧入口(声明 bundle 归属) |
|
|
92
|
+
| `src/client/index.tsx` | 客户端 `apply(ctx)`:注册插槽、注入样式、侧栏宽度接管 |
|
|
93
|
+
| `src/client/SelectionToolbar.tsx` | 划词浮动面板 |
|
|
94
|
+
| `src/client/AnnotationSeat.tsx` | 输入框上的批注座位:胶囊、图钉、标记 |
|
|
95
|
+
| `src/client/AnnotationTray.tsx` | 胶囊列表与编辑弹窗 |
|
|
96
|
+
| `src/client/annotations.ts` | 批注存储(会话维度) |
|
|
97
|
+
| `src/client/anchors.ts` | 在转录区重新定位段落、绘制高亮与图钉 |
|
|
98
|
+
| `src/client/sidebar-floor.ts` | 侧栏拖拽下限(264 → 214) |
|
|
99
|
+
| `src/client/side-chat.ts` | 侧栏对话资源与标签页 |
|
|
100
|
+
| `src/client/styles/` | 各样式表(每个文件导出一个 `String.raw` 模板) |
|
|
101
|
+
| `lib/` | 构建产物,即 `npm pack` 打包内容 |
|
|
102
|
+
|
|
103
|
+
### 构建与测试
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# 用 DSH 源码 checkout 里的 tsdown
|
|
107
|
+
./node_modules/.bin/tsdown --config plugins/dsh-enhance/tsdown.config.mjs
|
|
108
|
+
|
|
109
|
+
# 测试
|
|
110
|
+
./node_modules/.bin/vitest run plugins/dsh-enhance/tests
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 发布
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
cd plugins/dsh-enhance
|
|
117
|
+
npm version patch # 或 minor / major
|
|
118
|
+
# 先构建出 lib/
|
|
119
|
+
npm pack # 产出 dsh-enhance-x.y.z.tgz
|
|
120
|
+
npm publish # 发布到 npm
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`files` 字段限定打包内容,`lib/` 虽被 `.gitignore` 忽略,但会正常打进 tar 包。
|
|
124
|
+
|
|
125
|
+
### 注意事项
|
|
126
|
+
|
|
127
|
+
- 浏览器侧必须是 `window.__ModuleLoader__.load({ id, factory })` 形式,由 `tsdown.config.mjs` 的 banner 包装。
|
|
128
|
+
- 值导入仅限基线模块表(`react`、`react-dom`、`zod`、`@deepseek-ai/cordis` 等),其余服务必须通过 `ctx` 获取。
|
|
129
|
+
- 样式表是单个 `String.raw` 模板字面量,文件内**只能有首尾两个反引号**,注释里也不能出现反引号。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# dsh-enhance bundle patch
|
|
2
|
+
#
|
|
3
|
+
# The plugin's one row. The installer links this package into the desktop
|
|
4
|
+
# profile and lists it under `dsh.profile.bundles`, so this insert is what
|
|
5
|
+
# mounts the client half; the browser bundle itself is served by the host's
|
|
6
|
+
# client module system from the package's `./client` export.
|
|
7
|
+
- insert:
|
|
8
|
+
- id: dsh-enhance
|
|
9
|
+
name: 'dsh-enhance'
|