dsh-cot-peek 0.0.0-stage → 0.2.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 +115 -2
- package/client.js +1116 -0
- package/cordis.patch.yml +3 -0
- package/icon.svg +9 -0
- package/index.js +8 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/market.json +65 -0
- package/package.json +66 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-cot-peek 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.md
CHANGED
|
@@ -1,3 +1,116 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-cot-peek · 思考小窗
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
在 DSH Web 界面里悬浮一个置顶小窗,实时显示当前会话的思考过程(reasoning),
|
|
4
|
+
可收起,并可自动机翻成中文。
|
|
5
|
+
|
|
6
|
+
**位置**:`shell.overlay` 顶层浮层,`position: fixed`,**可拖动**(按住标题栏)+
|
|
7
|
+
**可调大小**(拖右下角),位置和尺寸存在 localStorage,并且始终限制在视口内
|
|
8
|
+
(最小 320×140,最大 960×800)。收起后变成一条小胶囊。
|
|
9
|
+
数据来自 `conversation.input.dock` 里的隐藏数据座(那里才有当前 Session 的 Chat 快照)。
|
|
10
|
+
|
|
11
|
+
## 它做什么
|
|
12
|
+
|
|
13
|
+
- 从 Chat 快照里直接读当前正在流式输出的 reasoning(不额外请求、不跑二次流)
|
|
14
|
+
- **手动翻译**:标题栏一个「翻译」按钮,点一下才把当前思考整段翻成中文;不点就一个请求都不发
|
|
15
|
+
- 英文思考 → 中文译文:代码块、行内代码、URL、文件名、术语先打成占位符,翻完原样还原
|
|
16
|
+
- 相同片段缓存,多句串行翻译(不冲垮免费翻译接口)
|
|
17
|
+
- 翻译失败自动退回原文,标题栏给出状态
|
|
18
|
+
- 思考还在继续时按钮会变成「再译」,提醒您译文已经落后一截
|
|
19
|
+
- 可收起:收起后只留一行标题 + 最新一句摘要;状态记在 localStorage
|
|
20
|
+
- 可切换「译文 / 原文」
|
|
21
|
+
- 翻译服务不可用时,鼠标悬停标题栏的「翻译未启用」会显示具体卡在哪一步
|
|
22
|
+
(服务未挂载 / 插件未启用 / 设置不可用 / 服务报错)
|
|
23
|
+
|
|
24
|
+
## 为什么是手动按钮
|
|
25
|
+
|
|
26
|
+
自动翻译会在思考流式输出时不停地切句、发请求,一是烧额度,二是免费接口容易被限流,
|
|
27
|
+
三是翻了半句话体验反而更差。手动模式:**您想看的才翻**,一次翻整段,缓存复用。
|
|
28
|
+
|
|
29
|
+
## 翻译管线(为什么快、为什么不会硬翻术语)
|
|
30
|
+
|
|
31
|
+
1. **省**
|
|
32
|
+
- 手动触发:不点按钮不发请求;一次翻整段,未写完的尾巴也一起送(您点了就是想看)
|
|
33
|
+
- 缓存:同一句只翻一次(思考里重复很多)
|
|
34
|
+
- 串行 + 合句:短句合并到 ≥28 字符再发,减少请求数
|
|
35
|
+
2. **准**
|
|
36
|
+
- 送整句、不送碎片;合句后语义完整
|
|
37
|
+
3. **不硬翻专业术语**
|
|
38
|
+
- 发出前先用**占位符**把代码块、行内代码、URL、文件名、术语表里的词
|
|
39
|
+
替换成 `⟦1⟧` 这类标记,翻译引擎看不到它们,翻完再原样还原
|
|
40
|
+
- 术语表在 `client.js` 的 `KEEP_TERMS`,默认保留英文:
|
|
41
|
+
DSH / MCP / LLM / API / SDK / JSON / Session / Token / Prompt / Context /
|
|
42
|
+
Slot / Plugin / Bundle / Agent / Tool / Stream / Markdown …
|
|
43
|
+
|
|
44
|
+
想加词:往 `KEEP_TERMS` 里加一条即可。
|
|
45
|
+
|
|
46
|
+
## 依赖
|
|
47
|
+
|
|
48
|
+
中文译文依赖官方实验包:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
@deepseek-ai/dsh-experimental-cot-translation-bundle
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
它提供 Host 侧的 `translator` 服务和 Client 侧的 `ctx.remote.cotTranslation`。
|
|
55
|
+
不装也能用,只是小窗显示英文原文,标题栏标「翻译未启用」(悬停或点按钮能看到具体原因)。
|
|
56
|
+
|
|
57
|
+
本插件的 `package.json` 里 `dsh.client.inject` **必须**声明 `@deepseek-ai/dsh-api-remotes`
|
|
58
|
+
——那是提供 `remote` 服务的客户端包;不声明的话 `ctx.get('remote')` 永远是 `undefined`,
|
|
59
|
+
表现就是「翻译未启用」。另外客户端 `inject` 数组里要有 `remote`(与官方翻译插件一致),
|
|
60
|
+
读取嵌套命名空间用 `ctx.get('remote.cotTranslation')`:cordis 的 `ctx.get(name)` 是
|
|
61
|
+
**绕过 inject 要求**直接读服务仓的,这是最稳的一条路;`ctx.inject(['remote.cotTranslation'])`
|
|
62
|
+
作为第二条路兜底等待挂载。
|
|
63
|
+
|
|
64
|
+
翻译服务默认 **Bing**(免费、免登录),可在
|
|
65
|
+
「设置 → 插件 → 思考过程机器翻译」里换成 Google 或 DeepSeek(付费)。
|
|
66
|
+
> 实测:Google 的 `translate.googleapis.com` 在国内网络下连不通,Bing 的
|
|
67
|
+
> `edge.microsoft.com` 是可用的,建议保持默认。
|
|
68
|
+
|
|
69
|
+
## 安装
|
|
70
|
+
|
|
71
|
+
本地目录链接(开发时):
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
dsh plugin --profile desktop add link:<本目录的绝对路径>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
从 npm 安装(发布后):
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
dsh plugin --profile desktop add dsh-cot-peek
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
安装后重启 DSH 生效。
|
|
84
|
+
|
|
85
|
+
从 GitHub 装(SSH,适合国内网络):
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
dsh plugin --profile desktop add "git+ssh://git@github.com/wunainana/dsh-cot-peek.git"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## 发布
|
|
92
|
+
|
|
93
|
+
- 仓库根目录带 `market.json`(插件市场索引格式 1,已用 DSH 自带校验器验证)。
|
|
94
|
+
把下面任一地址加进 DSH「设置 → 插件市场 → 索引源」,就能在「发现」里看到:
|
|
95
|
+
- `https://raw.githubusercontent.com/wunainana/dsh-cot-peek/main/market.json`
|
|
96
|
+
- `https://cdn.jsdelivr.net/gh/wunainana/dsh-cot-peek@main/market.json`(raw 被墙时用)
|
|
97
|
+
- npm:`npm publish`(包名 `dsh-cot-peek` 未被占用)
|
|
98
|
+
|
|
99
|
+
## 文件
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
package.json bundle 清单(dsh.bundle.patch + dsh.client)
|
|
103
|
+
cordis.patch.yml 把 cot-peek 这一行插进 profile
|
|
104
|
+
index.js Host 半身:空实现(功能全在浏览器)
|
|
105
|
+
client.js 全部逻辑:取 reasoning、分句、术语保护、手动翻译、UI
|
|
106
|
+
locale/zh.json 插件管理页里显示的中文标题/描述
|
|
107
|
+
locale/en.json 英文标题/描述
|
|
108
|
+
icon.svg 原创图标
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## 已知限制
|
|
112
|
+
|
|
113
|
+
- 只显示「最后一段 assistant-step」的 reasoning;多 step 连续思考时会以最新 step 为准
|
|
114
|
+
- 手动翻译:翻完之后思考继续长,译文会落后,按钮变成「再译」提醒您
|
|
115
|
+
- 翻译走匿名接口,可能被限流或拒绝;失败时自动显示原文
|
|
116
|
+
- 改完 `client.js` 需要刷新页面(Client 插件重载)
|