Introduction¶
When DeepSeek Harness (DSH) displays the reasoning process in a conversation flow, the preview line in the collapsed state only shows English by default. The official cot-translation bundle only translates the expanded body text. The collapsed preview line is rendered directly by ReasoningRow through inline string assembly, with no injectable Slot exposed. As a result, when checking reasoning summaries, we often see a line of English preview and have to expand the full text to read the Chinese. dsh-cot-preview-zh specifically fills this display-layer gap.
Plugin Overview¶
- Name: dsh-cot-preview-zh
- Maintainer: kino516
- Repository: https://github.com/kino516/dsh-cot-preview-zh
- Directory Page: https://www.skillhub.cn/plugins/kino516/dsh-cot-preview-zh
- Category: Client
- Core Value: Intercepts collapsed reasoning preview lines at the display layer, translates them into Chinese via the official Host-side translation service, and also handles whole-line translation of tool collapsed lines.
What It Solves¶
The plugin targets two areas, but handles them differently:
- Collapsed reasoning preview lines — machine translation
The official @deepseek-ai/dsh-experimental-client-ui-cot-translation only translates the “expanded” reasoning body. The collapsed preview line is assembled in-place by dsh-client-ui-chat’s ReasoningRow using firstLine(reasoning) / latestCompletedParagraphFirstLine(reasoning), rendered directly with no Slot exposed, so the official plugin cannot intervene.
- Tool collapsed lines — whole-line machine translation
DSH appends the wire name to the summary for unregistered tools (dsh-client-ui-tool’s tool-call-model.ts: summary = [titleKey === 'tool.title.generic' ? toolName : '', base].join(' · ')). This results in purely English lines like 工具 · ops_bash · ls -la /d/Deepseek.
This plugin sends the entire line for translation, using the same Host pipeline as the reasoning preview:
工具 · ops_bash · ls -la /d/Deepseek → 工具 · 执行命令 · 列出 /d/Deepseek 下的文件
工具 · dsh_browser_screenshot · ... → 工具 · 浏览器·截图 · ...
To avoid translating away “usable information,” three layers of protection are in place:
- The original text is not deleted, only hidden: the original node remains in the DOM, and React can still update it normally.
- The translation’s
titleattribute is the original text: hovering with the mouse reveals the original English abbreviation (full command line). - The expanded line still shows raw JSON: parameters are displayed as-is in the
INblock, ready to be copied at any time.
On translation failure, it falls back to “replacing only the Chinese tool name label” (TOOL_LABELS / BROWSER_LABELS), ensuring the line is no longer purely English. The mapping tables are at the top of client.js, with a fallback for the dsh_browser_* verb family. Unmapped unknown tools are left as-is — no guessing.
This plugin fills in this display layer:
Collapsed reasoning line [data-variant="think"][data-preview]
├─ span[data-shimmer-decoration] ← decorative separator (structural anchor)
└─ span ← preview container
├─ span ← original text node (plugin adds data-cot-preview-zh-hidden to hide it)
└─ span ← translation node inserted by plugin (reuses original class name for consistent layout)
Translation requests go through the official translator’s Host side (ctx.remote.cotTranslation) — the browser cannot connect directly to Bing due to CORS; the Host must make the request.
Core Features¶
- Only processes non-expanded reasoning lines that are actually displaying a preview (
[data-variant="think"][data-preview]). - Tool line whole-line translation also only occurs when in the viewport; concurrent in-flight requests are capped at 3, and streaming lines wait for parameters to stabilize before translating.
- Previews that are already in Chinese are not sent for translation.
- Streaming reasoning waits 700ms for text to stabilize before translating; duplicate requests for the same text are prevented via cache hits or in-flight request deduplication.
- On failure, the English original is retained; the same text segment will not be retried for 5 minutes.
- Translation is triggered only when a line enters the viewport (
IntersectionObserver); no bulk requests are made for the entire history. - On unmount: disconnect observers, cancel timers, and restore all modified previews.
Composition¶
| File | Purpose |
|---|---|
cordis.patch.yml |
Inserts translator, cot-translation (Bing + follow UI language), and this plugin (three lines total) |
index.js |
Host-side half, empty implementation |
client.js |
Client-side half: observe collapsed reasoning lines → extract preview text → request translation → replace display |
translator / cot-translation are packages shipped with dsh, resolved from the installation directory per the official plugin specification, so this package declares no dependencies.
Installation & Activation¶
git clone https://github.com/kino516/dsh-cot-preview-zh.git
Then in DSH: Plugins → Add Plugin → Select this directory (or invoke plugin_manager install_bundle with the absolute directory as the target).
After installation, restart DSH and refresh the window.
Dependencies: @deepseek-ai/dsh-experimental-translator and @deepseek-ai/dsh-experimental-client-ui-cot-translation (bundled with DSH since 0.2.2-rc.5). This plugin inserts both lines along with itself via cordis.patch.yml, so there is no need to separately install the official cot-translation bundle. These two packages ship with dsh and are resolved from the installation directory, hence no dependencies are declared in this package.
Use Cases & Notes¶
- Ideal for developers who need to review collapsed reasoning summaries and want to reduce the number of expansions.
- The plugin runs with the current dsh process privileges. Review the source code and license before installation.
- If a DSH upgrade changes the reasoning line structure (separator node or preview container hierarchy),
queryParts()will need to be updated accordingly.
Closing¶
dsh-cot-preview-zh completes the Chinese translation of collapsed reasoning previews and tool collapsed lines at the display layer, reducing the need to expand and improving the browsing experience. For more details and source code, please visit the plugin directory page and the GitHub repository.