npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ericality/dsh-cost-guard

v0.3.0

Published

Turn-end cost guard for DSH: conservative/aggressive dual-threshold fee reminders with session stats, prediction and subagent tree totals.

Readme

@ericality/dsh-cost-guard

Turn-end cost guard for DSH sessions — 回合结束费用提醒: 保守/激进双阈值评估, 状态气泡 + 结构化费用横幅 (kind=cost) + 未来回合预测, 配置项在设置卡内编辑。

安装

npm i @ericality/dsh-cost-guard

需 dsh (DeepSeek Harness) 宿主环境;作为宿主插件加载 (server 插件 + web 客户端 bundle, 见 dsh.client.inject)。

功能

  • turn/end 后计算本回合/累计费用并按两套并行规则评估 (任一条件超限 → 建议切换):
    • 保守 (省钱优先): 回合 >0.40元 | 累计 >3.00元 | 上下文 >180k | 回合 >15
    • 激进 (效率优先): 回合 >1.20元 | 累计 >7.00元 | 上下文 >400k | 回合 >30
  • 三态合成: A 双切「建议切换」(每回合显示) / C「丰俭由人」(变 C 首次显示一次) / B 不显示; 附带灰气泡 (running→ok) 与未来 N 回合预测对比。
  • 累计口径为树聚合 (cumTree = 自身 + 全部 subagent 后代; dsh-cost-tree 缺失 → 自动降级单会话口径)。
  • 估算实测优先 (会话事件 request/header + <system-reminder>), 不依赖固定常量; 统计写入宿主数据目录状态文件。
  • 命令: /costguard-test (验证计算, 不推送外部通知) / /costguard-stats (查看统计, 只读)。
  • 配置唯一入口 = 设置 > 本地插件 > 费用提醒 卡 (经 /costguard-cfg RPC, 读取链 默认←patch←卡内覆盖, 即时生效)。

数据路径

状态文件默认落宿主数据目录 (DSH data dir), 均可用环境变量覆盖:

| 用途 | 默认 | 覆盖环境变量 | |---|---|---| | 定价缓存/展示节奏 | /data/dsh/cost-guard-state.json | DSH_COST_GUARD_STATE_FILE | | 回合统计 | /data/dsh/cost-guard-stats.json | DSH_COST_GUARD_STATS_FILE | | 会话 projcache | /data/dsh/storages/session_projcache.json | DSH_COST_GUARD_PROJCACHE_FILE | | 设置卡 overrides | /data/dsh/cost-guard-settings.json | COST_GUARD_SETTINGS_FILE | | 调试日志 | 关闭 | DSH_DEBUG_LOG (完整文件路径, 非空才写) |

依赖

  • peer (宿主提供): @deepseek-ai/dsh-session, @deepseek-ai/schemastery, @deepseek-ai/dsh-client-runtime, react
  • dependencies: @ericality/dsh-reconcile (幂等对账)。
  • optionalDependencies: @ericality/dsh-cost-tree (树聚合; 缺失自动降级)。
  • 横幅渲染依赖同仓插件 @ericality/dsh-notice-banner

许可

MIT