给 DeepSeek Harness WebUI 加 /bridge 命令,把已有内容的会话迁移到另一套工具 preset,零侵入、原会话保留。
- 语言
- JavaScript
- License
- MIT
- 分支
- main
安装
$ dsh plugin --profile web add github:Totoro-qaq/dsh-plugin-bridge在终端中运行以上命令,通过 dsh CLI 安装此插件。可在右上角切换 Profile。 第一次用 dsh?看这篇新手教程
对话式安装
帮我安装 DeepSeek Harness 插件 Totoro-qaq/dsh-plugin-bridge:先查看仓库 https://github.com/Totoro-qaq/dsh-plugin-bridge.git 确认安全性,然后执行安装命令并验证插件加载成功。
把这段指令粘贴给 DSH Web GUI 里的助手,由它代你完成安装与验证。
一句话定位
给 DeepSeek Harness WebUI 加一条 /bridge 命令:把已经聊出内容的会话压缩成一份固定五段摘要,在新工具 preset 下开新会话继续,原会话原地保留。
核心能力
- 在任意会话输入框里输入
/bridge,即可把这个会话迁到其他工具 preset(minimal / standard / code 等),原会话保留不动 - 迁之前先预览一份交接摘要(目标 / 当前状态 / 关键决策与约定 / 关键文件 / 下一步),确认无误再
--go执行 - 摘要写成本地临时文件,可直接编辑后用
--file走"改完再执行"路径,避免模型来回传话 - 目标会话默认先复述理解、再暂停等你确认;加
--continue让复述和下一步合并在同一轮请求 - 已有识图分析进入摘要时逐字搬运,不经过摘要 worker 改写;未解析原图在 rc.8 下可随首轮提示发给视觉目标
- 自带
/bridge --doctor自检:直接列出当前 host 暴露了哪些网关方法、当前模式、生效配置
技术实现
- 语言: TypeScript (Node.js, ESM)
- 关键依赖:
@deepseek-ai/cordis(peer)、@deepseek-ai/schemastery(配置 schema) - 架构模式: 注入宿主进程的
commands与apiProxy两个 cordis 服务;命令注册用 effect disposer,卸载时命令随 fiber 一起消失 - 执行引擎: 进程内
ctx.apiProxy(不走 HTTP,但同时提供 CLI 通过回环 HTTP 走同一套代码),整条迁移链路不出进程 - 入口文件:
src/index.ts(apply 注册/bridge命令)/src/command.ts(命令分派:preview / migrate / doctor)
适用场景
你在「通用」模式聊到一半,发现接下来要写代码——模式切换是锁的(因为不同 preset 工具集不兼容,会留下幽灵调用)。Bridge 是那个出口:把当前进展压成摘要,新预设开新会话继续,原会话原地保留。不适合会话刚起步(没什么可带的)或只是想换模型、调整思考强度(这本来就能在会话内切)。
前置依赖与兼容性
| 依赖 | 最低版本 | 说明 |
|---|---|---|
| DSH | 0.1.0-rc.6+ | rc.6 / rc.7 / rc.8 均逐条核对接口;rc.8 多了持久图片附件读取的可选能力 |
| Node.js | ≥ 22 | 仓库 CI 覆盖 Node 22 / 24 |
| 平台 | 跨平台 | 无原生模块、无操作系统限制 |
| 原生模块 | 无 | 纯 Node 标准库(fs / os / path) |
安装方式
dsh plugin --profile web add github:Totoro-qaq/dsh-plugin-bridge
配置项
默认无须配置即可工作。需要定制时改 ~/.dsh/profiles/web/cordis.patch.yml 里的 dsh-plugin-bridge 块,或设置对应环境变量。
| 配置 | 类型 | 说明 | 默认值 |
|---|---|---|---|
modelTier | flash / current / pro | 压缩摘要工人用的模型档位;pro 失败方差更小,不建议用 flash 迁 minimal | pro |
sourceCharBudget | 数字 | 压缩取材总字符预算(约 30K tokens 输入) | 60000 |
summaryCharBudget | 数字 | 交接摘要正文字符预算(约 900 tokens) | 2400 |
goalRounds | 数字 | 新会话挂为 goal 的自主轮次上限;上游默认 256 轮会自动跑空,Bridge 强制收口 | 1 |
inject | goal / prompt / both | 摘要注入方式:goal 是可恢复的目标,prompt 是首轮提示;both 同时挂 | both |
lang | zh / en / auto | 摘要输出语言;auto 跟着会话内容走 | auto |
workerProvider | 字符串 | 强制指定压缩模型所在 provider(换了 provider 的部署用) | "" |
workerModel | 字符串 | 强制指定压缩模型名 | "" |
previewTimeoutMs | 数字 | /bridge <preset> 等压缩工人的超时上限 | 180000(3 分钟) |
常见问题
Q:安装后必须重启 dsh web 吗?
A:必须。插件在 dsh web 启动时挂载;装好后在输入框里打 /bridge 没反应,多半是没重启。重启后 commands 服务和 apiProxy 服务都到位,命令才会出现。
Q:升级了 DSH 之后还能用吗?
A:先打一次 /bridge --doctor。它会逐项列出 13 个网关方法哪个可用、当前 preset、生效配置;如果缺方法,会直接点名那个方法名,把这行连同你的 DSH 版本号发到 issue 即可。rc.6 / rc.7 / rc.8 都核对过,主链路方法表完全一致。
Q:迁移后新会话"记得"多少?
A:pro 档位下 8 次跑 95% 可用。丢的最常见的是数字被补全成常见值(端口被改写成 3000/8080 之类),所以预览那一步重点扫数字和路径。fix-version 0.2.4 把"旧值复活"作为关键词显式阻断,6 份独立摘要 + 12 个目标会话的关键事实 100% 命中。
Q:为什么不在原会话直接切 preset?
A:上游在网关层硬锁,且锁得对:历史里的工具调用只在原工具集下合法;中途换 preset 会留下新 preset 无法执行的"幽灵调用",容易静默劣化。Bridge 选择搬家而非绕锁。新会话是干净的,复述理解后由你确认。
Q:迁移花多少钱?会让正常会话变贵吗?
A:只安装不迁移时,对正常会话 0 prompt token 贡献——/bridge 是 host 的 slash 命令,不注册技能、不注册工具,命令结果不进模型历史。压缩工人实测约 1.6K 输入 + 0.7K 输出;默认确认模式额外花一个只复述的确认轮,--continue 把复述和工作合并在同一目标轮。token 大头仍是后续 agentic 工作。
Q:摘要里数字或路径错了怎么办?
A:预览会自动把摘要写进一个临时文件并打印路径。直接用编辑器打开那个文件,改正数字或路径,保存后跑 /bridge code --go --file <路径> 即可用改过的摘要执行。文件是唯一事实源,比让模型"记住你刚才说要改哪里"可靠。
Q:迁移后不满意怎么回退?
A:原会话一个字符都没动过,直接点回原会话继续;新会话归档即可。Bridge 不写原会话、不动工作区文件;新会话是在新 preset 下起的"另一个会话"。
Q:和 TotoroPilot 是什么关系?
A:TotoroPilot 是 GUI 弹窗形态,调用同一套迁移流水线;本插件本身可以直接在官方 WebUI 用 /bridge。两者走的是同一份 migrate.ts 编排。
上手难度
入门 — 一条命令安装、重启一次、在输入框里打 /bridge <preset> 就能用;默认配置覆盖绝大多数场景,仅在需要调整压缩档位或多轮 goal 时才动配置。
已知问题与限制
- 官方 WebUI 安装后目前需要重启一次,并且不允许插件自动跳转到新建会话;Bridge 会在结果里打印新会话的准确标题和 session ID,需要手动切换
- 默认 DeepSeek 文本模型仍不能读图;Bridge 只保留已有视觉证据,绝不暗中运行本地小视觉模型;rc.8 持久附件不可复用时降级为"未解析"提示
- 预览通常耗时 20–60 秒,受
previewTimeoutMs(默认 180 秒)上限保护;超时会被取消并以已产出文本兜底 - 迁移会新建目标会话(占一个工作区槽位),不是原地替换;workspace 已知超额的环境要先清理
- 升级 DSH 后若主链路方法缺失,迁移会失败——打
/bridge --doctor即可定位 - release acceptance 是小样本、修复驱动(每 cell 仅 1 次),不应理解为总体准确率保证
English | 中文
Move a produced DeepSeek Harness session to another tool preset through a previewable, fixed-schema handoff. The original session stays untouched.
Quick start · Safety and cost · Accuracy · How it works · Compatibility
Quick start
dsh plugin --profile web add github:Totoro-qaq/dsh-plugin-bridge#v0.2.5
# restart dsh web once
Then type in the official WebUI:
/bridge list available target presets
/bridge code preview the handoff; changes nothing
/bridge code --go migrate, restate, then wait for confirmation
/bridge code --go --continue restate and start work in the same target turn
The preview is editable. If a number or path is wrong, edit the printed summary file and run:
/bridge code --go --file <path>
Uninstall with dsh plugin --profile web remove dsh-plugin-bridge, then restart dsh web.
Verified on the official rc.8 WebUI (2026-08-20): clean install, plugin load,
standard → minimalpreview/migration, paused-goal persistence, and host restart. The package ships prebuiltlib/, so git installation needs no pnpm build-script allowlist.
Safety and cost
Bridge optimizes for high-fidelity, bounded-cost migration:
- Default — accuracy first: the target restates the handoff in one short turn and waits. You verify it before any work starts.
--continue— lower latency/cost: the target restates and begins the next step in the same model request.- In both confirmation modes, any stored goal is paused before kickoff. The goal driver cannot silently queue another model round.
- If pausing fails, Bridge fails closed: it cancels automatic startup and sends no kickoff.
- Installing the plugin adds zero prompt tokens to normal sessions.
/bridgeis a host slash command, not a model tool or skill. - Existing image analysis is copied verbatim outside the compressed summary. Only unresolved images may use vision tokens, and only when the target accepts images.
The release-acceptance run used one summary request per fixture. Confirm always reached first useful work in two target requests; --continue always did so in one. Token totals varied sharply with preset, output length, and cache state, so Bridge does not claim a universal percentage saving.
Observed across the fixed 12-cell release acceptance:
| Token measure | Nominal | Processed |
|---|---|---|
Confirm extra vs --continue, pooled summary + first useful work | +12.82% | +52.56% |
Confirm extra vs --continue, paired median | +8.1% | +65.6% |
| Summary worker share of the clean acceptance suite | 20.74% | 16.71% |
Nominal is the primary comparison. Processed weights cache-read tokens equally and is not a bill; the worker row is a composition share, not causal overhead versus a no-Bridge baseline.
Token definitions, ranges, and raw totals
Nominal = uncached input + output; processed also includes cache-read/cache-write tokens and is a sensitivity measure, not a bill. “Summary + first useful work” excludes the pre-existing source conversation and official compaction cost.
Across the six paired fixtures, confirm's nominal extra had a median of +8.1% and a range of -47.9% to +206.7%; target-only nominal extra had a median of +11.0% and a range of -74.7% to +1059.1%. The wide spread is why request count is the stable product claim—not a fixed token-saving percentage.
The six fixed summary workers used 19,551 nominal / 26,463 processed tokens. The 12 target sessions used 74,716 / 131,932. Counting each shared summary once, the clean acceptance components totalled 94,267 / 158,395 tokens. See the full report and raw JSON.
In short: the safe default deliberately spends a separate confirmation turn; --continue combines confirmation and useful work into one target turn without enabling a background goal round.
Accuracy
The default compression tier is pro. The latest rc.8 release acceptance covered 6 frozen fixtures and 12 target sessions:
| Measure | Result |
|---|---|
| Summary facts | 30/30 |
| Target restatement facts | 60/60 |
| First useful work facts | 60/60 |
| Critical facts | 90/90 |
| Obsolete-value resurrection | 0 |
| Exact confirm / continue request count | 6/6 · 6/6 |
This is a small, repair-driven release gate—not a statistical accuracy guarantee. It includes three 21-message sources with real compaction reuse plus three short sources, across minimal, standard, and code targets. Full methodology, raw token deltas, variability, and archive evidence are in the v0.2.3 baseline + fix report.
Earlier compression-tier benchmark
The earlier August 2026 benchmark remains useful for comparing compression tiers:
| Measure | Result |
|---|---|
| Summary fidelity | 97.5% test / 96.7% validation |
| Migrated fact usability | 87.5% test / 83.3% validation |
pro fact usability (8 runs) | 95% |
flash fact usability (8 runs) | 80%, including one total-loss run |
| Five-section schema compliance | 100% |
pro and flash cost nearly the same here; the reason for defaulting to pro is lower failure variance, not a statistically proven mean advantage. Numbers and ports remain the main drift risk, which is why preview and restatement are part of the product path.
See the earlier benchmark, A/B control, and known weaknesses.
How it works
fold history → generate five-part summary → preview/edit → create target session
→ pause stored goal → inject summary → restate (and optionally continue)
image history → copy associated assistant text verbatim; unresolved raw images use rc.8 capability fallback
The five sections are Goal, Current state, Key decisions & conventions, Key files, and Next step. Tool traces from the old preset are intentionally dropped: Bridge moves state, not incompatible tool history.
The original session is never rewritten. If the migration is unsatisfactory, return to it and archive the new session.
Images in rc.8: raw transfer vs verbatim evidence
Bridge uses an automatic, accuracy-first image policy:
- An image-only user message never disappears from source material.
- If the source turn has associated assistant text, Bridge appends that text verbatim under
Visual evidence; the summary worker cannot rewrite it. The preview deliberately calls it an associated response—not proof that every pixel was understood. - If no assistant text follows the image, Bridge marks it
Unresolved. On rc.8 it reads the durable source attachment and tries to include the raw image in the target kickoff. - An image-capable target receives the raw image plus the handoff. A text-only DeepSeek target rejects the image during host admission, before a message or model request is created; Bridge then sends the text handoff with an explicit unresolved warning.
- Raw images are not resent when verbatim evidence already exists, avoiding unnecessary visual-token and cache cost. Reattach the source image when the preserved response is insufficient for the next step.
The normal five-part summary remains bounded by summaryCharBudget (2,400 characters by default). Verbatim visual evidence has a separate 60,000-character budget and is admitted as whole blocks: Bridge may omit an older block with a visible warning, but never cuts an image-derived response in the middle. Copying existing text adds no model round; a successfully attached raw image is priced by the selected vision provider.
rc.6/rc.7 remain compatible through the text path. Raw attachment recovery is an optional rc.8 gateway capability and does not become a required /bridge --doctor method.
Why not switch the preset in place?
A preset is a system prompt, tool set, and plugin composition—not a tone setting. Tool calls already stored in the session are only valid under the composition that produced them. DeepSeek Harness therefore allows agentPreset.select only while a session is blank; changing it later would leave ghost tool calls that the new preset cannot execute.
Bridge respects that boundary by opening a clean target session and carrying only a bounded handoff. Model and thinking-effort changes remain separate and can still happen inside a session.
Official preset factory, @ session references, and TotoroPilot
- The official Agent Preset factory creates or configures presets for blank/future sessions. Bridge moves existing work into one of them.
- rc.8's
@reference attaches a bounded read-only snapshot of another session to the current session. Bridge creates a new session and removes old-preset tool traces. - TotoroPilot exposes the same migration pipeline through a GUI modal. The plugin itself remains usable directly in the official WebUI.
Compatibility and limits
Verified against DeepSeek Harness 0.1.0-rc.6, rc.7, and rc.8, Node.js 22 and 24. Run /bridge --doctor after a Harness upgrade; it names missing gateway methods instead of failing vaguely.
- The official WebUI currently needs one restart after install and cannot let a plugin navigate to the session it creates. Bridge prints the exact title and session ID.
- Default DeepSeek text models still cannot inspect images. Bridge preserves prior visual evidence and fails visibly when no reusable rc.8 attachment is available; it does not run a hidden local vision model.
- Preview normally takes 20–60 seconds and is bounded by
previewTimeoutMs. - Release acceptance now covers real compaction reuse, but only one run per cell; it should not be read as a population guarantee.
- The older tier-comparison benchmark predates prompt+goal dual injection and remains labeled as historical evidence.
For the full walkthrough, rollback checklist, configuration table, CLI path, and FAQ, read the Chinese usage guide.
Advanced CLI and configuration
dsh-bridge doctor
dsh-bridge preview --to code --session <id>
dsh-bridge migrate --to code --summary-file <path> --continue
Main settings: modelTier, sourceCharBudget, summaryCharBudget, goalRounds, inject, lang, workerProvider, workerModel, and previewTimeoutMs. Configure them in the profile's cordis.patch.yml or through the matching DSH_BRIDGE_* environment variables documented in the guide.
The default injection mode is both: the summary is stored as a resumable goal and included in the kickoff prompt. The goal is paused before kickoff in both confirmation modes.
Development
npm test # build + typecheck + 120 tests
npm run pack:check
CI verifies Node 22/24, generated lib/, datasets, package contents, and the narrow upstream RPC/command contract. Tests use a fake host and spend no model tokens. Evaluation is separate and uses your own local model credentials; see docs/benchmark.md.
License
MIT
收录徽章
[](https://deepseek-plugin.org/plugins/Totoro-qaq/dsh-plugin-bridge)把这段 markdown 粘贴到你的 GitHub README,链接回本插件详情页。徽章只声明已被本站收录,不代表安全认证。