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

@loneyclown/dsh-plan-quota

v0.1.1

Published

Generic coding-plan / API quota widget for the dsh web GUI: configurable providers (Kimi For Coding, DeepSeek balance, custom endpoints) shown as draggable floating pills in the shell.overlay layer.

Readme

@loneyclown/dsh-plan-quota

English | 中文

DeepSeek Harness Web GUI 的通用编程套餐 / API 额度悬浮组件。每配置一家供应商,页面上就多一颗小药丸(如 5h 52% │ 7d 11%),可自由拖拽,点击展开详情卡片。不绑定任何平台——供应商配置方式对齐 cc-switch 的 Token Plan 预设。

特性

  • 通用供应商配置 — 内置 Kimi For Coding(kimi-coding-plan,5 小时 + 每周双窗口)和 DeepSeek 余额(deepseek-balance)预设,另有 custom 预设用点路径字段映射适配任意接口
  • 密钥不出宿主进程 — 浏览器只访问插件自己的 /api/plan-quota 路由;密钥每次请求时经 dsh credentials seam 解析(也可直接写 apiKey 配置项)
  • 极简占位 — 只有药丸;用量 > 50% 变黄、> 80% 变红;失败的供应商变灰,原因见悬浮提示
  • 可拖拽 + 持久化 — 自由拖拽并钳制在视口内;位置和展开状态经 localStorage 跨刷新保留
  • 自动刷新 — 按配置间隔轮询(默认 5 分钟,0 关闭),卡片上另有手动刷新按钮
  • 按浏览器语言切换中英文界面

安装

dsh plugin --profile web add @loneyclown/dsh-plan-quota

装完重启 dsh web。未配置供应商时插件保持不可见。

配置

没有 GUI 入口——配置就是一个文本文件。 用任意编辑器打开 web profile 的补丁文件:

~/.dsh/profiles/web/cordis.patch.yml      # Windows: C:\Users\<你>\.dsh\profiles\web\cordis.patch.yml

(~/.dsh 即 $DSH_HOME,dsh 的数据目录。注意它不是设置弹窗里「打开配置文件」按钮打开的那个 settings.yaml。)追加一段 plan-quota 配置——profile 补丁会整体替换该插件行的 config,所以 providers 列表要写全:

- id: plan-quota
  config:
    refreshSeconds: 300        # 轮询间隔秒数;0 = 仅手动刷新
    timeoutSeconds: 10
    providers:
      - id: kimi               # 每行供应商对应一颗药丸
        preset: kimi-coding-plan
        provider: kimi-coding  # dsh 模型供应商 key:自动继承密钥、baseUrl、显示名
      - id: deepseek
        label: DeepSeek
        preset: deepseek-balance
        baseUrl: https://api.deepseek.com
        credential: DEEPSEEK_API_KEY

保存即生效——web profile 热重载补丁文件,药丸几秒内出现或变化,无需重启。改坏了(比如 YAML 语法错误)会被拒绝,最后一个正常版本继续运行,界面不会崩。

复用 dsh 模型供应商

provider 填 dsh 模型设置里的供应商 key(llm-pi-ai 命名空间,即「设置 → 模型」里配的那个)。插件每次请求时继承它的 displayName、baseURL 和 apiKeyEnv,在设置界面改完即刻生效,无需重启。供应商行里显式写的 label / baseUrl / credential 优先于继承值。

官方内置的供应商(如 kimi-coding)可以零额外配置:密钥自动取自官方登录写入的凭据记录——模型设置里填的 API key,或「Sign in with Kimi Code」OAuth 订阅授权的 access token——baseUrl 由预设提供规范默认值。OAuth token 过期时药丸变灰,等 harness 下次实际调用该供应商自动刷新后恢复。

密钥解析顺序:apiKey → credential 引用 → llm-pi-ai/<provider> 凭据记录 → 继承的 apiKeyEnv 引用。

密钥

credential 是 dsh credentials seam 的引用名(KIMI_API_KEY 这类 POSIX 风格名字)。两种方式提供:启动 dsh 时设置同名环境变量,或写入 $DSH_HOME/.credentials.yaml 的 refs 下。也可以在供应商行里直接写 apiKey。

自定义供应商

      - id: my-api
        label: My API
        preset: custom
        baseUrl: https://example.com
        endpoint: /usage            # custom 必填
        credential: MY_API_KEY
        auth: bearer                # 或 none
        mapping:                    # JSON 返回里的点路径
          - key: hour
            label: 1h
            usedPath: data.hour.used      # 百分比 0-100
            resetPath: data.hour.reset    # ISO 时间
          - key: plan
            label: Plan
            textPath: data.plan           # 原样展示

每个 segment 至少提供 usedPath / textPath 之一;resetPath 可选。

卸载

dsh plugin --profile web remove @loneyclown/dsh-plan-quota

工作原理

宿主半边在 dsh web 服务器上注册 GET /api/plan-quota,查询所有供应商(各自独立成败——一家失败不影响其他),把返回归一化成 segment,回一个 JSON 信封。浏览器半边是一个 dsh.client web bundle,把药丸栈渲染进 shell.overlay 插槽并轮询该路由。

开发

pnpm install
pnpm typecheck
pnpm test
pnpm build        # 产出 lib/index.js + lib/client.js(随仓库提交,支持 git 安装)

许可证

MIT