CNyaotian-Lunar/dsh-peak-gate ↗★ 0

dsh-peak-gate

DeepSeek Harness 峰谷守门(peak gate):高峰时段拦重活、压缩输出上限、工具预算、峰时精简输出;含中国法定节假日自动日历与一键放行口令。 适合需要在高峰期节省Token、控制工具预算并自动避开工作日高峰的用户。

Package
dsh-peak-gate
Compatibility
Unverified
Harness peer range
*
Version
0.2.0
License
MIT
Last updated
Sep 25, 2026

Other repositories with this package name

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:CNyaotian-Lunar/dsh-peak-gate

配置 / Configuration

命名空间 peak-gate,写在 ~/.dsh/profiles/web/cordis.patch.yml,热改即时生效,无需重启: English: The namespace is peak-gate, written in ~/.dsh/profiles/web/cordis.patch.yml; hot edits take effect immediately, no restart needed:

peak-gate:
  enabled: true
  mode: block                       # block 真拦 | notify 只提醒 | off 关闭
  peakWindows: ['09:00-12:00', '14:00-18:00']   # 北京时间
  beijingOffsetMinutes: 480         # UTC+8
  weekendOffPeak: true
  officialProviders: []             # 空 = 所有 provider 都管;填 ['deepseek-official'] 则只管网关外的官方路由
  brevitySection: true              # 峰时注入「精简输出」提示段
  bigTaskTokens: 6000               # 本次新输入估算超过它 = 大任务(只算新输入,不算会话历史)
  bigTaskChars: 20000               # 字符数兜底
  sessionPressureTokens: 0          # >0 时:会话上下文压力超它也算大任务(默认关)

  # —— 第 1 层:白名单直通(只判轻,没有黑名单) ——
  lightKeywords: [算一下, 计算, 求解, 解方程, 数学, 证明, 天气, 几点, 是什么, 为什么, 解释一下, 翻译, …]
  lightKeywordMaxChars: 120         # 输入超过这么多字符就不认白名单

  # —— 第 2 层:模型分类 ——
  useModelClassifier: true          # 关掉就退回「只看输入大小」
  classifierProvider: ''            # 留空 = 用本会话上一次请求的 provider
  classifierModel: ''               # 留空 = 用本会话上一次请求的 model
  classifierTimeoutMs: 3000         # 超时按轻活放行
  classifierMaxTokens: 6            # 只够吐一个字母
  classifierReasoningEffort: off    # 必须关推理:否则思考会吃光上面那 6 个 token,答案吐不出来
  classifierMinChars: 20            # 短于它就不花这次调用
  classifierMinTokens: 15

  # —— 第 3 层:工具预算 ——
  peakMaxSteps: 12                  # 峰时单轮工具步数预算;0 = 关掉这条

  forceToken: '!force'
  peakMaxTokens: 32768              # 峰时主 agent 输出上限,0 = 不限
  subagentMaxTokens: 16384
  manageSubagents: true             # 是否管子代理(输出上限 + 是否拦)
  blockSubagents: false             # 是否真拦子代理的大任务(默认不拦,免得主任务断掉)
  onBlock: replace                  # replace | reject
  warnOncePerSession: true          # 仅 reject 方式有意义
  dryRun: false                     # 只记日志不真拦

想调「多严」就动这三处:useModelClassifier(要不要模型判)、peakMaxSteps(工具预算)、 classifierMinChars(多长的输入才值得花一次分类)。

English: To tune "how strict" it is, touch these three: useModelClassifier (whether the model judges at all), peakMaxSteps (the tool budget), and classifierMinChars (how long an input must be to be worth one classification).

想看自己的 provider 叫什么?日志里每次拦截都会打印 provider=...,照着填白名单即可。

English: Want to know what your provider is called? Every block prints provider=... in the log; just copy that into the allow-list.