返回目录
模型与 MCP 插件

dsh-turnfold

UNscientific-9/dsh-turnfold

DSH Web 轮次折叠插件:thinking/工具调用流式可见,turn 完成后自动收纳成一行摘要。

Stars
1
Forks
0
Issues
0
更新
2 个月前

PROJECT TOPICS

项目标签

INSTALL REFERENCE

安装参考

未验证
dsh plugin --profile web add github:UNscientific-9/dsh-turnfold

该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。

PROJECT README

README

English | 中文

dsh-turnfold

License: MIT DSH Release TypeScript

An enhancement plugin for the official turn fold bar built into DSH Web 0.1.5 — it takes over the official turn-process renderer with an identical look and behaviour, and adds five enhancements the official bar doesn't have, purely client-side.

Effect demo

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 five 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
Standalone fold bar When the official renderer finds no finalized answer (a turn stopped on a tool call — interrupted or errored), it renders no fold bar at all and leaves the whole turn flat. The plugin adds its own bar for such closed turns — expanded by default, collapsible, decision persisted like any other

Purely front-end: no backend changes, no session-store changes, zero server-side residue after uninstall. Pinned to DSH 0.1.5-rc.2 (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. Expanding runs a CSS height transition (no measurement, via interpolate-size); collapsing runs a Web Animations API height transition that folds the official geometry changes into the same batch — both reversible mid-flight and prefers-reduced-motion aware. When the official renderer finds no finalized answer it renders no bar at all; the plugin supplies its own standalone bar for those closed turns.


Install (4 steps)
  1. Get UNscientific-9-dsh-turnfold-0.5.0.tgz (see 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:

    {
      "dependencies": {
        "@UNscientific-9/dsh-turnfold": "file:D:/path/to/UNscientific-9-dsh-turnfold-0.5.0.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.5.0 loaded, and completed turns get the official-style fold bar with a faded · took X · M thinking segments tail.

Requires DSH web 0.1.5-rc.2 (the fold bar shipped in the 0.1.2 line; this build is pinned to the 0.1.5 host API).

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 <style> tag); removing it restores the pure official fold bar.


Documentation

Full user guide · Architecture · Manual verification checklist

License

MIT

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类模型与 MCP
规则置信度高

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek。