dsh-better-display 0.3.10 → 0.3.12
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/CHANGELOG.md +15 -0
- package/README.en.md +4 -4
- package/README.md +4 -4
- package/docs/extension-points.md +36 -0
- package/lib/client.js +2556 -2565
- package/lib/client.js.map +1 -1
- package/lib/types/client/Blocks.js +4 -4
- package/lib/types/client/Blocks.js.map +1 -1
- package/lib/types/client/Reader.d.ts.map +1 -1
- package/lib/types/client/Reader.js +3 -0
- package/lib/types/client/Reader.js.map +1 -1
- package/lib/types/client/composer-seat.d.ts +24 -0
- package/lib/types/client/composer-seat.d.ts.map +1 -0
- package/lib/types/client/composer-seat.js +23 -0
- package/lib/types/client/composer-seat.js.map +1 -0
- package/package.json +2 -2
- package/src/client/Blocks.tsx +5 -5
- package/src/client/Reader.module.css +11 -0
- package/src/client/Reader.tsx +3 -0
- package/src/client/composer-seat.ts +28 -0
- package/tests/reader-composer-seat.test.ts +61 -0
- package/tests/reader-official-users.test.ts +1 -1
- package/tests/reader-theme-overlap.test.ts +1 -1
- package/tests/reasoning-block-key.test.ts +129 -0
- package/tsdown.config.ts +12 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.12 — 2026-11-03
|
|
4
|
+
|
|
5
|
+
- Bump KaTeX from 0.16.47 to 0.19.1 (`^0.19.1`, lockfile 0.19.1). Reader still renders with the host's KaTeX CSS and does not vendor private fonts (#78).
|
|
6
|
+
- Bump the jscpd duplicate check to 5.4.2 (package range `^5.4.1`, lockfile 5.4.2) (#81).
|
|
7
|
+
|
|
8
|
+
## 0.3.11 — 2026-11-03
|
|
9
|
+
|
|
10
|
+
- Keep the host composer visible on the reading tab when `dsh-claude-style` hides `[data-composer-seat]` off the first conversation tab. The override applies only while the reader root is mounted, so other tabs keep the skin's hide rule (#83).
|
|
11
|
+
- Stamp each reasoning block with `data-reader-reasoning-block-key` so another plugin can target one card. The key stays put across source growth, translation, the original-text fallback, and settling (#82).
|
|
12
|
+
- Docs: add a worked adapter that shows the official COT translation in the reading view through the text-transform seam ([`docs/extension-points.md`](docs/extension-points.md), [`examples/cot-translation-reader/`](examples/cot-translation-reader/)). The official bundle registers its translation on `conversation.chat.reasoning.body`, which the reading view replaces, so that bundle alone cannot paint there (#75).
|
|
13
|
+
|
|
14
|
+
## 0.3.10 — 2026-11-03
|
|
15
|
+
|
|
16
|
+
- Accept DeepSeek Harness 0.2.1-rc.5 (`dsh-v0.2.1-rc.5`, `b830ec950faba0a46dda564be3e2d854afed94f1`). The peer range and `engines.dsh` are `>=0.2.1-rc.1 <0.2.2`. This is the latest tagged release; later main commits are not tagged and are not published to npm.
|
|
17
|
+
|
|
3
18
|
## 0.3.9 — 2026-10-27
|
|
4
19
|
|
|
5
20
|
- Keep assistant narration visible. Collapsing process hides reasoning, tool calls and process records, and a compact seam between body blocks summarises the folded run (`思考×N · 工具×K · 记录×M`) and expands those rows in place. During a live turn, a later reasoning step folds each earlier reasoning/tool run in its own position, including across narration, without counting narration as `输出×N`. Thanks @Adamaik (#68).
|
package/README.en.md
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
Open **Settings → Plugins → Add plugin** and enter this in “Package name or address”:
|
|
10
10
|
|
|
11
11
|
```text
|
|
12
|
-
github:aa2246740/dsh-better-display#v0.3.
|
|
12
|
+
github:aa2246740/dsh-better-display#v0.3.12
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
The desktop plugin manager owns the Desktop profile and its bundled package manager. This
|
|
15
|
+
The desktop plugin manager owns the Desktop profile and its bundled package manager. `v0.3.12` is the latest tagged install target whose manifest accepts Harness `0.2.1-rc.5`. This tag includes built `lib/`; normal use needs no clone, build, or DSHX installation. Follow the app if it asks you to reload or reopen after installation.
|
|
16
16
|
|
|
17
17
|
### Web CLI
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
dsh plugin --profile web add github:aa2246740/dsh-better-display#v0.3.
|
|
20
|
+
dsh plugin --profile web add github:aa2246740/dsh-better-display#v0.3.12
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
This official CLI command writes only the `web` profile; it cannot modify the Desktop App profile. **pnpm** must be on PATH. For an already-running Web Host, reopen that Host once and reload the page because bundles are read at boot.
|
|
@@ -36,7 +36,7 @@ From a local checkout or tarball (development/local testing):
|
|
|
36
36
|
|
|
37
37
|
```sh
|
|
38
38
|
dsh plugin --profile web add ./dsh-better-display
|
|
39
|
-
dsh plugin --profile web add ./dsh-better-display-0.3.
|
|
39
|
+
dsh plugin --profile web add ./dsh-better-display-0.3.12.tgz
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
`dsh.bundle` is captured at Host boot. Do not also insert the same row by hand in the profile `cordis.patch.yml`, or it will mount twice.
|
package/README.md
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
打开 **设置 → 插件 → 添加插件**,在“包名或地址”中输入:
|
|
10
10
|
|
|
11
11
|
```text
|
|
12
|
-
github:aa2246740/dsh-better-display#v0.3.
|
|
12
|
+
github:aa2246740/dsh-better-display#v0.3.12
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
桌面端的插件管理器负责 Desktop profile
|
|
15
|
+
桌面端的插件管理器负责 Desktop profile 和其内置包管理器。`v0.3.12` 是目前已打 tag、且 `engines.dsh` 接受 Harness `0.2.1-rc.5` 的安装目标。本 tag 已包含编译好的 `lib/`;普通使用不需要 clone、构建或安装 DSHX。若应用在安装完成后提示刷新或重新打开,请按提示完成。
|
|
16
16
|
|
|
17
17
|
### Web CLI
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
dsh plugin --profile web add github:aa2246740/dsh-better-display#v0.3.
|
|
20
|
+
dsh plugin --profile web add github:aa2246740/dsh-better-display#v0.3.12
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
这条官方 CLI 命令只写入 `web` profile,不能修改 Desktop App 的 profile。本机 PATH 上需要有 **pnpm**。对于已经运行的 Web Host,请重新打开该 Host 一次,再刷新网页;插件 bundle 会在启动时读取。
|
|
@@ -36,7 +36,7 @@ dsh plugin --profile web add github:aa2246740/dsh-better-display#v0.3.6
|
|
|
36
36
|
|
|
37
37
|
```sh
|
|
38
38
|
dsh plugin --profile web add ./dsh-better-display
|
|
39
|
-
dsh plugin --profile web add ./dsh-better-display-0.3.
|
|
39
|
+
dsh plugin --profile web add ./dsh-better-display-0.3.12.tgz
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
`dsh.bundle` 是开机捕获的。不要再往 profile 的 `cordis.patch.yml` 手写同一条 insert,会重复挂载。
|
package/docs/extension-points.md
CHANGED
|
@@ -60,6 +60,14 @@ import { TEXT_TRANSFORM_SERVICE } from 'dsh-better-display/client';
|
|
|
60
60
|
|
|
61
61
|
`createTextTransformRegistry()` builds a private registry for a unit test. A plugin that wants the reader to paint its text must register on the service the reader provides, not on a registry it constructed itself.
|
|
62
62
|
|
|
63
|
+
### Reasoning DOM marker
|
|
64
|
+
|
|
65
|
+
The reader fallback's reasoning text root (`[data-reader-text-kind="reasoning"]`) exposes `data-reader-reasoning-block-key`. Its value is the same opaque `blockKey` sent in that block's reasoning `DisplayTextRequest`. The marker is present with or without a reasoning transformer, including when a transformer returns `undefined` to keep the original text. It stays stable while that block remains mounted, including streaming growth and display-text changes; do not parse it or persist it as a session identifier.
|
|
66
|
+
|
|
67
|
+
A `ReasoningCard` can group multiple reasoning blocks. For a per-card original/translated toggle, collect **all descendant** `[data-reader-reasoning-block-key]` values and apply the display override to those exact keys through the text-transform registry. Do not assume one key per card, infer ownership from card/block order, or match original or translated text: distinct blocks may have identical text. Treat the values as opaque identifiers, not CSS selector fragments.
|
|
68
|
+
|
|
69
|
+
This marker only associates the existing reasoning display roots with transform requests. It does not change text, rendering identity, source blocks, transcript records, or the native conversation view. A foreign block-chain renderer replaces the fallback and is not guaranteed to provide this marker.
|
|
70
|
+
|
|
63
71
|
### Minimal translation-shaped plugin
|
|
64
72
|
|
|
65
73
|
This one only uppercases. A real translator keeps the same `read` / `subscribe` shape, stores each batch on `blockKey`, and returns a string that extends the previous display string when it wants the fade to continue. It leaves `source === 'tool'` alone unless tool prose should change too.
|
|
@@ -144,6 +152,34 @@ function publish(blockKey: string, text: string, final: boolean) {
|
|
|
144
152
|
|
|
145
153
|
`publish` after each batch. Extend the previous cached string when the fade should continue.
|
|
146
154
|
|
|
155
|
+
### 接官方思考翻译(`cotTranslation`)
|
|
156
|
+
|
|
157
|
+
官方「思考过程机器翻译」组合包(`@deepseek-ai/dsh-experimental-cot-translation-bundle`)把译文注册在 `conversation.chat.reasoning.body` 插槽上,而阅读页用自己的卡片渲染思考,那个插槽不会渲染——装了翻译包,在阅读页看起来像没翻译。用这条缝接它:
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
const cot = ctx.get('cotTranslation') as {
|
|
161
|
+
limits(signal: AbortSignal): Promise<{
|
|
162
|
+
maxTextChars: number;
|
|
163
|
+
preferences: { provider: string; targetLanguage: string };
|
|
164
|
+
}>;
|
|
165
|
+
translate(
|
|
166
|
+
request: { text: string; targetLanguage: string; provider?: string },
|
|
167
|
+
signal: AbortSignal,
|
|
168
|
+
): Promise<string>;
|
|
169
|
+
} | undefined;
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
先调 `limits()` 拿目标语言与单次上限(这一步不发送文本),再按 `maxTextChars` 切出**已完成**段落逐段 `translate()`。四个容易踩的点:
|
|
173
|
+
|
|
174
|
+
- `read` 必须同步:返回缓存或 `undefined`(保留原文),把请求排进 `queueMicrotask`,完成后用 `subscribe` 通知重绘;
|
|
175
|
+
- 流式中的末段不发,否则会把半句话送去翻译;
|
|
176
|
+
- 结果按 `blockKey` 缓存,源文本变长时只请求新增段落;
|
|
177
|
+
- 失败返回 `undefined`,阅读页保留原文;不要抛错,也不要写回 block。
|
|
178
|
+
|
|
179
|
+
组合包没挂载时 `ctx.get('cotTranslation')` 返回 `undefined`,此时直接返回 `undefined` 即可,界面与未安装插件完全一致。
|
|
180
|
+
|
|
181
|
+
完整可运行版本(分片、缓存、失败回退、卸载中止)见 [`examples/cot-translation-reader/`](../examples/cot-translation-reader/)。
|
|
182
|
+
|
|
147
183
|
## `dsh-better-display.block`
|
|
148
184
|
|
|
149
185
|
Chain slot, `scope: 'session'`. The reader calls `renderSlotChain` once per block. The first selector that returns non-null draws the block. All-null renders the reader fallback, which is the path that keeps reveal, follow-scroll, and fold.
|