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-sessions-cost

v0.2.0

Published

Multi-session cost report for DSH: /sessions-cost computes per-session spend within a recent-hour window from session logs (peak/off-peak pricing).

Readme

@ericality/dsh-sessions-cost

Multi-session cost report for DSH — 多会话费用统计: /sessions-cost [小时数] 在时间窗口内按会话日志逐事件统计 token 与费用 (分高峰/低谷计价), 结果以可折叠横幅展示, 支持子 agent 树分组。

安装

npm i @ericality/dsh-sessions-cost

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

功能

  • 命令 /sessions-cost [小时数] (默认 24, 支持小数, 上限 8760): 本地计算近 N 小时窗口内各会话费用。
  • 匹配"窗口内有 token 消耗"的会话; 解码会话日志 (多 zstd 帧) 逐事件统计输入/缓存命中/输出+推理, 按事件时刻分高峰/低谷计价。
  • 每会话明细每种类型一行 (token × 单价 = 金额), 高峰/低谷分档; 结果以 notice/banner 横幅 (kind=costs 天蓝家族, 默认折叠, 展开手风琴全量不省略可滚动) 展示, 零 token (非 surface 事件)。
  • 树分组: 窗口内存在 subagent 委托结构时, 行级标注 treeGroup {parentSid?, childCount} + 每行窗口内树合计 (每行只算自己不双计), 客户端树形分组渲染; 库缺失/无结构 → 平铺 (兼容)。
  • 定价链: 官方定价页解析 (12s 超时, 不调计费 API) → 30min 状态缓存 → 内置常量。

数据路径

数据源默认指向宿主数据目录 (DSH data dir), 可用环境变量覆盖:

| 用途 | 默认 | 覆盖环境变量 | |---|---|---| | 会话清单/标题/最后活动 (projcache) | /data/dsh/storages/session_projcache.json | DSH_SESSIONS_COST_PROJCACHE_FILE | | 会话日志根目录 | /data/dsh/sessions | DSH_SESSIONS_COST_SESSIONS_ROOT | | 定价缓存 | /data/dsh/sessions-cost-state.json | DSH_SESSIONS_COST_STATE_FILE |

依赖

  • peer (宿主提供): @deepseek-ai/dsh-session
  • optionalDependencies: @ericality/dsh-cost-tree (树分组标注; 缺失自动降级平铺)。
  • 横幅渲染依赖同仓插件 @ericality/dsh-notice-banner

许可

MIT