CH4ACKO3/dsh-turn-fold
Codex-style completed-turn folding for DeepSeek Harness, powered by dsh-harmony.
Project Overview项目介绍
dsh-turn-fold is a dsh-harmony provider plugin that adds Codex-Desktop-style turn folding to the DSH WebUI conversation view. During a turn, the summary bar stays visible while thinking, notes, commands, and tool calls continue streaming; once the turn settles, prior Agent activity collapses into a single disclosure placed immediately before the final answer. Configurable metrics default to wall time, tool-call count, and input/output tokens. Use it to reduce visual noise in long sessions. Note: it applies shape-guarded in-memory Source Patches to a specific bundle range and fails closed if selectors mismatch.
dsh-turn-fold 是一个 dsh-harmony 插件,为 DSH WebUI 对话添加 Codex 桌面端的回合折叠功能。在回合进行中,思考、笔记、命令与工具调用流式显示,摘要栏保持可见;回合结束后,Agent 活动聚合到一个可展开区域,紧邻最终回答之前。配置项含耗时、调用次数与输入/输出 token。适用于需要隐藏中间过程、聚焦结论的长对话。注意:插件通过 Source Patch 作用于编译产物,绑定不匹配或目标形状变化时直接失败关闭。
请帮我了解并安装插件:【dsh-turn-fold】【https://github.com/CH4ACKO3/dsh-turn-fold】
Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add github:CH4ACKO3/dsh-turn-fold
把 CH4ACKO3/dsh-turn-fold 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-turn-fold
English | 简体中文
A dsh-harmony provider that adds Codex-Desktop-style turn folding to the DSH WebUI conversation.
https://github.com/user-attachments/assets/3c9dfdcf-a454-4750-9edf-76771ed5a9a6
During a turn, the summary bar remains visible while native thinking, notes, commands, and tool calls keep streaming. Consecutive reasoning, context injections, and tool activity share one compact group from the second item onward. When a turn settles, known Agent activity, including context injection, moves into one disclosure immediately before the final answer. Its configurable metrics default to wall time, tool-call count, and input/output tokens, and appear only when the loaded turn contains enough data to calculate them without guessing.
The final answer is located through turn-tail.closing.finalNode, not
finish_reason or DOM position. Completed, stopped, and interrupted turns fold,
with distinct status labels for the latter two. A turn remains expanded when
DSH marks its closing branch unavailable, when any later node follows the
closing answer, or while the user has keyboard focus or an active text selection
inside its activity. Failed, max-token, closing-less, and open turns also stay
expanded so errors and unfinished work are never hidden.
Expanding reuses the original native node renderers, so tool details, copy, and file links keep working. Open turns are remembered per session and turn while the WebUI remains loaded. The disclosure has keyboard-visible focus, accessible state and action labels, responsive wrapping, reduced-motion handling, and a short open/close transition that unmounts the activity after it closes.
How it works
Three shape-guarded Source Patches run in memory against the compiled browser
bundle. For DSH 0.1.0-rc.8 through 0.1.1-rc.2, they target
@deepseek-ai/dsh-client-ui-conversation; for DSH 0.1.2-alpha.5 through the
0.1.2 line, they follow the renderer into @deepseek-ai/dsh-client-ui-chat.
Installed DSH files are never modified. Every selector must still match exactly
once, so an incompatible compiled shape fails closed instead of modifying an
uncertain target.
| Patch | Selector (expect 1) | Effect |
|---|---|---|
inject-turn-fold-runtime |
FunctionDeclaration[name.name="ChatView"], VariableStatement:has(VariableDeclaration[name.name="ChatView"]) |
Injects the fold renderer + disclosure UI into either native or decorated ChatView |
rewrite-node-render-loop |
legacy order.map(...) / 0.1.2 ChatNodeList call |
Replaces the version-specific native node-list seam with the per-turn renderer |
install-turn-fold-services |
VariableStatement:has(VariableDeclaration[name.name="t"][initializer.expression.name.name="bind"]) |
Registers the bundled English and Chinese dictionaries through DSH's native locale service and binds the native settings scope |
Install
dsh plugin --profile web add github:CH4ACKO3/dsh-turn-fold
dsh harmony status --profile web # all three patches must be `bound`
Test
node test/run.cjs
npm install installs the dependencies required by the test harness. The test
suite applies all three patches to both supported compiled shapes in memory, parses the final browser bundles, and
covers completed, split-activity, post-closing, partial-history, failed,
interrupted, open, accessibility, localization, settings, and state-retention
behavior. A missing target or selector mismatch fails the test; it is never
reported as a skipped pass.
CI and release
GitHub Actions runs the test suite and a package dry run for every pull request
and every push to main. Version tags publish to npm through Trusted Publishing
(OIDC), without a long-lived npm token.
Configure the npm trusted publisher once:
npx npm@^11.15.0 trust github @ch4acko3/dsh-turn-fold \
--repo ch4acko3/dsh-turn-fold \
--file release.yml \
--allow-publish
Then create and push a version tag whose value matches package.json:
npm version patch
git push --follow-tags
aa2246740/dsh-watcher
chushixixin/dsh-harness-mcp-server
lehhair/dsh-split-panes
kongdexu/dsh-nav-pointer