DeepSeek Harness Plugin Hub

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

探索

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

社区

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

相关链接

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

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

Session Budget Guard — DeepSeek Harness 插件(DSH Plugin)
← Plugins
S

dsh-session-budget-guard

Session Budget Guard

DeepSeek Harness 的按会话树预算和消耗速率熔断器:当某棵树的支出或消耗速率超过限制时,拒绝下一次模型请求或委派。

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

npx -y @deepseek-ai/dsh plugin --profile web add github:erya2000/dsh-session-budget-guard#4ed01121c139c9a6c981b1cfb4a54d687cb98b49
README兼容性版本

兼容性与来源证明

Session Budget Guard 以 dsh-session-budget-guard 发布,当前版本为 0.1.0。Plugin Hub 会校验它的 manifest,并保存精确安装来源,便于复现安装结果。

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

版本

0.1.0stable
2026/9/16

相关插件

正在加载相关插件…

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

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

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

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

认领这个 Plugin →
报告问题
DeepSeek Harness Plugin Hub
ProfilesPlugins分类动态文档登录管理 Profiles
ProfilesPlugins分类动态文档登录

相关插件

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

Usage@linxin666/dsh-usage用于 dsh Web GUI 的使用统计插件:检测各提供商的余额和编码计划配额,并提供实时令牌使用记录,同时在侧边栏条目中显示当前会话提供商今日的使用量Usage Stats@ychris12138/dsh-usage-statsdsh Web GUI 的令牌使用热力图、提供商余额和订阅配额Codex Connectdsh-codex-connect用于 DeepSeek Harness 的 ChatGPT OAuth 和 Codex 模型。Ui Usage Billing@kenz1117/dsh-ui-usage-billingDeepSeek Harness 的用量计费仪表板:侧边栏成本指标和完整的仪表板模态窗口,依据当前多提供商目录定价,并汇总会话日志中的实际用量。

README

dsh-session-budget-guard

English | 中文

A per-session-tree budget and burn-rate circuit breaker for DeepSeek Harness.

One prompt can fan out into a tree of subagents that all spend money at once. This plugin watches each tree — the root session plus every subagent descendant — and refuses the next model request (or the next delegation) when either the tree's total spend or its spend rate crosses a limit you set.

- insert:
    - id: session-budget-guard
      name: dsh-session-budget-guard

Why it exists

On 2026-09-16 a single session ("research a robot dog for the farm") fanned out three levels deep: 3 subagents, then 14, then 28 — 3 494 model calls in 20 minutes, 2 266 of them web searches. It cost ¥82 and drained the API balance; the Harness had no per-session budget, and a cumulative budget alone would have been too slow to matter, because the tree was spending roughly ¥4/minute.

That is why there are two independent gates: cumulative spend and spend rate.

Install

dsh plugin --profile web add dsh-session-budget-guard     # npm (once published)
dsh plugin --profile web add github:erya2000/dsh-session-budget-guard

Or mount it by path from a local checkout (no install step):

# ~/.dsh/cordis.patch.yml
- insert:
    - id: session-budget-guard
      name: /absolute/path/to/dsh-session-budget-guard/lib/index.js

Restart the Harness once after installing (patch layers apply live, but the first mount of a new package needs a boot).

Configuration

Every key is optional; the defaults live in lib/rules.js. Unknown keys are logged and ignored rather than silently dropped.

KeyDefaultMeaning
modenotifynotify = log + notify only. enforce = also refuse the next step, deny over-quota delegations/searches and stop the tree.
enabledtrueMaster switch.
treeWarnCny20Warn once per tree at this cumulative spend.
treeStopCny50Stop the tree at this cumulative spend.
rateWarnPerMin4Warn when the tree grows faster than ¥4/min.
rateStopPerMin8Stop the tree when it grows faster than ¥8/min.
windowsSeconds[60, 180]Sliding windows used for the rate, in seconds.
maxDelegationDepthnull (off)Deepest allowed subagent depth. 1 means subagents may not spawn subagents.
maxTreeNodesnull (off)Most subagents allowed in one tree.
maxSearchesPerSessionnull (off)Most web_search/web_fetch calls allowed per session.
dailyWarnCny / dailyStopCny100 / 300Reported in warnings for the whole day across trees.
stopStreak2Consecutive over-limit checks before acting.
notifyCooldownSeconds300Minimum gap between notifications for the same tree.
notifyautoauto (macOS: osascript), none, or a shell command template containing {text}.
exchangeRate7.2Used to convert the cost-meter ledger (USD) into CNY.
/

A configuration tuned for enforcement (this is what the incident above led to):

config:
  mode: enforce
  treeWarnCny: 5
  treeStopCny: 10
  rateWarnPerMin: 1.5
  rateStopPerMin: 3
  maxDelegationDepth: 1
  maxTreeNodes: 6
  maxSearchesPerSession: 40

What it does when a limit is hit

  1. agent/pre-step returns {kind:'reject'} — the next model request never happens, so a stopped tree stops costing money immediately.
  2. tools/pre-execute returns {kind:'deny', reason} for a new subagent / subagent_fork / workflow call past the structure limits, or for a web_search/web_fetch past the quota. The reason is model-visible, so the agent adapts instead of retrying blindly.
  3. Descendants are interrupted deepest-first, then the session turn is cancelled (keepInbox, so queued messages survive).
  4. The event is written to the log, and a notification is sent.

In notify mode only step 4 happens.

Where the numbers come from

  • If the dsh-cost-meter plugin is mounted, the guard reads its ledger through the costMeter service (complete history, user-edited prices; the ledger is USD and is converted with exchangeRate).
  • Otherwise the guard prices calls itself from the llm/stream waterfall using DeepSeek list prices (peak/off-peak, Beijing time) — no dependency, but the totals start when the plugin loads.

Lineage (which session is whose subagent) is read from each session log's first record — id, parentSession, origin, delegationDepth — plus the live session store. Message content is never read.

Limits

  • It is an in-process guard: it stops a tree that is running, it does not resurrect accounting after a Harness restart.
  • notify mode is the default. Turning on enforce means the plugin will cancel a session; tune the thresholds to your own traffic first (run in notify for a day and read the log).
  • Rate limits need at least one sample older than the window, so the first minute of a fresh guard cannot trip on rate — cumulative and structure limits still apply.
  • Plain forks (origin=fork) are deliberately excluded from tree aggregation.

Tests

node --test

18 tests cover the rule engine (lineage, tree aggregation including cycles, sliding-window rate, threshold decisions, waivers, structure gates) and the plugin wiring against a fake host (reject/deny behaviour, search quota, own llm/stream accounting).

License

MIT

statePath
logPath
$DSH_HOME/state/...
Where persistent state and the log live.