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

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-processfold bar, keyed slotconversation.chat.node,useTurnDatainjection 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)
Get
UNscientific-9-dsh-turnfold-0.5.0.tgz(see Releases) and put it in a fixed directory.Edit the DSH web profile's
%USERPROFILE%\.dsh\profiles\web\package.jsonand add the dependency:{ "dependencies": { "@UNscientific-9/dsh-turnfold": "file:D:/path/to/UNscientific-9-dsh-turnfold-0.5.0.tgz" } }In the profile directory, run
pnpm install, then restart DSH web and hard-refresh the browser (Ctrl+Shift+R).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 segmentstail.
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 |
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
No comments yet. Be the first to write one.