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

dsh-scope

v0.1.0

Published

Codex-style context visibility for DeepSeek Harness: live context-window occupancy, composition breakdown, KV-cache hit rate, and a GitHub-style 53-week usage heatmap

Readme

dsh-scope

dsh.so security License: MIT

English · 简体中文

DeepSeek Harness(dsh)的上下文可视化插件 —— 每个会话的 Codex 式 /context 透镜 + 全历史的 GitHub 式用量热力图。

一个插件,两处 UI:

  1. Context Lens(会话头部)—— 实时 context 窗口占用率(system / tools / messages 分段构成条)、四桶会话累计、KV 缓存命中率。数据全部来自官方 token-meter 会话投影(useProjection)—— 无 RPC、无自定义协议。
  2. 用量热力图(侧边栏底部)—— GitHub 贡献图风格的滚动 53 周 token 用量网格。点击任意日期查看四桶明细、缓存命中率、会话数、模型排行。数据来自本插件自己的回环聚合端点。

截图

用量热力图

为什么做

DeepSeek Harness 把措辞和上下文当一等工程对象,但自带 Web UI 既不显示 context 占用也没有用量历史。dsh-scope 按 harness 原生方式补上这两个缺口:读平台已经算好的投影、用平台的设计 token(--dsw-alias-*)、走平台的 slot 注册体系 —— 明暗主题零媒体查询都正确。

安装

需要 dsh0.1.0-rc.6 在 PATH 上。

dsh plugin --profile web add dsh-scope
dsh web                             # 重启 dsh 加载插件
git clone https://github.com/helloxkk/dsh-scope.git
cd dsh-scope
npm install && npm run build
node scripts/install.mjs web        # 或: node scripts/install.mjs <profile>
dsh web                             # 重启 dsh 加载插件

安装脚本把 lib/cordis.patch.ymlpackage.json 复制进 profile 的 node_modules,并向 profile 的 cordis.patch.yml 追加 bundle insert(幂等,每次 rebuild 后可重复执行)。

卸载

rm -rf ~/.dsh/profiles/web/node_modules/dsh-scope
# 再从 ~/.dsh/profiles/web/cordis.patch.yml 删掉 "# dsh-scope" 块
rm -f ~/.dsh/storages/dsh-scope-cache.json   # 可选:清掉 fold 缓存

工作原理

浏览器半lib/client.js,通过 package.json 的 dsh.client 声明被发现):

  • conversation.session.header.actions(order 30,排在任务列表之后)渲染透镜触发器:占用率圆环 + 实时百分比。弹出面板读取三个官方投影 —— tokenUsage(整个持久日志累计的四桶)、contextPressure(输入侧窗口压力 + 路由的 context window)、contextBreakdown(下一次请求的 system/tools/message 启发式构成)。
  • sidebar.footer.action 渲染热力图触发器(侧栏展开显示文字,收起显示图标)。弹出面板同源 fetch GET /api/dsh-scope/days

宿主半lib/index.js):一个只读、仅回环的端点。聚合是增量的:每会话 fold 状态缓存在内存并持久化到 ~/.dsh/storages/dsh-scope-cache.json;每次请求只 fold 上次之后新增的事件。活跃会话 fold 内存尾部;持久会话用存储后端的不透明 revision 和 readFrom(id, fromSeq),带连续性检查,日志被重写则全量重 fold。稳态成本 O(新增事件),日志再大也不变慢。

Fold 语义对齐 dsh-token-metertokenUsage 投影:usage 样本挂在 assistant/chunkdata.chunk.type === "usage")或 assistant/messagedata.usage)上;同一 (turn, step) 的重复样本替换旧值而非重复计数,并重新归因到后一事件所在的日期与模型。模型归因跟随 assistant/messagedata.message.source,回退到最近的 request/header 配置。

不外发任何数据:端点在任何处理前拒绝非回环调用者和非 GET 方法,不读取任何 provider 凭据。

开发

npm run build                          # tsdown: 宿主 ESM + 浏览器 ModuleLoader bundle
node scripts/fixture-session.mjs       # 可选: 写一条带 usage 事件的演示会话日志
node scripts/install.mjs web && dsh web

兼容性

基于 dsh 0.1.0-rc.6@deepseek-ai/dsh-base / dsh-web-app bundle)构建并验证。harness 处于开发者预览阶段迭代很快 —— 预期会有破坏性变更。

许可

MIT