DeepSeek Harness Plugin Hub

发布与管理完整 Harness Profiles,发现适合你的插件。

探索

插件目录环境预设文档中心动态

社区

发布插件联系我们报告问题

相关链接

Plugin Hub GitHubDeepSeek Harness 官方项目系统状态隐私说明
© 2026 DeepSeek Harness Plugin HubPowered byPaxTech

独立、非官方社区项目,与 DeepSeek 官方无隶属、授权或背书关系。

Loop Rescue — DeepSeek Harness 插件(DSH Plugin)
DeepSeek Harness Plugin Hub
ProfilesPlugins分类动态文档登录管理 Profiles
ProfilesPlugins分类动态文档登录
← Plugins
L

dsh-loop-rescue

Loop Rescue

在流式生成过程中中断模型重复循环,从已提交的消息中移除循环内容,并自动继续生成的 DSH 插件。

插件会安装到这里;不确定时保持 web。

npx -y @deepseek-ai/dsh plugin --profile web add github:citydirector/dsh-loop-rescue#b3a5c90d32a73fb1555fbac8fc2cdd830af1d011
README兼容性版本

兼容性与来源证明

Loop Rescue 以 dsh-loop-rescue 发布,当前版本为 0.1.0。Plugin Hub 会校验它的 manifest,并保存精确安装来源,便于复现安装结果。

DSH 兼容范围
*
运行环境
any
发布来源
github
Registry 更新时间
2026/10/17

版本

0.1.0stable
2026/10/17

相关插件

正在加载相关插件…

最新版
0.1.0
DSH
*
HMR
重启进程
Tree shaking
未声明可安全裁剪
解包体积
未提供
文件数
未提供
Surface
any
许可证
MIT
发布源
github
GitHub
★ 0
周下载
0
最近提交
2026/10/17
查看源码 ↗
README Badge

点击下方 Badge 复制 Markdown,粘贴到 README 即可。

这是你的 Plugin?认领权益 · 优先安全扫描

验证 package.json 声明的 GitHub 仓库,即可管理这个公开页面。认领后,Hub 会优先安排当前版本的安全扫描,并在通过后公开展示结果。

认领这个 Plugin →
报告问题

相关插件

继续浏览 models-usage 分类下经过校验的插件。

