dsh-smooth-stream 0.4.1 → 0.4.3

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.en.md CHANGED
@@ -1,110 +1,140 @@
1
1
  # dsh-smooth-stream
2
2
 
3
- English | [中文](README.md)
3
+ > **Transform jumpy AI outputs into a calm, teleprompter-smooth reading experience.**
4
+ > Physics-based stream rendering and zero-reflow viewport tracking for the DeepSeek Harness (`dsh`) Web UI.
4
5
 
5
- **dsh-smooth-stream** brings fluid streaming rendering and silky scrolling to the [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh`) Web UI. Text, Markdown, code blocks, tables, and tool results appear as the reply arrives; as the content grows, the page follows along in one continuous visual rhythm.
6
+ English · [中文](README.md) · [Homepage](https://laplace-bit.github.io/dsh-smooth-stream/) · [How It Works](https://laplace-bit.github.io/dsh-smooth-stream/how-it-works.html) · [npm](https://www.npmjs.com/package/dsh-smooth-stream)
6
7
 
7
- Project homepage: <https://laplace-bit.github.io/dsh-smooth-stream/>
8
+ ---
8
9
 
9
- [Install guide](https://laplace-bit.github.io/dsh-smooth-stream/install.html) · [How it works and reproducible benchmark](https://laplace-bit.github.io/dsh-smooth-stream/how-it-works.html)
10
+ ## The Silky Smooth Feel
10
11
 
11
- ## Preview
12
+ Whether reviewing hundreds of lines of complex reasoning or watching fast-paced code generation, `dsh-smooth-stream` delivers a **calm, continuous, and fatigue-free** reading experience:
12
13
 
13
- Left: default Web UI. Right: dsh-smooth-stream.
14
+ - **Organic, fluid text expansion**: No more walls of text abruptly snapping onto your screen. Words glide in with an organic rhythm that feels alive yet unhurried.
15
+ - **Effortless eye tracking**: The viewport glides as if on a precision-damped rail. Line wraps and code blocks no longer jar your eyes, eliminating cognitive friction.
16
+ - **Adaptive cadence**: Leisurely during slow arrivals, smoothly accelerating during high-volume bursts—keeping your screen composed no matter how fast tokens arrive.
14
17
 
15
- ![Left: without the plugin. Right: with dsh-smooth-stream.](docs/compare.gif)
18
+ ---
16
19
 
17
- ## Core experience
20
+ ## Why this exists
18
21
 
19
- - **Fluid rendering.** Text appears as it arrives while Markdown structure stays active, keeping headings, lists, code blocks, and tables readable throughout the stream.
20
- - **Silky scrolling.** As the content grows, the page follows along one continuous scroll path and keeps the reader close to the generated output.
21
- - **Consistent transitions.** Line wraps, code blocks, tables, and tool results use the same motion treatment, so text, reasoning, and tools flow together.
22
- - **Adaptive cadence.** Reveal speed responds to arrival rate and pending content, staying measured for slow output and catching up with fast output.
22
+ Large language models emit tokens in discrete network bursts: hundreds of characters can arrive within milliseconds, followed by tens of milliseconds of silence.
23
23
 
24
- ## Install
24
+ Traditional chat UIs bind DOM rendering and scrolling directly to arrival events, causing two jarring failure modes:
25
+ 1. **Visual snapping**: Text blocks, tables, and code snippets pop in abruptly, forcing the reader's eye to constantly re-acquire focus.
26
+ 2. **Scroll jitter and reflow storms**: Hard `scrollTop = scrollHeight` jumps or interrupted `scroll-behavior: smooth` animations restart their easing curves on every chunk, leading to sluggish lag and severe layout thrashing.
25
27
 
26
- From a DeepSeek Harness source checkout:
28
+ `dsh-smooth-stream` decouples **text reveal cadence** from **viewport motion** into two independent dynamical systems, integrating them per animation frame (`requestAnimationFrame`) to ensure uninterrupted continuity.
27
29
 
28
- ```sh
29
- pnpm dsh plugin --profile web add dsh-smooth-stream
30
- ```
30
+ ---
31
31
 
32
- If `dsh` is already on your `PATH`:
32
+ ## Architecture & Mechanics
33
33
 
34
- ```sh
35
- dsh plugin --profile web add dsh-smooth-stream
34
+ ```
35
+ [ Model SSE Stream ]
36
+ │
37
+ ▼
38
+ ┌─────────────────┐ Backpressure Damping (0.55x ~ 1.0x) ┌─────────────────┐
39
+ │ Reveal Engine │ ◄────────────────────────────────────────────── │ Follow Engine │
40
+ └────────┬────────┘ └────────┬────────┘
41
+ │ Fractional character debt integration │ 2nd-order damped spring (k=130, c=24)
42
+ ▼ ▼
43
+ [ Progressive DOM Reveal ] ────────────────────────────────────────► [ GPU Compositor Transform ]
44
+ (Per-frame visual delta ≤ 8px) (Zero Reflow / Pure Composite)
36
45
  ```
37
46
 
38
- The npm package ships prebuilt `lib/`, so no pnpm ≥10 build-script allowance is needed.
47
+ ### 1. Dynamic Adaptive Reveal Engine
48
+ - **Fractional character debt**: Evaluates reveal velocity from current backlog ($v = 90 + \text{backlog}^{1.25} \times P$). Leisurely when arrival is slow; accelerates smoothly during bursts without ever dumping text walls.
49
+ - **Wrap smoothing**: Caps per-frame visual displacement to $\le 8\text{px}$ during line wraps and new block arrivals, spreading sudden $24\text{--}28\text{px}$ layout steps across several frames.
50
+ - **Uniform completion drain**: When the generation finishes, the residual queue drains at a steady speed, creating clean transitions between body, reasoning, and tool calls.
39
51
 
40
- Start the UI:
52
+ ### 2. GPU-Driven Damped Spring Follower
53
+ - **Second-order spring physics**: Uses a sub-stepped damped spring ($k=130, c=24, m=1$) to convert discrete height changes into a continuous trajectory.
54
+ - **Zero-reflow viewport tracking**: Keeps the real scrollport pinned to the bottom while absorbing residual visual lag entirely via `transform: translate3d` on the message container. No layout-triggering properties are touched during follow.
55
+ - **Closed-loop backpressure**: If visual lag fills the predictive runway ($\approx 72\text{px}$), the follower throttles reveal speed (down to $0.55\times$), ensuring text expansion never outpaces the viewport spring.
56
+ - **Stall resilience & ProMotion parity**: Clamps elapsed physical time ($\Delta t \le 32\text{ms}$) during main-thread stalls to prevent teleporting catches. Settling dynamics are identical across 60Hz and 120Hz (ProMotion) displays.
41
57
 
42
- ```sh
43
- pnpm dsh web
44
- ```
58
+ ### 3. Turn Lifecycle Auto-Collapse
59
+ - Reasoning and tool executions remain expanded while streaming.
60
+ - Once a turn settles, intermediate processes cleanly fold behind a minimalist `Processed in Xs` summary row, keeping the conversation view focused on final answers.
61
+
62
+ ---
45
63
 
46
- The Host log should include `[dsh-smooth-stream] plugin loaded!`.
64
+ ## Visual Comparison
47
65
 
48
- Remove it with `pnpm dsh plugin --profile web remove dsh-smooth-stream` (or `dsh plugin --profile web remove dsh-smooth-stream`).
66
+ Left: default Web UI. Right: dsh-smooth-stream.
49
67
 
50
- ## Configuration
68
+ ![Left: default Web UI. Right: dsh-smooth-stream.](docs/compare.gif)
51
69
 
52
- The bundle installs with `preset: balanced`. Change it in the profile `cordis.patch.yml` if you want a different cadence:
70
+ ---
53
71
 
54
- | `preset` | Feel |
55
- | --- | --- |
56
- | `realtime` | Keeps closer to the model |
57
- | `balanced` | Default |
58
- | `silky` | More buffer, slower catch-up |
72
+ ## Performance & Test Benchmarks
59
73
 
60
- Legacy `mode`, `revealCharsPerSec`, `scrollSpeedPxPerSec`, and `maxScrollSpeedPxPerSec` fields are still accepted so existing profiles keep loading; the current adaptive engine uses only `preset` to tune cadence.
74
+ Verified by local browser-level audit suites:
61
75
 
62
- ## User settings
76
+ | Gate | Command | Passing Standard |
77
+ | :--- | :--- | :--- |
78
+ | **Stream Render Audit** | `node scripts/run-render-audit.mjs` | 10/10 clean across 5 streaming patterns; zero regressions |
79
+ | **Overflow & Rebound Gate** | `node scripts/verify-overflow.mjs` | Zero over-scroll, zero bounce under burst load |
80
+ | **Tail Vibration Probe** | `pnpm test` | Single-frame shift $\le 30\text{px}$, 7-frame amplitude $\le 32\text{px}$ |
63
81
 
64
- In the Web UI, open **Settings → Plugins → Plugin configuration** to find a **Smooth stream** card with:
82
+ - Core ESM bundle is approximately **4.7 kB** (gzipped). See [How It Works](https://laplace-bit.github.io/dsh-smooth-stream/how-it-works.html) for full benchmarks.
65
83
 
66
- - **Enable smooth streaming** (on by default): lets this plugin own reply and tool-row rendering and follow. Turn it off to return rendering completely to the built-in Harness UI.
67
- - **Auto-expand thinking**: controls whether reasoning opens while it streams. This preference has no effect while the master toggle is off.
68
- - **Collapse finished work** (on by default): once a turn finishes processing, its thinking, tool calls, context injection, and intermediate output fold behind one “已处理 X秒 / Processed” summary row so only the final answer shows. Click the summary any time to expand or re-collapse the full process.
69
- - **Show render diagnostics** (off by default): opens a chat-side panel with live rendering, frame-rate, and scroll-follow measurements, plus controls for reveal and spring behavior.
84
+ ---
70
85
 
71
- With “Auto-expand thinking” on, reasoning blocks open while streaming and collapse when thinking ends. With it off, reasoning stays collapsed; you can still open a block by hand, and the stream state will not wrestle it back.
86
+ ## Quick Start
72
87
 
73
- “Collapse finished work” never interferes while a reply streams — output expands live, and folding happens only after the turn settles with all work complete. The switch works independently of “Enable smooth streaming”: folding applies whether this plugin or the built-in renderer owns the conversation. Plain replies without thinking or tools get no summary row. Content embedded by other plugins through fully custom tool views (such as `dsh-pianist`'s piano card) is never folded — only calls rendered as native tool cards participate. This feature supersedes the standalone `dsh-auto-collapse` plugin; do not run both at once, or they will fight over the same DOM nodes and overlap text.
88
+ ### Installation
74
89
 
75
- These are durable, user-level preferences that apply live without a restart, and are written to the DeepSeek Harness user-settings document rather than the plugin's composed configuration.
90
+ Inside your DeepSeek Harness repository checkout:
76
91
 
77
- Diagnostics controls apply as you move them: reveal multiplier, queue pressure, maximum reveal rate, spring stiffness/damping/mass, predictive runway, runway response time, and minimum backpressure scale. The panel reports FPS, frame time, character backlog, effective reveal rate, progress, visual lag, scroll velocity, and available follow room. You can **Save** a combination, **Discard** unsaved edits, **Restore defaults**, or copy the current tuning and measurements. Turning diagnostics off immediately returns the renderer to its production defaults.
92
+ ```sh
93
+ pnpm dsh plugin --profile web add dsh-smooth-stream
94
+ ```
78
95
 
79
- ## About & updates
96
+ If `dsh` is in your system `PATH`:
80
97
 
81
- - **Version / homepage / license**: see the top of this page and the `version`, `homepage`, `repository`, and `license` fields in [package.json](package.json). Installed plugins are listed under **Settings → Plugins → All**.
82
- - **Updates**: the card shows the version loaded by the Host. When the active profile declares `dsh-smooth-stream` as an npm dependency, its **Update** button runs the same fixed package update for that profile and then asks you to restart Harness. A `link:` or `file:` development install is shown as a development version and deliberately leaves the button disabled, so it cannot replace your checkout.
98
+ ```sh
99
+ dsh plugin --profile web add dsh-smooth-stream
100
+ ```
83
101
 
84
- You can also update an npm-installed profile from the command line:
102
+ Start the interface:
85
103
 
86
104
  ```sh
87
- dsh plugin --profile web update dsh-smooth-stream
105
+ pnpm dsh web
88
106
  ```
89
107
 
90
- (`dsh plugin --profile web outdated` shows whether a newer version exists.)
108
+ Verify that `[dsh-smooth-stream] plugin loaded!` appears in the host startup logs.
109
+
110
+ To uninstall: `pnpm dsh plugin --profile web remove dsh-smooth-stream`.
111
+
112
+ ---
91
113
 
92
- ## FAQ
114
+ ## Presets & Configuration
93
115
 
94
- **Is this an official DeepSeek plugin?**
95
- No. It is independently maintained, MIT-licensed software for the DeepSeek Harness (`dsh`) Web UI and is not affiliated with DeepSeek.
116
+ The plugin defaults to `preset: balanced`. You can tune the cadence in your profile's `cordis.patch.yml`:
96
117
 
97
- **How do I install a DeepSeek Harness plugin?**
98
- Use the built-in plugin command: `dsh plugin --profile web add dsh-smooth-stream` from a dsh source checkout (see [Install](#install)).
118
+ | `preset` | Characteristics |
119
+ | :--- | :--- |
120
+ | `realtime` | Low buffer; closely follows model token arrival |
121
+ | `balanced` | Recommended default; balances smoothness and latency |
122
+ | `silky` | Generous buffer with gentler acceleration curves |
99
123
 
100
- **Can I install it from npm?**
101
- Yes — `dsh-smooth-stream` is published to [npm](https://www.npmjs.com/package/dsh-smooth-stream). `dsh plugin --profile web add dsh-smooth-stream` installs the prebuilt package.
124
+ ---
102
125
 
103
- **Does it respect `prefers-reduced-motion`?**
104
- Yes. With reduced motion enabled the finished text is shown at once and the plugin does not take over follow. If the frame rate drops below 30 fps while the reply is off-screen, reveal pauses and catches up later.
126
+ ## User Preferences
105
127
 
106
- [![featured on dsh-suite](https://img.shields.io/badge/featured%20on-dsh--suite-4d6bfe)](https://whyihaveyou.github.io/dsh-suite/)
128
+ Open **Settings → Plugins → Plugin Configuration** in the Web UI:
129
+
130
+ - **Enable smooth streaming** (default on): Toggles custom stream rendering and follow. Disabling instantly falls back to built-in Harness rendering.
131
+ - **Auto-expand thinking**: Controls whether reasoning opens automatically while streaming.
132
+ - **Collapse finished work** (default on): Folds thoughts and tool steps into a summary line once the turn settles.
133
+ - **Show render diagnostics** (default off): Opens a live HUD on the right side to inspect FPS, character backlog, spring state, and adjust physical parameters in real time.
134
+
135
+ ---
107
136
 
108
137
  ## License
109
138
 
110
139
  [MIT](LICENSE)
140
+
package/README.md CHANGED
@@ -1,110 +1,139 @@
1
1
  # dsh-smooth-stream
2
2
 
3
- [English](README.en.md) | 中文
3
+ > **让 AI 的长篇生成如提词器般温润流淌。**
4
+ > 为 DeepSeek Harness(`dsh`)打造的二阶弹簧物理流式渲染与零重排跟随引擎。
4
5
 
5
- **dsh-smooth-stream** 为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(`dsh`)Web UI 带来流畅的流式渲染和丝滑滚动。文字、Markdown、代码块、表格以及工具结果会随着输出自然呈现;内容逐步增长时,页面平稳跟随,整轮回复保持连贯的视觉节奏。
6
+ [English](README.en.md) · [项目主页](https://laplace-bit.github.io/dsh-smooth-stream/) · [工作原理与基准](https://laplace-bit.github.io/dsh-smooth-stream/how-it-works.html) · [npm](https://www.npmjs.com/package/dsh-smooth-stream)
6
7
 
7
- 项目主页:<https://laplace-bit.github.io/dsh-smooth-stream/>
8
+ ---
8
9
 
9
- [安装指南](https://laplace-bit.github.io/dsh-smooth-stream/install.html) · [工作原理与可复现基准](https://laplace-bit.github.io/dsh-smooth-stream/how-it-works.html)
10
+ ## 极致丝滑的阅读手感
10
11
 
11
- ## 效果
12
+ 无论是阅读数百行的长篇推演,还是紧盯高速吐字的代码生成,`dsh-smooth-stream` 带来的是一种**沉浸、连贯且零视觉负担**的阅读质感:
12
13
 
13
- 左:默认 Web UI。右:dsh-smooth-stream。
14
+ - **如水流般自然铺展**:告别大段文本突然“砸”在屏幕上的视觉压迫,字句如打字机般富有呼吸感地逐字涌现;
15
+ - **视线无需追赶跳动**:视口如同搭载了高精度阻尼滑轨,随文字增长平稳匀速推移,彻底终结换行时的突发踢移;
16
+ - **呼吸感与实时性的平衡**:慢速输出时从容优雅,高并发爆发时平稳追赶,无论模型吐字多快,画面始终从容自若。
14
17
 
15
- ![左:未使用插件。右:使用 dsh-smooth-stream。](docs/compare.gif)
18
+ ---
16
19
 
17
- ## 核心体验
20
+ ## 为什么需要它?
18
21
 
19
- - **流畅渲染。** 文字边到边呈现,Markdown 结构持续更新,标题、列表、代码块和表格在流式过程中保持自然的阅读状态。
20
- - **丝滑滚动。** 内容逐步变高时,页面沿连续的滚动轨迹平稳跟随,视线始终贴着正在生成的内容。
21
- - **统一过渡。** 换行、代码块、表格和工具结果使用一致的过渡方式,正文、思考过程与工具输出衔接自然。
22
- - **自适应节奏。** 渲染速度会根据输出速度和待显示内容调整,让慢速输出从容呈现,快速输出及时跟上。
22
+ 大模型输出是通过网络分块到达的。一个数据包可能在几毫秒内送达数百字符,下一个分块却需要数十毫秒。
23
23
 
24
- ## 安装
24
+ 如果直接将 DOM 渲染和视口滚动绑定在离散的到达事件上,通常会引发两个阅读体验问题:
25
+ 1. **视觉跳跃与撕裂**:段落、代码块和表格整段突发呈现,视线被迫频繁重新寻焦;
26
+ 2. **滚动抖动与重排风暴**:依靠 `scrollTop = scrollHeight` 进行瞬时硬跳;即使用 CSS `scroll-behavior: smooth`,高频写入也会不断重置缓动曲线,导致动画永远无法收敛,高速流下伴随剧烈的主线程重排。
25
27
 
26
- 在 DeepSeek Harness 源码仓库里:
28
+ `dsh-smooth-stream` 将**内容呈现**与**视口运动**拆分为两个独立的物理状态机,在每一帧动画回调(rAF)中连续积分,彻底消除跳跃感。
27
29
 
28
- ```sh
29
- pnpm dsh plugin --profile web add dsh-smooth-stream
30
- ```
30
+ ---
31
31
 
32
- 如果 `PATH` 上已经有 `dsh`:
32
+ ## 核心机理与架构
33
33
 
34
- ```sh
35
- dsh plugin --profile web add dsh-smooth-stream
34
+ ```
35
+ [ 模型 SSE 分块流 ]
36
+ │
37
+ ▼
38
+ ┌─────────────────┐ 背压阻尼 (0.55x ~ 1.0x) ┌─────────────────┐
39
+ │ 揭示节奏引擎 │ ◄──────────────────────────────── │ 弹簧跟随引擎 │
40
+ │ (Reveal Engine) │ │ (Follow Engine) │
41
+ └────────┬────────┘ └────────┬────────┘
42
+ │ 字符积压与分数积分 │ 二阶阻尼弹簧积分 (k=130, c=24)
43
+ ▼ ▼
44
+ [ 逐帧平滑展开 DOM ] ───────────────────────────────► [ 合成层 Transform 补偿 ]
45
+ (单帧视觉位移 ≤ 8px) (0 Reflow / 纯 GPU 合成)
36
46
  ```
37
47
 
38
- npm 包带预构建的 `lib/`,无需 pnpm ≥10 的构建脚本授权,直接可装。
48
+ ### 1. 动态自适应的揭示引擎(Reveal Engine)
49
+ - **分数级字符积分**:根据积压队列深度自适应调节速度($v = 90 + \text{backlog}^{1.25} \times P$),低负载时从容自然,高积压时平稳追赶,绝不倾泻整段文本。
50
+ - **折行限幅平滑**:长文本和代码块发生换行时,单帧视觉位移被限制在 8px 以内,将原本 24~28px 的单帧跳跃平摊至数帧完成。
51
+ - **尾部平稳收束**:回合结束标记到达后,残余缓冲区以恒定速率释放,正文、思考链与工具调用之间自然衔接。
39
52
 
40
- 启动界面:
53
+ ### 2. 纯合成层驱动的跟随引擎(Follow Engine)
54
+ - **二阶阻尼物理系统**:采用 $k=130, c=24, m=1$ 的亚步进物理弹簧,将内容高度的变化转化为平滑连续的速度与位移轨迹。
55
+ - **零重排(Zero-Reflow)位移补偿**:真实滚动容器始终锚定在底部,剩余的视觉滞后完全由外层 DOM 的 `transform: translate3d` 吸收。跟随过程不读写任何触发 Layout 的属性,杜绝重排风暴。
56
+ - **闭环背压控制(Closed-Loop Backpressure)**:当跟随滞后接近预留空间时,反向向揭示引擎施加阻尼(最低降至 0.55 倍速),防止文本增长超出视口弹簧范围。
57
+ - **掉帧自愈与跨刷新率一致**:主线程卡顿(Stall)时自动钳位物理时间($\le 32\text{ms}$),避免画面恢复后的突进瞬移;在 60Hz 与 120Hz(ProMotion)屏幕下拥有近乎一致的物理收敛时间。
41
58
 
42
- ```sh
43
- pnpm dsh web
44
- ```
59
+ ### 3. 会话生命周期自动折叠(Turn Auto-Collapse)
60
+ - 对话进行时,思考链与工具调用保持实时展开;
61
+ - 回合结算完成并稳定后,自动将执行过程收敛为一行极简的 `已处理 X 秒` 摘要,保持工作区专注;支持随时点击无缝展开。
45
62
 
46
- Host 日志里应出现 `[dsh-smooth-stream] plugin loaded!`。
63
+ ---
47
64
 
48
- 卸载:`pnpm dsh plugin --profile web remove dsh-smooth-stream`(或 `dsh plugin --profile web remove dsh-smooth-stream`)。
65
+ ## 效果对比
49
66
 
50
- ## 配置
67
+ 左:默认 Web UI。右:dsh-smooth-stream。
51
68
 
52
- 组合包默认 `preset: balanced`。要换节拍,在 profile 的 `cordis.patch.yml` 里改:
69
+ ![左:未使用插件。右:使用 dsh-smooth-stream。](docs/compare.gif)
53
70
 
54
- | `preset` | 手感 |
55
- | --- | --- |
56
- | `realtime` | 更贴模型到达 |
57
- | `balanced` | 默认 |
58
- | `silky` | 缓冲更大,追上更慢 |
71
+ ---
59
72
 
60
- 旧版的 `mode`、`revealCharsPerSec`、`scrollSpeedPxPerSec` 和 `maxScrollSpeedPxPerSec` 字段仍可被加载,以兼容已有 profile;当前自适应引擎仅使用 `preset` 调整节拍。
73
+ ## 性能与基准
61
74
 
62
- ## 用户设置
75
+ 平滑度与稳定性基于本地自动化审计台架验证:
63
76
 
64
- 在 Web 界面打开 **设置 → 插件 → 插件配置**,会看到一张 **丝滑流式(Smooth stream)** 卡片,其中包含:
77
+ | 验证闸门 | 测试项目 | 指标要求 |
78
+ | :--- | :--- | :--- |
79
+ | **流式渲染审计** | `node scripts/run-render-audit.mjs` | 5 种典型生成场景下 10/10 Clean,零位移回退 |
80
+ | **视口溢出闸门** | `node scripts/verify-overflow.mjs` | 极限输出场景下零过滚、零反弹 |
81
+ | **尾行晃动抑制** | `pnpm test` | 单帧跳变 ≤30px,7 帧振幅峰值 ≤32px |
65
82
 
66
- - **启用丝滑流式渲染**(默认开启):开启时由本插件接管回复和工具行的渲染与跟随;关闭后会撤销接管,完整使用 Harness 内置渲染。
67
- - **自动展开思考**:控制思考块在流式期间是否自动展开。主开关关闭时此选项不会生效。
68
- - **完成后自动折叠**(默认开启):回合处理完成后,把思考过程、工具调用、上下文注入和中间输出折叠为一行“已处理 X秒”摘要,只展示最终回复;点击摘要可随时展开或收起完整工作过程。
69
- - **显示渲染调试面板**(默认关闭):在聊天页右侧显示实时渲染、帧率和滚动跟随数据,并开放流式揭示与滚动弹簧参数。
83
+ - 核心 ESM 产物经 Gzip 压缩后仅约 **4.7 kB**。详见[工作原理与基准](https://laplace-bit.github.io/dsh-smooth-stream/how-it-works.html)。
70
84
 
71
- “自动展开思考”开启时,思考块会在流式时自动展开、思考结束后收起;关闭后思考块保持折叠,仍可手动点开,且不会被流式状态抢回控制。
85
+ ---
72
86
 
73
- “完成后自动折叠”在流式期间不干预——回复实时展开输出;只有回合结束(出现结束标记且全部工作完成)才折叠。该开关独立于“启用丝滑流式渲染”:无论由本插件还是内置渲染器负责对话,折叠都照常工作。纯文本回复(无思考、无工具)不会生成摘要行。其他插件通过自定义工具视图嵌入的内容(如 `dsh-pianist` 的钢琴卡片)不会被折叠——只有渲染为原生工具卡样式的调用才参与折叠。此功能取代外挂的 `dsh-auto-collapse` 插件,二者不要同时安装,否则会互相抢夺同一批 DOM 节点造成文字重叠。
87
+ ## 安装与使用
74
88
 
75
- 这些设置是用户级的持久化偏好,改完即生效,无需重启;会写进 DeepSeek Harness 的用户设置文档,而不是插件的组合配置。
89
+ 在 DeepSeek Harness 源码根目录运行:
76
90
 
77
- 调试面板中的参数在拖动时实时生效,包括揭示倍率、队列压力、最大揭示速度、弹簧刚度/阻尼/质量、预测 runway、runway 响应时间和最低背压倍率。面板同时显示 FPS、帧耗时、积压字符、实际揭示速度、渲染进度、视觉滞后、滚动速度和可用跟随空间;可随时**保存**当前组合、**放弃**未保存修改、**恢复默认**,或复制当前参数与指标。关闭调试开关后,渲染引擎立即恢复正式默认参数。
91
+ ```sh
92
+ pnpm dsh plugin --profile web add dsh-smooth-stream
93
+ ```
78
94
 
79
- ## 关于与更新
95
+ 如果系统 `PATH` 中已有 `dsh`:
80
96
 
81
- - **版本 / 主页 / 许可证**:见本页顶部与 [package.json](package.json) 的 `version`、`homepage`、`repository`、`license` 字段;安装的插件列表可在 **设置 → 插件 → 全部** 里查看。
82
- - **更新**:卡片会显示 Host 当前加载的版本。只有当前 profile 明确把 `dsh-smooth-stream` 声明为 npm 依赖时,**更新**按钮才会对该 profile 执行固定的包更新,并提示重启 Harness。`link:` 或 `file:` 本地开发安装会显示为开发版本,更新按钮会保持禁用,避免覆盖你的源码目录。
97
+ ```sh
98
+ dsh plugin --profile web add dsh-smooth-stream
99
+ ```
83
100
 
84
- 也可以通过命令行更新 npm 安装的 profile:
101
+ 启动界面:
85
102
 
86
103
  ```sh
87
- dsh plugin --profile web update dsh-smooth-stream
104
+ pnpm dsh web
88
105
  ```
89
106
 
90
- (也可用 `dsh plugin --profile web outdated` 查看是否有新版本。)
107
+ Host 日志中显示 `[dsh-smooth-stream] plugin loaded!` 即表示已成功加载。
108
+
109
+ 卸载命令:`pnpm dsh plugin --profile web remove dsh-smooth-stream`。
110
+
111
+ ---
91
112
 
92
- ## 常见问题
113
+ ## 配置与手感预设
93
114
 
94
- **这是 DeepSeek 官方插件吗?**
95
- 不是。它是面向 DeepSeek Harness(`dsh`)Web UI 的独立维护项目,采用 MIT 许可证,和 DeepSeek 没有从属关系。
115
+ 插件默认采用 `preset: balanced`。如需切换手感,可在对应 profile 的 `cordis.patch.yml` 中修改:
96
116
 
97
- **dsh 插件怎么安装?**
98
- 用内置插件命令:在 dsh 源码目录运行 `dsh plugin --profile web add dsh-smooth-stream`(见[安装](#安装))。
117
+ | `preset` | 动态特性 |
118
+ | :--- | :--- |
119
+ | `realtime` | 紧跟模型分块到达节奏,缓冲更小 |
120
+ | `balanced` | 默认推荐,兼顾阅读流畅度与响应延迟 |
121
+ | `silky` | 增大缓冲区,追赶更平缓柔和 |
99
122
 
100
- **能用 npm 安装吗?**
101
- 能。`dsh-smooth-stream` 已发布到 [npm](https://www.npmjs.com/package/dsh-smooth-stream),`dsh plugin --profile web add dsh-smooth-stream` 安装的就是预构建的 npm 包。
123
+ ---
102
124
 
103
- **支持 `prefers-reduced-motion` 吗?**
104
- 支持。系统开启减少动态效果时直接显示完整文本、不接管跟随;帧率低于 30 fps 且回复在屏外时,揭示自动暂停、恢复后再补上。
125
+ ## 用户偏好设置
105
126
 
106
- [![featured on dsh-suite](https://img.shields.io/badge/featured%20on-dsh--suite-4d6bfe)](https://whyihaveyou.github.io/dsh-suite/)
127
+ 在 Web 界面打开 **设置 → 插件 → 插件配置**,可对 **丝滑流式(Smooth stream)** 卡片进行个性化调节:
128
+
129
+ - **启用丝滑流式渲染**(默认开启):接管回复和工具行的渲染与跟随;关闭后即时恢复 Harness 内置渲染。
130
+ - **自动展开思考**:流式生成期间是否自动展开思考过程。
131
+ - **完成后自动折叠**(默认开启):回合处理完成后,将思考过程与工具调用折叠为摘要行。
132
+ - **显示渲染调试面板**(默认关闭):在界面右侧开启实时 HUD,观测 FPS、字符积压、弹性曲线并微调物理参数。
133
+
134
+ ---
107
135
 
108
136
  ## 许可证
109
137
 
110
138
  [MIT](LICENSE)
139
+