dsh-turnfold
界面增强 活跃维护

dsh-turnfold

UNscientific-9/dsh-turnfold

支持对话过程中thinking、工具调用内容流式可见,单轮对话结束后自动收纳为单行摘要,折叠状态界面更清爽,可随时展开查看完整轮次交互细节,可直接接入Web端对话页面使用。

1
Stars 标星
0
Forks 分支
1
Watchers 关注
0
Open Issues
TypeScript
主要语言
MIT
开源协议
958 KB
仓库大小
23 天前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:UNscientific-9/dsh-turnfold
git clone https://github.com/UNscientific-9/dsh-turnfold.git
git clone git@github.com:UNscientific-9/dsh-turnfold.git
README.md main
[English](https://github.com/UNscientific-9/dsh-turnfold/blob/main/README.md) | [中文](https://github.com/UNscientific-9/dsh-turnfold/blob/main/README.zh-CN.md) # dsh-turnfold [![License: MIT](https://cdnimage-cache.doubi.ren/?url=https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://raw.githubusercontent.com/unscientific-9/dsh-turnfold/main/LICENSE) [![DSH](https://cdnimage-cache.doubi.ren/?url=https://img.shields.io/badge/DSH-0.1.2--alpha.1-blue?style=flat-square)](https://github.com/deepseek-ai/dsh-client-runtime) [![Release](https://cdnimage-cache.doubi.ren/?url=https://img.shields.io/badge/Release-v0.3.2-green?style=flat-square)](https://github.com/UNscientific-9/dsh-turnfold/releases/tag/v0.3.2) ![TypeScript](https://cdnimage-cache.doubi.ren/?url=https://img.shields.io/badge/TypeScript-strict-blue?style=flat-square) > An enhancement plugin for the **official turn fold bar** built into [DSH Web](https://github.com/deepseek-ai/dsh-client-runtime) 0.1.2 — > it takes over the official `turn-process` renderer with an identical look and behaviour, and adds four enhancements the official bar doesn't have, purely client-side. ![Effect demo](https://cdnimage-cache.doubi.ren/?url=https://raw.githubusercontent.com/unscientific-9/dsh-turnfold/main/plugin/docs/assets/foldbar-demo.png) *`43 tool calls · 15 messages` is the official count; the faded `· took 30m 49s` tail is injected by this plugin. Click to fold/unfold — your choice survives refreshes.*

The four enhancements

Enhancement What it does
Duration + thinking segments Appends · took X · M thinking segments in a faded tertiary colour, computed by the plugin's own per-turn state machine
Fold-decision persistence The official fold state is in-memory only (lost on refresh); the plugin records your choice in localStorage and restores it on reload
completed whitelist (optional, off by default) The official bar folds every settled turn regardless of outcome; when enabled, aborted / errored / max-tokens turns stay expanded and render no bar at all
Auto-load earlier history Scrolling near the top of a conversation automatically invokes the official loadOlder(), so long-session history arrives pre-folded

Purely front-end: no backend changes, no session-store changes, zero server-side residue after uninstall.
Pinned to DSH 0.1.2-alpha.1 (official turn-process fold bar, keyed slot conversation.chat.node, useTurnData injection surface).


How it works

flowchart TB
    OFF["Official ui-chat fold bar<br>(turn-process)"]
    FOLD["FoldBarView<br>this plugin's shadow renderer"]
    DEF["turn-activity definition<br>per-turn state machine"]
    OFF -->|"shadow takeover"| FOLD
    FOLD -->|"official counts + augment<br>useTurnData('turn-activity')"| DEF
    DEF -.->|"published at turn/end"| DATA["{ durationMs, thinkingSteps,<br>reasonKind }"]

Takeover: ctx.slots.register({ key: 'turn-process', priority: -1 }) — the lowest priority renders among same-key registrations. Expand/collapse plays a height animation (Web Animations API, direction-reversible, prefers-reduced-motion aware); foldable=false follows the official renderer and renders nothing.


Install (4 steps) 1. Get `dsh-turnfold-0.3.2.tgz` (see [Releases](https://github.com/UNscientific-9/dsh-turnfold/releases)) and put it in a fixed directory. 2. Edit the DSH web profile's `%USERPROFILE%\.dsh\profiles\web\package.json` and add the dependency: ```json { "dependencies": { "@UNscientific-9/dsh-turnfold": "file:D:/path/to/dsh-turnfold-0.3.2.tgz" } } ``` 3. In the profile directory, run `pnpm install`, then restart DSH web and hard-refresh the browser (`Ctrl+Shift+R`). 4. The browser console should show `[dsh.turnfold] v0.3.2 loaded`, and completed turns get the official-style fold bar with a faded `· took X · M thinking segments` tail. Requires DSH web **0.1.2-alpha.1** (0.1.1 has no official fold bar — this plugin does not apply).
Configuration (localStorage) | Key | Default | Effect | |---|---|---| | `dsh.turn-collapse.completedOnly` | unset | Set to `'1'` to keep aborted / errored / max-tokens turns expanded; remove the key to restore the official behaviour | | `dsh.turn-collapse.autoLoad` | `'1'` | Set to `'0'` to disable auto-load of earlier history |
Uninstall / rollback Remove the `@UNscientific-9/dsh-turnfold` line from the profile `package.json`, run `pnpm install`, restart DSH web and hard-refresh. Everything the plugin owns lives in the browser (three localStorage keys + one `