@deepseek-ai/dsh-experimental-client-ui-cot-translation 0.0.0-stage → 0.2.1-alpha.2
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.i18n.yaml +37 -0
- package/README.md +89 -2
- package/README.zh.md +90 -0
- package/lib/client.js +4766 -0
- package/lib/index.js +250 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +137 -0
- package/lib/typert.remote-client.d.ts +25 -0
- package/lib/typert.remote-client.js +72 -0
- package/lib/types/client/TranslationBody.d.ts +22 -0
- package/lib/types/client/TranslationSettings.d.ts +20 -0
- package/lib/types/client/index.d.ts +19 -0
- package/lib/types/client/locales.d.ts +50 -0
- package/lib/types/client/mount.d.ts +13 -0
- package/lib/types/client/preferences-form.d.ts +30 -0
- package/lib/types/client/translation.d.ts +58 -0
- package/lib/types/index.d.ts +48 -0
- package/lib/types/preferences.d.ts +6 -0
- package/lib/types/types.d.ts +24 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +103 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
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.i18n.yaml
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
|
2
|
+
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
|
+
# After editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/experimental/client-ui-cot-translation/README.md
|
|
5
|
+
/:
|
|
6
|
+
en: c2a264438157aa27
|
|
7
|
+
zh: b52d9d387759a1b6
|
|
8
|
+
/deepseek-ai-dsh-experimental-client-ui-cot-translation:
|
|
9
|
+
en: f0c620cc1849b0a4
|
|
10
|
+
zh: dce4b301af1d6ef6
|
|
11
|
+
/deepseek-ai-dsh-experimental-client-ui-cot-translation/summary:
|
|
12
|
+
en: 8d78ff49b12e8101
|
|
13
|
+
zh: f04c7111dceef20f
|
|
14
|
+
/deepseek-ai-dsh-experimental-client-ui-cot-translation/table-of-contents:
|
|
15
|
+
en: d152484eb41ac6b4
|
|
16
|
+
zh: ce40cab8e7534137
|
|
17
|
+
/deepseek-ai-dsh-experimental-client-ui-cot-translation/use-this-package:
|
|
18
|
+
en: 94c2a52dd06ffb3d
|
|
19
|
+
zh: 363bf773e5307b93
|
|
20
|
+
/deepseek-ai-dsh-experimental-client-ui-cot-translation/understand-the-implementation:
|
|
21
|
+
en: e38f4caa4efcdeee
|
|
22
|
+
zh: bfd3fe1a78fd2c7f
|
|
23
|
+
/deepseek-ai-dsh-experimental-client-ui-cot-translation/further-exploration:
|
|
24
|
+
en: f4a5c92999a62f37
|
|
25
|
+
zh: e1e69493f11f1368
|
|
26
|
+
/deepseek-ai-dsh-experimental-client-ui-cot-translation/model-experience:
|
|
27
|
+
en: 3abb215d69a83fa6
|
|
28
|
+
zh: 5000ed802a0db760
|
|
29
|
+
/deepseek-ai-dsh-experimental-client-ui-cot-translation/model-experience/kv-cache-effect:
|
|
30
|
+
en: ef2f52503c155a69
|
|
31
|
+
zh: 3d5d50ba6b31414a
|
|
32
|
+
/deepseek-ai-dsh-experimental-client-ui-cot-translation/known-limitations-and-deferred-work:
|
|
33
|
+
en: 280e59a910068659
|
|
34
|
+
zh: 8230bebfd7b18cf6
|
|
35
|
+
/deepseek-ai-dsh-experimental-client-ui-cot-translation/known-limitations-and-deferred-work/dev-note:
|
|
36
|
+
en: 0225ba087c5266f3
|
|
37
|
+
zh: 0400e21a2683a23c
|
package/README.md
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: "Machine-translate expanded reasoning while retaining the original text and saved results."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
# @deepseek-ai/dsh-experimental-client-ui-cot-translation
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
Read expanded model reasoning in another language and switch back to its original text. Choose a translation service and target language from the Plugins panel. Translation sends displayed reasoning to the selected external service, which may include private code or conversation details. Original reasoning remains in the Session and model context.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
18
|
+
- [Further Exploration](#further-exploration)
|
|
19
|
+
- [Model Experience](#model-experience)
|
|
20
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
21
|
+
- [Dev Note](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## Use this package
|
|
27
|
+
|
|
28
|
+
Enable the [reasoning translation bundle](../cot-translation-bundle/README.md) in Plugins, then open a reasoning disclosure. The feature is absent until the bundle is enabled. Its bundle details provide staged Translation service and Target language controls; Save applies both preferences. Bing is the default provider, and `auto` targets the active UI language. An explicit language code such as `zh`, `en`, or `ja` overrides that choice.
|
|
29
|
+
|
|
30
|
+
View original and View translation share one always-visible action in the plugin's toolbar above the translated body. The plugin owns this action and its state; the Think title only controls the disclosure. Both views reuse the same compact Markdown renderer and typography, without changing the reasoning preview or making another request. Completed paragraphs and request-sized prefixes of long streaming paragraphs translate asynchronously; the unfinished tail stays original. A failure retains the original body and provides Retry; View translation remains disabled until the retry starts. Closing the disclosure or disabling the bundle cancels its requests.
|
|
31
|
+
|
|
32
|
+
For custom compositions, mount this plugin alongside the [translator service](../translator/README.md) and the ordinary Web GUI. The plugin's configuration fields are `provider` and `targetLanguage`; the generated [configuration catalog](../../../docs/config-catalog.md) owns their complete schema.
|
|
33
|
+
|
|
34
|
+
-----
|
|
35
|
+
|
|
36
|
+
<a id="understand-the-implementation"></a>
|
|
37
|
+
## Understand the implementation
|
|
38
|
+
|
|
39
|
+
<details>
|
|
40
|
+
<summary>Maintainer details — click to expand</summary>
|
|
41
|
+
|
|
42
|
+
The browser registers a wrapper in Chat's `conversation.chat.reasoning.body` single Slot and renders original or translated text through the official `conversation.chat.reasoning.content` Factory. The wrapper owns its toolbar and view state, and passes its localized Markdown labels to the Factory; the Factory owns typography. The Host exposes cancellation-aware translation Remote methods. The Host supplies accepted provider and language preferences before the browser enables translation. Settings updates and reconnects refresh these preferences and the translator's request limit. A changed limit cancels and splits the expanded text again. One disclosure lifecycle controller serializes completed fragments, caches their translations while mounted, preserves whitespace and Unicode pairs when splitting long paragraphs, and excludes results after cancellation.
|
|
43
|
+
|
|
44
|
+
The browser binds each request to the disclosure's Session. The Host requires the accepted provider and any explicitly configured target language; `auto` uses the browser locale. The authenticated Client supplies source text and Session identity, and the Host does not verify that the source text belongs to that Session. The translator durably stores provider-independent request/result records and reuses completed results after collapse, reload or reopening the Session. The browser cache only optimizes the current display.
|
|
45
|
+
|
|
46
|
+
A saved result needs no activation. On an uncached inactive Session, the Host joins the ordinary Session controller activation and retries translation once through its existing writer. This uses normal preset startup hooks, resume markers, and interrupted-turn repair. Cancellation ends this caller's wait and prevents later translation dispatch; shared activation can still finish for other readers.
|
|
47
|
+
|
|
48
|
+
</details>
|
|
49
|
+
|
|
50
|
+
-----
|
|
51
|
+
|
|
52
|
+
<a id="further-exploration"></a>
|
|
53
|
+
## Further Exploration
|
|
54
|
+
|
|
55
|
+
- [Translator service](../translator/README.md) — providers and network limits.
|
|
56
|
+
- [Chat rendering](../../client/ui-chat/README.md) — reasoning disclosure and display extensions.
|
|
57
|
+
- [Web Client Slots](../../../docs/subsystems/slots.md) — contribution lifetimes.
|
|
58
|
+
|
|
59
|
+
-----
|
|
60
|
+
|
|
61
|
+
<a id="model-experience"></a>
|
|
62
|
+
## Model Experience
|
|
63
|
+
|
|
64
|
+
Indirectly, through optional independent paid Flash requests and normal Session activation on cache misses; the translator owns translation prompts, and the Session's preset owns startup context.
|
|
65
|
+
|
|
66
|
+
#### KV Cache effect
|
|
67
|
+
|
|
68
|
+
Translation records do not replace model input. Normal activation may append context or repair an interrupted turn, with the same cache effects as opening the conversation. The [translator](../translator/README.md#model-experience) owns the independent paid query's token and cache effects.
|
|
69
|
+
|
|
70
|
+
## Known Limitations and Deferred Work
|
|
71
|
+
|
|
72
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
73
|
+
|
|
74
|
+
- Google and Bing anonymous endpoints may reject requests or become unavailable; requests never fall back to another provider.
|
|
75
|
+
- Translation may change Markdown formatting or code examples. Original text remains available.
|
|
76
|
+
- An inactive subagent Session without a saved translation retains the original text and reports a translation failure; ordinary Session activation cannot restore subagent ownership.
|
|
77
|
+
- Collapsed previews remain original. Saved results belong to the Session; future format migrations retain experimental records on a best-effort basis.
|
|
78
|
+
- Provider reachability from mainland China requires network-specific verification.
|
|
79
|
+
|
|
80
|
+
-----
|
|
81
|
+
|
|
82
|
+
<a id="dev-note"></a>
|
|
83
|
+
### Dev Note
|
|
84
|
+
|
|
85
|
+
<details>
|
|
86
|
+
<summary>Maintainer details — click to expand</summary>
|
|
87
|
+
|
|
88
|
+
None.
|
|
89
|
+
|
|
90
|
+
</details>
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "对展开的思考内容进行机器翻译,同时保留原文和已保存结果。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-experimental-client-ui-cot-translation
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
以其他语言阅读展开的模型思考内容,并随时切回原文。在插件面板中选择翻译服务和目标语言。翻译会将显示的思考内容发送给所选外部服务,其中可能包含私有代码或对话细节。Session 和模型上下文保留原始思考内容。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用本包](#use-this-package)
|
|
17
|
+
- [了解实现](#understand-the-implementation)
|
|
18
|
+
- [延伸阅读](#further-exploration)
|
|
19
|
+
- [模型体验](#model-experience)
|
|
20
|
+
- [已知限制与后续工作](#known-limitations-and-deferred-work)
|
|
21
|
+
- [开发备注](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## 使用本包
|
|
27
|
+
|
|
28
|
+
在插件中启用[思考过程翻译组合包](../cot-translation-bundle/README.zh.md),然后展开思考内容。启用组合包之前,此功能不会出现。组合包详情页提供暂存的翻译服务和目标语言设置;保存后两项选择一起生效。默认翻译服务为 Bing,`auto` 跟随当前界面语言。填写 `zh`、`en` 或 `ja` 等语言代码可指定目标语言。
|
|
29
|
+
|
|
30
|
+
“查看原文”和“查看译文”复用译文正文上方插件工具栏内的一个常显入口。插件自行维护此操作及其状态,思考标题只控制展开与折叠。两种视图复用同一个紧凑 Markdown 组件和排版,不改变思考预览,也不重复发送请求。完整段落和流式长段落中达到请求长度的前缀异步翻译,未完成的末尾片段保留原文。失败时保留原始正文,并提供重试;开始重试前,“查看译文”保持禁用。关闭思考内容或停用组合包会取消对应请求。
|
|
31
|
+
|
|
32
|
+
自定义组合可将本插件与[翻译服务](../translator/README.zh.md)和普通 Web GUI 一起挂载。本插件的配置字段是 `provider` 和 `targetLanguage`;完整定义见生成的[配置目录](../../../docs/config-catalog.zh.md)。
|
|
33
|
+
|
|
34
|
+
-----
|
|
35
|
+
|
|
36
|
+
<a id="understand-the-implementation"></a>
|
|
37
|
+
## 了解实现
|
|
38
|
+
|
|
39
|
+
<details>
|
|
40
|
+
<summary>维护者细节 — 点击展开</summary>
|
|
41
|
+
|
|
42
|
+
浏览器向 Chat 的 `conversation.chat.reasoning.body` single Slot 注册包装组件,通过官方 `conversation.chat.reasoning.content` Factory 渲染原文或译文。包装组件自行维护工具栏与视图状态,将自己的本地化 Markdown labels 传入 Factory;Factory 负责排版。Host 暴露可取消的翻译 Remote 方法。Host 在浏览器启用翻译前提供已接受的翻译服务和语言偏好。设置更新及重新连接会刷新这些偏好和 translator 的请求长度限制。限制变化时,展开内容的请求被取消并重新分片。每个展开区域的生命周期控制器串行处理完整片段,在挂载期间缓存译文,在拆分长段落时保留空白和 Unicode 代理对,并忽略取消后的结果。
|
|
43
|
+
|
|
44
|
+
浏览器将每个请求绑定到展开区域的 Session。Host 要求请求使用已接受的提供方以及配置中显式指定的目标语言;`auto` 使用浏览器区域语言。已认证的 Client 提供原文与 Session 身份,Host 不校验原文是否属于该 Session。translator 持久化与 Provider 无关的请求/结果记录,在折叠、重载或重新打开 Session 后复用已完成结果。浏览器缓存只优化当前展示。
|
|
45
|
+
|
|
46
|
+
已保存结果无需激活 Session。未激活 Session 缓存未命中时,Host 等待普通 Session controller 的激活流程,再通过现有写入器重试一次翻译。此过程使用正常的 preset 启动钩子、恢复标记和中断轮次修复。取消会结束当前调用者的等待,并阻止随后派发翻译;共享激活仍可为其他读者继续完成。
|
|
47
|
+
|
|
48
|
+
</details>
|
|
49
|
+
|
|
50
|
+
-----
|
|
51
|
+
|
|
52
|
+
<a id="further-exploration"></a>
|
|
53
|
+
## 延伸阅读
|
|
54
|
+
|
|
55
|
+
- [翻译服务](../translator/README.zh.md) — 服务接口和网络限制。
|
|
56
|
+
- [Chat 渲染](../../client/ui-chat/README.zh.md) — 思考内容展开和显示扩展。
|
|
57
|
+
- [Web Client Slots](../../../docs/subsystems/slots.zh.md) — 渲染贡献的生命周期。
|
|
58
|
+
|
|
59
|
+
-----
|
|
60
|
+
|
|
61
|
+
<a id="model-experience"></a>
|
|
62
|
+
## 模型体验
|
|
63
|
+
|
|
64
|
+
间接影响来自可选的独立付费 Flash 请求,以及缓存未命中时的正常 Session 激活;translator 负责翻译提示词,Session 的 preset 负责启动上下文。
|
|
65
|
+
|
|
66
|
+
#### KV Cache 效果
|
|
67
|
+
|
|
68
|
+
翻译记录不替换模型输入。正常激活可能追加上下文或修复中断轮次,其缓存影响与打开对话相同。独立付费查询的 token 和缓存影响由 [translator](../translator/README.zh.md#model-experience) 负责。
|
|
69
|
+
|
|
70
|
+
## 已知限制与后续工作
|
|
71
|
+
|
|
72
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
73
|
+
|
|
74
|
+
- Google 和 Bing 匿名接口可能拒绝请求或不可用;请求不会回退到其他服务。
|
|
75
|
+
- 翻译可能改变 Markdown 格式或代码示例,原文始终可查看。
|
|
76
|
+
- 未激活的子代理 Session 若没有已保存译文,会保留原文并显示翻译失败;普通 Session 激活无法恢复子代理所有权。
|
|
77
|
+
- 折叠的预览保留原文。已保存结果属于 Session;未来格式迁移以尽力而为的方式保留实验性记录。
|
|
78
|
+
- 中国大陆的服务可达性需要在对应网络中验证。
|
|
79
|
+
|
|
80
|
+
-----
|
|
81
|
+
|
|
82
|
+
<a id="dev-note"></a>
|
|
83
|
+
### 开发备注
|
|
84
|
+
|
|
85
|
+
<details>
|
|
86
|
+
<summary>维护者细节 — 点击展开</summary>
|
|
87
|
+
|
|
88
|
+
无。
|
|
89
|
+
|
|
90
|
+
</details>
|