dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
Codex-style conversation rollback, "edit input, then re-generate", and a right-edge session outline rail for the DeepSeek Harness (DSH) Web UI.
dsh-session-toc outline rail into this
package: one plugin, one client bundle, one install.chat hook (useChat), and the user-node
takeover installs from an entry-mutation watch instead of a one-shot lookup at
apply time.lib/chunk-rows.js, stored sessions are read through the
persistence handle seam (open(id, 'read')), the live durable cursor is
rewound on persistence.tracker.writers (its observedLength guard
included), and the event log is read from session.log.conversation-rollback namespace, persisted in settings.yaml.Ctrl/Cmd+Shift+O to pin):
lists every prompt you sent as a row — with its turn number, timestamp and
a steer marker for mid-run steering messages. Click a row (or a tick) to
scroll that turn into view and flash-highlight it.session.loadOlder(), up to 40 pages)
until a match loads or history ends.user / steering chat nodes enter the outline: blank input,
image-only input, tool rows and injected context are excluded.[data-conversation-scroll]), not the window, and follows it with a
ResizeObserver — so side panels that squeeze the column
(dsh-better-sidebar, DSH's own details column, side-card bottom panels)
never slide over it, and there is no z-index war.localStorage['dsh-session-toc:pinned'] (the
same key the standalone plugin used, so existing pinned state survives).conversation-rollback in the harness home's settings.yaml, shared by the
web and desktop profiles — not a per-browser toggle. If the settings service
is unreachable the rail keeps its default (on) and the row says so, so a
missing settings service can never hide the feature by accident. Both the row
and the rail follow the harness language switch without a reload.Both rollback operations are destructive and cannot be undone: the original reply and all subsequent messages are permanently removed.
POST /api/conversation-rollback
{ "sessionId": "...", "atSeq": <any seq inside a completed turn> }{ "operation": "edit", "sessionId": "...", "turn": <turn number>, "text": "..." }{ "operation": "settings.get" } →
{ "ok": true, "outline": true, "revision": 0 }{ "operation": "settings.update", "patch": { "outline": false }, "expectedRevision": 0 } → the same shape, or
{ "ok": false, "code": "settings-conflict", ... } when the namespace moved.An operation that is none of these still dispatches to rollback, so existing
callers are unaffected. settings.* answers settings-unavailable on a build
whose settings service is absent — the rail then keeps its default (on).
web profile (dsh web) or the DSH
Desktop app (which uses the desktop profile).pnpm available on your PATH for dsh plugin management.git is required for the GitHub install and the local clone; npm is only
required for the npm pack option.desktop and web are two independent compositions, each with its own
package.json + node_modules. If the plugin never appears, the most likely
reason is that it was installed into the other one.
To detect the profile the running web process uses, fetch its root page and look for the Desktop marker:
# bash / macOS / Linux — replace <port> with the URL from the env var DSH_WEB_URL
curl -s "http://127.0.0.1:<port>/" | grep -o dsh-plugin-desktop
# PowerShell / Windows
(Invoke-WebRequest "http://127.0.0.1:<port>/" -UseBasicParsing).Content | Select-String "dsh-plugin-desktop"
A hit means the Desktop shell hosts this process — use --profile desktop.
No hit means a plain dsh web process — use --profile web.
dsh plugin --profile <web|desktop> add github:sharedcare/dsh-conversation-rollback#<sha-or-tag>
dsh plugin adds the package to the selected profile and automatically
registers the bundle patch layer. Pinning a commit or tag is recommended so a
later push cannot silently change the code that is actually running; the
v1.4.0 tag points at commit 5de8731.
For a fork, replace sharedcare with your GitHub username or use the full
repository URL, with the pin appended to the git URL:
dsh plugin --profile <web|desktop> add "git+https://github.com/<owner>/dsh-conversation-rollback.git#<sha-or-tag>"
The merged bundle is committed and the package declares no prepare
script, so a github: install pulls the source and runs no build — no pnpm
allowBuilds authorization is needed.
For development, or if you prefer to build the package yourself:
git clone https://github.com/sharedcare/dsh-conversation-rollback.git
cd dsh-conversation-rollback
Option A — link this checkout directly into the profile (useful while
developing; edits take effect after pnpm run build + a page refresh):
dsh plugin --profile <web|desktop> add link:$PWD
Option B — install a packed tarball:
npm pack
dsh plugin --profile <web|desktop> add ./conversation-rollback-1.5.1.tgz
(The filename is whatever npm pack prints — 1.5.1 for the current
version.)
If you previously installed the standalone dsh-session-toc plugin,
remove it, or the merged package will mount two rails:
dsh plugin --profile <web|desktop> remove dsh-session-toc
With a web profile installed before the bundle-patch era, the profile's
cordis.patch.yml ($DSH_HOME/profiles/web/cordis.patch.yml, default
~/.dsh/profiles/web/cordis.patch.yml) may still contain a hand-written
- insert: conversation-rollback row. Remove it — the installed bundle
patch adds that entry automatically and the manual row duplicates it.
Upgrading a git/link-based install: remove it, then add again with the
desired commit/tag as in step 2.
Restart the DSH Web process / Desktop so the host route and browser client
are loaded. (Only adding or removing plugins needs a restart; re-served
lib/client.js is read per request.)
Web profile:
dsh plugin --profile web list
dsh web --dump-config | grep conversation-rollback
The dump should show the bundle section and an entry with
id: conversation-rollback.
Desktop app (no --dump-config on the shell — probe the served bundle
directly from the running page; dsh-toc-root is the rail's stylesheet root
class). The module loader serves one combo URL per graph row
(/plugins/??<id>/client.js&rev=<rev>, rev from window.__DSH_BOOT__), so
ask the page instead of guessing the path:
// DevTools console on the DSH page (the page already holds the auth cookie)
await fetch(__DSH_BOOT__.entries.find(e => e.id === 'conversation-rollback').url)
.then(r => r.text())
.then(t => ({ status: 200, hasRailCss: t.includes('dsh-toc-root'), bytes: t.length }))
Expect hasRailCss: true. If the rail is missing but the rollback buttons
work, the client bundle is stale — hard-refresh the browser page and retry.
dsh plugin --profile <web|desktop> remove conversation-rollback
Restart the DSH Web process / Desktop afterwards.
The module loader serves one client bundle per plugin entry
(/plugins/<id>/client.js), and inside a factory require only resolves the
shared module table (react, react-dom/client, the injected @deepseek-ai/*).
Two features therefore cannot stay two bundles — src/ holds the hand-written
inputs and lib/ the committed product.
| File | Role |
|---|---|
src/client.rollback.js | rollback client bundle (upstream code + the single FORK DEVIATION marker below) |
src/session-toc.js | outline rail factory body (bundle shell stripped) |
lib/client.js | product of pnpm run build — do not edit by hand |
lib/index.js | host side (route, rewrite, live surgery, settings namespace) |
lib/chunk-rows.js | vendored port of dsh-session's internal physical-row codec |
tools/merge-client.mjs | splice / unsplice tool |
test/chunk-rows.mjs | host codec round-trip test (pnpm test) |
test/host-route.mjs | host-half route + settings-namespace test (pnpm test) |
test/host-stubs.mjs | in-memory import stubs the host test loads through a module hook |
test/smoke.mjs | browserless client smoke test (pnpm test) |
pnpm run build # src/client.rollback.js + src/session-toc.js -> lib/client.js
pnpm test # node --check lib/*.js + browserless smoke test
pnpm run build:strip # inverse: lib/client.js -> src/client.rollback.js
Why the rail is wrapped in its own IIFE: both halves declare function apply
in the factory scope. A plain concatenation is legal JavaScript where the
later declaration silently wins — the rollback half would stop registering
its three slot entries without raising an error. build is not an npm
lifecycle script, so installing the package never triggers it (only
prepare would, and this package deliberately has none).
Why the product is committed: github: installs fetch the source and do not
build it, so either the package provides a self-contained prepare (users
would have to approve it via allowBuilds in the profile
pnpm-workspace.yaml — effectively authorizing code execution) or it ships
built output. This package ships built output: zero build, zero approval,
.gitignore explicitly refuses to ignore lib/.
The one deviation from upstream is marked in
src/client.rollback.js (FORK DEVIATION): the injected <style> carries
data-plugin / data-plugin-css — the only attributes dsh-client-hmr
matches to reclaim a plugin's stylesheet on a hot swap. Without them every
reload leaves an extra stale copy of the rollback CSS.
Keeping up with lib/client.js edits made elsewhere: merge and strip are
exact inverses (round trip is byte-identical), and the generated regions are
framed by /* == session-toc: BEGIN/END ... == */ markers, so a conflict can
be moved out of the way first:
git merge <upstream> # conflict lands in lib/client.js
node tools/merge-client.mjs --strip # peel the generated regions off
# resolve the conflict in src/client.rollback.js (or take upstream's version)
pnpm run build && pnpm test
The generator fails loudly when the whole-line anchors
(exports.apply = apply; / exports.name = "conversation-rollback";) are
missing or duplicated, rather than producing a half-featured bundle, and the
line anchors guarantee the upstream file's indentation survives. smoke.mjs
pins the merge itself: both halves register, the rollback user-node takeover
keeps priority: -1, the rail's projection and backwards paging work, a
prepend keeps the reader's viewport offset, a throwing rail cannot take
rollback down, and both stylesheets carry the HMR-reclaimable ownership
marker.
The Desktop host keeps an install-recovery ledger at
<DSH Desktop data>/plugin-install-recovery/state.json (macOS:
~/Library/Application Support/DSH Desktop/..., Windows:
%APPDATA%\DSH Desktop\...). One installation stops at
phase: "awaiting-restart"; the next one is then blocked with
another plugin install recovery transaction is pending, and the only way to
clear it is to restart Desktop (startup health check) or roll the transaction
back in the recovery page — there is no CLI commit command.
If you need to get past that without a restart, point that one call at a
different WAL location: the validation only requires the file to be named
state.json inside a directory named plugin-install-recovery (the
parent's parent is arbitrary, see install-recovery-BD5jkQTK.js:121-129).
The trade-off: this installation does not enter the app's regular ledger and
will not be rolled back automatically.
Cannot read properties of undefined (reading 'adapterDefaults'), the live Agent still cached state from the
truncated log. Restart the Web process so the current lib/index.js is
loaded; this version resets the session request/context folds, derived
message caches, agent.requestHeaderLogged, and runtime-context projections
after splicing./plugins/conversation-rollback/client.js
serves 200 but contains no dsh-toc-root, the served bundle predates
1.4.0 — reinstall the new version and restart.dsh-toc-bar) appears at
the bottom-left of the page with the error message; the rollback half stays
usable (the rail mounts in its own try/catch).conversation-rollback: { outline: true } in the
harness home's settings.yaml, or POST
{"operation":"settings.update","patch":{"outline":true}} to
/api/conversation-rollback from the GUI's own origin.dsh plugin add fails for a git-hosted fork that adds a
prepare/postinstall script, follow the allowBuilds hint printed by
pnpm and add the exact key to the profile's pnpm-workspace.yaml, then
re-run the install. The upstream package has no build scripts, so the
standard GitHub install needs no extra approval.Ctrl/Cmd+Shift+O 固定展开):按轮次
列出你发过的每条提问——含轮次号、时间戳,中途引导(steer)消息带
steer 标记。点击行(或刻度)即滚动到那一轮并闪一下高亮。session.loadOlder(),上限 40 页)直到匹配出现或历史到底。user / steering 两类 Chat Node:空白输入、纯图片输入、工具行、
注入上下文都不进目录。[data-conversation-scroll])的几何而不是窗口,
并用 ResizeObserver 跟随——被侧栏/详情列/侧卡底部面板压缩列宽时
rail 跟着移动而不被压住,也不需要抢 z-index。localStorage['dsh-session-toc:pinned'](沿用旧独立插件
的 key,合并前固定过的状态继续生效)。settings.yaml 的 conversation-rollback 段,web 与 desktop profile 共用
——不是单浏览器开关。设置服务不可达时 rail 保持默认(开)并在行内说明,
绝不会因为读不到设置就把功能藏掉。开关行与 rail 本身都跟随 harness 的
语言切换,无需刷新。两种回退操作都是不可撤销的破坏性操作:原回复及其后的所有消息会被永久 删除。
POST /api/conversation-rollback
{ "sessionId": "...", "atSeq": <完成轮次内任一 seq> }{ "operation": "edit", "sessionId": "...", "turn": <turn number>, "text": "..." }{ "operation": "settings.get" } →
{ "ok": true, "outline": true, "revision": 0 }{ "operation": "settings.update", "patch": { "outline": false }, "expectedRevision": 0 } → 同一形状;命名空间已被别处改动时返回
{ "ok": false, "code": "settings-conflict", ... }。以上都不是的 operation 仍按回退分发,既有调用方不受影响。宿主没有设置服务时
settings.* 返回 settings-unavailable,rail 保持默认(开)。
web profile 的 DSH 环境(dsh web),或 DSH Desktop
应用(使用 desktop profile)。PATH 中有 pnpm,供 dsh plugin 管理插件使用。git;只有使用 npm pack 方式时才需要
npm。desktop 与 web 是两份独立组合,各有自己的 package.json +
node_modules。装完不生效,最常见的原因就是把插件装进了另一份。
探测当前运行进程使用的 profile——抓首页找 Desktop 标记:
# bash / macOS / Linux — <port> 替换成 DSH_WEB_URL 里的端口
curl -s "http://127.0.0.1:<port>/" | grep -o dsh-plugin-desktop
# PowerShell / Windows
(Invoke-WebRequest "http://127.0.0.1:<port>/" -UseBasicParsing).Content | Select-String "dsh-plugin-desktop"
命中说明该进程由 Desktop 外壳承载——用 --profile desktop;没有命中说明
是普通的 dsh web 进程——用 --profile web。
dsh plugin --profile <web|desktop> add github:sharedcare/dsh-conversation-rollback#<sha-or-tag>
dsh plugin 会把包加入所选 profile,并自动注册 bundle patch 层。建议锁
commit 或 tag,避免后续推送悄悄改变实际运行的代码;v1.4.0 tag 指向
commit 5de8731。
维护自己的 fork 时,把 sharedcare 换成你的 GitHub 用户名,或使用完整
仓库地址(锁点追加在 git URL 末尾):
dsh plugin --profile <web|desktop> add "git+https://github.com/<owner>/dsh-conversation-rollback.git#<sha-or-tag>"
合并产物已提交,且本包不声明 prepare 脚本,所以 github: 安装拉取
源码但不会运行构建——不需要 pnpm allowBuilds 授权。
适合二次开发,或希望自行打包的场景:
git clone https://github.com/sharedcare/dsh-conversation-rollback.git
cd dsh-conversation-rollback
方式 A:直接把当前 checkout 链接进 profile(适合边改边调试;改动后执行
pnpm run build 再刷新页面即可):
dsh plugin --profile <web|desktop> add link:$PWD
方式 B:先打包,再安装生成的 tarball:
npm pack
dsh plugin --profile <web|desktop> add ./conversation-rollback-1.5.1.tgz
(文件名以 npm pack 输出为准——当前版本是 1.5.1。)
之前单独装过独立版 dsh-session-toc 的话务必先卸掉,否则合并包会
挂出两条目录 rail:
dsh plugin --profile <web|desktop> remove dsh-session-toc
web profile 若在 bundle patch 时代之前装过:profile 的
cordis.patch.yml($DSH_HOME/profiles/web/cordis.patch.yml,默认
~/.dsh/profiles/web/cordis.patch.yml)里可能还留有旧方案的手工
- insert: conversation-rollback 行——删掉;安装后的 bundle patch 会
自动插入该条目,手工行会和它重复。
基于 git/link 安装的升级:先 remove,再按第 2 步用目标 commit/tag
重新 add。
重启 DSH Web 进程 / Desktop,以加载 host 路由和浏览器端 client。(只有
新增/删除插件需要重启;lib/client.js 是宿主按请求读盘的,改产物
不需要重启。)
web profile:
dsh plugin --profile web list
dsh web --dump-config | grep conversation-rollback
配置 dump 中应出现 bundle 分节,以及 id: conversation-rollback 条目。
Desktop(外壳没有 --dump-config——在运行中的页面里直接探测被服务的
bundle;dsh-toc-root 是 rail 样式表的根类名)。模块加载器每个 entry
只服务一个 combo URL(/plugins/??<id>/client.js&rev=<rev>,rev 取自
window.__DSH_BOOT__),所以不要猜路径,问页面:
// DSH 页面上的 DevTools 控制台(页面本身已带 auth cookie)
await fetch(__DSH_BOOT__.entries.find(e => e.id === 'conversation-rollback').url)
.then(r => r.text())
.then(t => ({ status: 200, hasRailCss: t.includes('dsh-toc-root'), bytes: t.length }))
期望 hasRailCss: true。若回退按钮正常但 rail 缺失,说明客户端 bundle
是旧版——强制刷新浏览器页面后再试。
dsh plugin --profile <web|desktop> remove conversation-rollback
卸载后重启 DSH Web 进程 / Desktop。
模块加载器每个插件 entry 只服务一个客户端 bundle
(/plugins/<id>/client.js),factory 里的 require 只能解析共享模块表
(react、react-dom/client、被 inject 的 @deepseek-ai/*),所以两个功能
不可能留成两个 bundle——src/ 是手写源码,lib/ 是已提交的产物。
| 文件 | 角色 |
|---|---|
src/client.rollback.js | rollback 的 client bundle(上游原文 + 下方唯一一处 FORK DEVIATION) |
src/session-toc.js | rail 的 factory body(外壳已剥掉) |
lib/client.js | pnpm run build 的产物,不要手改 |
lib/index.js | 宿主半(路由、重写、live 手术、设置命名空间) |
lib/chunk-rows.js | 内置移植的 dsh-session 内部物理行编解码器 |
tools/merge-client.mjs | 拼接 / 反拼接工具 |
test/chunk-rows.mjs | 宿主 codec 往返测试(pnpm test) |
test/host-route.mjs | 宿主半身路由 + 设置命名空间测试(pnpm test) |
test/host-stubs.mjs | 宿主测试通过 module hook 加载的内存 import 桩 |
test/smoke.mjs | 无浏览器冒烟测试(pnpm test) |
pnpm run build # src/client.rollback.js + src/session-toc.js -> lib/client.js
pnpm test # node --check lib/*.js + 无浏览器冒烟
pnpm run build:strip # 反操作:lib/client.js -> src/client.rollback.js
rail 为什么要包进自己的 IIFE:两半都在 factory 作用域里声明
function apply,裸拼接是合法 JavaScript 且后声明者静默胜出——
rollback 的三处 slot 注册会直接消失,不抛任何错。build 不是 npm 生命
周期脚本,安装本包不会触发(会被触发的只有 prepare,本包故意没有)。
产物为什么要入库:github: 安装拉的是源码且不会运行 build,作者要么
提供自包含的 prepare(用户还得在 profile 的
pnpm-workspace.yaml 里写 allowBuilds: { conversation-rollback: true }
才允许跑——等于授权该包在用户机器上执行代码),要么直接分发产物。这里选
后者:零构建、零授权,.gitignore 明确写了不许忽略 lib/。
与上游的唯一偏差在 src/client.rollback.js(标了 FORK DEVIATION):给它
注入的 <style> 补上 data-plugin / data-plugin-css——dsh-client-hmr
热替换只回收这两个属性匹配的样式表,不打标记每次重建都会多留一份旧 CSS。
lib/client.js 被别处改过时:merge 与 strip 是精确互逆(往返字节一致),
生成段用 /* == session-toc: BEGIN/END ... == */ 成对标记框住,冲突可以
整体挪出这个特性:
git merge <上游> # 冲突落在 lib/client.js
node tools/merge-client.mjs --strip # 先摘掉生成段,冲突面缩回纯 rollback
# 在 src/client.rollback.js 上解决冲突(或直接取上游版本),然后:
pnpm run build && pnpm test
生成器在锚点(exports.apply = apply; 与
exports.name = "conversation-rollback"; 的整行)缺失或不唯一时报错
退出,不会产出一个少一半功能的 bundle;整行锚点也保证不会吞掉上游那行的
缩进。smoke.mjs 钉住合并本身:两半各自的注册都在、rollback 的 user
节点接管仍是 priority: -1、rail 的目录投影与向前翻页正常、prepend 时
保持读者视口位置、rail 抛错不拖垮 rollback、两份样式都带 HMR 可回收的
归属标记。
Desktop 宿主维护一个安装恢复账本,位置在
<DSH Desktop 数据目录>/plugin-install-recovery/state.json(macOS:
~/Library/Application Support/DSH Desktop/...;Windows:
%APPDATA%\DSH Desktop\...)。一次安装会停在
phase: "awaiting-restart",下一次安装会被
another plugin install recovery transaction is pending 挡下,而结清只能
靠重启 Desktop(启动健康确认)或在恢复页回滚——没有 CLI 提交命令。