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-ledger

v0.3.1

Published

Per-session cost ledger for DSH: auto-books each finished turn into a per-session ledger and shows a foldable banner card with totals, deltas and live history.

Readme

@ericality/dsh-cost-ledger

Per-session cost ledger for DSH — 会话账本: 回合结束自动记账, 每回合注入一张可折叠的 ledger 横幅卡片 (合计/差值/计算细则), 历史按会话独立保存并经 RPC 实时拉取。

安装

npm i @ericality/dsh-cost-ledger

需 dsh (DeepSeek Harness) 宿主环境;作为宿主插件加载 (server 插件, 无 client bundle)。

功能

  • turn/end 后自动记账 (projcache tokenUsage × 定价, 含推理 tokens), 按会话 id 分桶保存 (每会话最多 50 条, 不全局共享)。
  • 每回合注入一张 ledger 青绿横幅卡 (独立 context, 不替换): 合计/本回合差值/计算细则 + 历史快照; 默认折叠不刷屏。
  • 客户端展开卡片经 /cost-ledger RPC 实时拉取共享账本 (零 token), RPC 失败回退卡内静态快照。
  • 有 subagent 后代时卡片附"含子 agent"统计行 (树口径, 各后代账本最新合计; dsh-cost-tree 缺失自动降级)。
  • 幂等对账 (attachReconcile): 宿主重启被掐断的回合在会话恢复时只补"被中断的尾回合"。
  • 定价链: 30min 状态缓存 → 官方定价页 → 内置常量。

数据路径

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

| 用途 | 默认 | 覆盖环境变量 | |---|---|---| | 会话账本 | /data/dsh/cost-ledger.json | DSH_COST_LEDGER_FILE | | 定价缓存 | /data/dsh/cost-ledger-state.json | DSH_COST_LEDGER_STATE_FILE | | 会话 projcache | /data/dsh/storages/session_projcache.json | DSH_COST_LEDGER_PROJCACHE_FILE | | 调试日志 | 关闭 | DSH_DEBUG_LOG (完整文件路径, 非空才写) |

依赖

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

许可

MIT