lyc0110/dsh-loop-guard ↗★ 0

dsh-loop-guard

DSH llm/stream guard: detects reasoning or text output that degenerates into a periodic repetition loop and aborts the request instead of streaming until the user gives up. 适合需要防止模型因陷入无限字数循环而浪费Token和时间的用户。

Package
dsh-loop-guard
Compatibility
Unverified
Version
0.1.0
License
MIT
Last updated
Oct 21, 2026

Other repositories with this package name

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:lyc0110/dsh-loop-guard

配置

键默认含义
providers / models[]空 = 全部;非空则只对列出的生效
lineWindow400行级检测窗口(行数)
maxUniqueLines40窗口内不同行数上限
lineMinChars2短于它的行不计入
lineCheckEvery20每新增多少行判一次
probeChars96指纹长度
regionChars3072回看窗口
minOccurrences5指纹重复几次算退化
minTotalChars2048累计输出超过这个量才开始字符检测
checkEveryChars128每累计多少字符判一次
maxTotalChars0绝对上限,0 = 关
onDetect'throw'throw | end
dryRunfalsetrue = 只记日志不掐断(校准用)
logFile''非空则把命中追加写进该文件