Usage@linxin666/dsh-usage用于 dsh Web GUI 的使用统计插件:检测各提供商的余额和编程套餐配额,并实时记录令牌使用情况;侧边栏 Settings 行上方显示紧凑的价格概览卡片Client Ui Model Capabilities@linxin666/dsh-client-ui-model-capabilities为自定义 pi-ai 提供商声明每个模型的能力(图像输入和推理力度),可直接在 Models 设置卡片中编辑;写入官方 llm-pi-ai 设置命名空间,不更改 DSH 源代码。Cost Meterdsh-cost-meterDeepSeek Harness 会话费用统计插件:本会话成本、当日费用、历史记录与官方价格同步,支持多厂商多模型价格计费(内置 170+ 模型 ID 价格目录与自动匹配)、主流 Coding Plan 订阅额度查询与显示(14 家,含 WorkBuddy 官方积分、OpenDesign 工作区查询、含小米 MiMo Token Plan 控制台 Cookie 查询、SCNet Token Plan 本地 Credits 计量与火山方舟 Volcano Ark Coding Plan AK/SK 签名查询Codex Subscriptiondsh-codex-subscription在 DeepSeek Harness 中通过 OAuth 使用 ChatGPT 和 Codex 订阅,支持配额、安全重置、网络搜索、图像和快速模式,并可通过 ChatGPT 移动应用(Beta)控制 DSH

README

dsh-loop-rescue

English · 简体中文

A loop-rescue plugin for DSH (DeepSeek Harness). When the model falls into repetition (Now. / OK. / Emit. / Producing. rotations, the same paragraph over and over), it cuts the stream from the inside, prunes the loop out of what gets written to the session log, and resumes automatically.

The difference from a plain cut-off: the interrupted message that goes into the next turn's context contains no loop, so the model never re-reads its own repetition and carries on repeating.

Requires DSH 0.1.7 or newer. Pure JS, no build step.

Quick start

Use this or @mrweicodes/dsh-loop-guard, not both: with both on, loops get cut twice.

  1. Install: sidebar Plugins → Add plugin, and give it
    https://github.com/citydirector/dsh-loop-rescue
    
    Switch it on.
  2. The defaults work as they are. To watch before it acts, set mode to observe (see Configuration).

From the command line:

dsh plugin --profile web remove @mrweicodes/dsh-loop-guard
dsh plugin --profile web add -w github:citydirector/dsh-loop-rescue#v0.1.0

Restart dsh web after a command-line install. No pnpm build scripts need approving.

Configuration

The defaults work as they are. To change them, write to the profile's cordis.patch.yml:

- set:
    - id: loop-rescue
      config:
        mode: rescue              # rescue: cut + prune + resume | cut: cut + prune | observe: log only
        watch: both               # both | reasoning | text
        marker: true              # leave a "〔N chars of repeated reasoning removed〕" line where it pruned
        maxConsecutiveRescues: 3  # cap on back-to-back rescues; one normal call resets it
        stallCalls: 3             # nudge after this many reasoning-only calls with no output; 0 = off
        stallMinReasoningChars: 1024
        retryTemperature: 1.0     # temperature for the resume request; unset = unchanged
        retryReasoningEffort: low # reasoning effort for the resume request; unset = unchanged
        retryRequests: 1          # how many requests after a resume use the two settings above
        language: auto            # auto | zh | en
        detector:                 # detection thresholds; rarely need changing
          poolWindow: 30
          poolMinCoverage: 0.75
          cycleMinChars: 600

Consider running mode: observe for a day or two first, check that every loop-rescue: ... loop detected line in the log is a real loop, then switch to rescue.

How it works

When the agent loop assembles an assistant/message, each block's final content comes from the block-end payload, not from the deltas streamed before it. The plugin wraps the model call in the llm/stream waterfall:

  1. It runs a streaming detector on every reasoning and text block.
  2. On a hit it closes every open block: the looping block is replaced by its content pruned back to where the loop started (optionally with a one-line marker), and the stream ends with stop.
  3. The message written to the log holds only the useful content before the loop. The raw stream is still kept in full in the event's stream record, where the trajectory view can show it.
  4. Once the turn has really ended (whenIdle()), it sends a resume message with a correction via followup().
  5. The first N requests after a resume can use a different set of sampling parameters.
  6. After the cap on back-to-back rescues it stops resuming and leaves a note.

Why not edit the session afterwards: an assistant/message cannot carry sourceEventSeqs, so the session surface's replace operation cannot swap one assistant message for another. Pruning at block-end is the only way that keeps message roles and tool-call pairing intact.

Detection rules

RuleCatchesPrunes from
Phrase pool pool≥75% of the last 30 sentences are a handful of recurring short phrases (in any order)Back to where that batch of phrases first appeared
Verbatim cycle cycleThe tail is the same text repeated verbatim, period 16–4000 chars, ≥3 repeats, ≥600 chars in totalKeeps the first copy, prunes from the second

Guarding against false positives:

  • A Chinese full stop always ends a sentence; an English period only when followed by whitespace.
  • Symbol-only lines (|---|, }) are not counted.
  • List items, table rows and quote lines in the text are not counted.
  • The inside of ``` code blocks in the text is skipped entirely.
  • The phrase pool needs at least two different phrases rotating.
  • It never cuts while an open block holds a tool call: closing a half-written tool call would make the host run it with incomplete arguments.

Offline scan

Replay past sessions through the same detector the plugin uses, to see where it would cut:

node tools/scan-session.mjs <session file or directory>          # hits only
node tools/scan-session.mjs <session file or directory> --all    # hits and misses
node tools/scan-session.mjs <session file> --json

Reads plain jsonl and zstd-compressed session files (zstd needs Node 22.15+). The script only depends on src/detector.js and runs on plain node.

Cleaning loops already in the history

The plugin only stops new loops; loops already committed to the history keep being imitated by the model. What DSH sends the model is a frozen projection of the session log, which a plugin cannot change, so the session files have to be cleaned offline with DSH fully closed. This works for old sessions that never had the plugin too.

The recommended tool is dsh-session-manager (dsm loops, a single-file exe on Windows): the same detection rules, plus upgrading, archiving and repairing broken sessions.

This repository also ships a lightweight script (Node 22.15+, v4 sessions only):

node tools/clean-session.mjs            # list sessions with loops, pick by number; Enter = newest
node tools/clean-session.mjs --dry-run  # show what would change
node tools/clean-session.mjs --undo     # restore from the backup
  • On Windows you can also double-click tools\clean-session.cmd, or drop a session folder onto it; if it cannot find the data directory, pass --data <data directory>.
  • Only matching assistant/message events change: text and reasoning are cut back to where the loop started, data.stream is cut to match, and the message's source.replayState is removed. Every other line stays byte-for-byte the same.
  • It backs up to <data directory>\sessions-loop-rescue-backup\ first, and refuses while DSH is running (--force skips that check; not recommended).
  • Versions before 2026-10-17 read only the first frame of a compressed log and wrote the result as a single frame, which DSH treats as corrupt and hides. That is fixed; dsm repair brings hidden sessions back.

Known limitations

  • Loop text already streamed into the chat is replaced by the pruned version once the message is committed, but exactly how it redraws depends on the DSH front-end version.
  • Loops that span steps (every step is "say a line → call the same tool") are out of scope; that is the job of the built-in guard/repeat-tool-reminder.
  • retryTemperature needs an adapter that supports temperature. DSH has no generic field for Ollama's repetition penalty and similar parameters, so they cannot be set from here.

Development

npm install
npm test

Related projects

  • dsh-remote-access-proxy: Use DSH from your phone, tablet, or another computer
  • deepinfra-fusion-proxy: DeepInfra Standard / Flex switching with automatic fallback, per session
  • dsh-session-manager: Offline session manager: upgrade, archive, trash, loop cleanup, broken-tail repair

License

MIT