XiaoYuOvO/dsh-llm-injection-filter0

dsh-llm-injection-filter

DSH LLM response-stream injection/pollution filter: hard-block rare Unicode scripts (Track A) and score-based disposal of control chars / protocol markers / script mixing / spam keywords (Track B) on the llm/stream waterfall.

包名
dsh-llm-injection-filter
版本
1.0.0
许可证
MIT
最近更新
2026年8月18日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:XiaoYuOvO/dsh-llm-injection-filter

配置

const CFG = {
  enabled: true,                 // 总开关
  hardBlockRareScripts: true,    // 轨道 A:罕见脚本 → 直接中断(最高优先级,无视 mode)
  allowedScripts: ['Latin', 'Han', 'Common', 'Inherited'], // 允许脚本白名单,可追加 'Thai' 等放行
  checkReasoning: false,         // 是否对 reasoning-delta 也做轨道 A 检测(默认关)
  mode: 'audit',                 // 轨道 B:'audit' | 'strip' | 'reject'
  minScore: 100,                 // 轨道 B 触发阈值
  applyToProviders: [],          // 空 = 全部 provider;可填 ['openai']
  extraPatterns: [],             // 额外正则字符串(编译失败捕获并报错,停用该规则,不炸流)
  extraKeywords: [],             // 额外关键词
  maxScanLen: 16384,             // 轨道 B 单段扫描长度上限
  maxSampleLen: 120,             // 审计样本截断长度
  recordMaxLen: 8192,            // 中断记录中载荷详情(delta / 已累积 arguments)的截断长度
}