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

@changqingguo/dsh-peak-valley-indicator

v1.0.1

Published

Peak/valley electricity-time indicator beside the Session Log in the DSH Web header. Red light during peak hours (09:00-12:00 & 14:00-18:00 local time), green otherwise.

Readme

@changqingguo/dsh-peak-valley-indicator

English | 中文

DSH Web 的峰/谷电价时段指示灯。在页面右上角会话头部、Session log 按钮旁边,加一个会呼吸闪烁的红/绿小灯 + 文字标签 + 实时时钟,让你一眼看出当前是用电峰时还是谷时。

  • 峰时(红灯):工作日 09:00–12:00、14:00–18:00
  • 谷时(绿灯):其余所有时段——含周末(周六/周日)全天(最新政策)

峰/谷按浏览器本机当地时间判断,因此自动跟随你的时区(如北京时间)。无需配置,不占用任何提示面、零 token 开销。

Session log   [● 峰时 14:30]      ← 红灯呼吸 + 红色文字
Session log   [● 谷时 21:08]      ← 绿灯呼吸 + 绿色文字

功能

  • 客户端:在 conversation.session.header.utilities 槽位注册一个条目——即会话头部右侧的工具行,与 Session log 同一行。该条目渲染一个紧凑胶囊:一个 10 px 呼吸灯(峰时红、谷时绿)+ 峰时/谷时 文字 + 每秒跳动的 HH:MM 时钟。峰/谷由浏览器本地时区的 new Date().getHours() 计算。CSS 通过一个 <style data-plugin> 标签注入一次,随插件卸载而清理。
  • 宿主侧:无操作占位(apply 为空),仅用于让 loader 为这个纯客户端行构建一个有效的 host fiber。不注入服务、不注册命令、不发事件。

安装

把包装进你的 DSH Web profile,然后重启 dsh web:

# 推荐:直接从 npm 安装(发布后)
dsh plugin --profile web add @changqingguo/dsh-peak-valley-indicator

# 或从仓库安装(开发调试)
git clone https://github.com/ChangQGuo/dsh-peak-valley-indicator.git
dsh plugin --profile web add link:$(pwd)/dsh-peak-valley-indicator

本包自带挂载行(cordis.patch.yml),无需手动改 patch——重启 dsh web 后指示灯自动出现在 Session log 旁边。

也可以作为普通 overlay 行写进你的 profile patch(~/.dsh/profiles/web/cordis.patch.yml):

- insert:
    - id: peak-valley-indicator
      name: '@changqingguo/dsh-peak-valley-indicator'

配置

无。峰谷时段硬编码在 lib/client.js 的 isPeak 里:

return (h >= 9 && h < 12) || (h >= 14 && h < 18);

改这个表达式并重新部署即可调整峰/谷时刻表。

导出形态

纯客户端 Cordis 插件:浏览器侧导出 inject: ["slots"] 与 apply,由 apply 调用 ctx.slots.inject("conversation.session.header.utilities", …) 注册胶囊。宿主侧导出无操作的 apply、inject: []、name: "peak-valley-indicator"。无默认导出,也无公开 Service。

模型体验

提示与工具面

模型看到什么

什么也看不到。插件不注入提示段落、不注册工具、也不发 session 事件——它只是一个纯展示型浏览器小部件。

Token 影响

每个请求为零。

KV 缓存影响

无系统提示贡献,因此对缓存稳定性无影响。

已知限制与待办

  • 仅 Web:指示灯渲染在 DSH Web 的会话头部;暂无 TUI 等价物。
  • 时刻表硬编码:峰谷时段写死在源码里(09:00–12:00、14:00–18:00),无运行时配置;改 lib/client.js 后重新部署即可。
  • 仅当地时间:按浏览器本机时区判断,不锁定某个时区。本机时间为北京时间的机器上,即跟随北京时间。
  • 纯展示:无持久化、无设置页、无按会话状态——时钟在浏览器端每秒重算。