Short-Arm-Ape/dsh-sensitive-replace ↗★ 0

dsh-sensitive-replace

敏感字符自动替换:按用户维护的 YAML 屏蔽表(全局 / 按 Provider ID / 模型,默认 $DSH_HOME/sensitive-blocklist.yaml)在内容进入会话上下文前替换命中字符,规避 DeepSeek 官方 Content Exists Risk 400(v0.7.0:兼容 DSH 0.2.0-rc.x,无需版本豁免;屏蔽表形态告警 + 规则级命中计数) 适合需要规避 DeepSeek 官方敏感词拦截报错 400 的用户。

Package
dsh-sensitive-replace
Compatibility
Unverified
Harness peer range
^0.1.0-rc.6 || ^0.2.0-rc.1
Cordis peer range
^4.0.1
Version
0.7.0
License
MIT
Last updated
Oct 10, 2026

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Short-Arm-Ape/dsh-sensitive-replace

配置覆盖

按行 id 覆盖(用户 patch 层在 bundle 层之后,后者生效):

- id: sensitive-replace
  config:
    enabled: true
    autoReplace: true
    detectUnfiltered: true
    blocklistPath: /abs/path/to/sensitive-blocklist.yaml
    replaceWith: '[BLOCKED]'

配置(profile cordis.patch.yml 里按行 id 覆盖)

键类型默认说明
enabledbooleantrue总开关(工具面 + 自动面)
autoReplacebooleantrue进上下文前自动替换(agent/pre-step + tools/post-execute)
dispatchScrubbooleantrue出网前清洗整份请求(深拷贝后替换,含历史 / 模型输出 / tool-call 参数 / system)
detectUnfilteredbooleantrue未开启 dispatchScrub 时的只读扫描:仍有命中就记警告
recoverOn400booleantrue400 时开启加硬清洗并 retry(对话保持连续)
aggressiveMsnumber600000加硬清洗持续时长(ms)
aggressivebooleanfalse常开加硬清洗(不等 400 也额外剥离 emoji / 符号)
maxRecoveriesnumber210 分钟窗口内最多自动重试几次(防 400 循环)
blocklistPathstring$DSH_HOME/sensitive-blocklist.yaml屏蔽表文档路径
replaceWithstring[BLOCKED]替换占位符——含 {n} 时按规则序号编号(便于还原),明示内容被屏蔽而非静默删除

replaceWith 用进 tool-call 参数时会自动做 JSON 转义,不会把参数弄成非法 JSON。