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-server-deck

v0.3.0

Published

DSH 能力插件:服务器卡片仪表盘——实时状态/CPU/内存/磁盘 + 趋势记录与可视化(1h/24h/7d/30d) + 点卡片进入 xterm 交互终端

Readme

DSH Server Deck 🖧

DeepSeek Harness 的服务器卡片仪表盘 —— 已连接服务器的卡片视图(在线状态 / CPU / 内存 / 磁盘 / 延迟),点卡片进入 xterm.js 交互终端;独立趋势视图记录并可视化一段时间的 CPU / 内存 / 磁盘变化。

Awesome DSH Plugin dsh-plugin npm license

⭐ 欢迎点星收藏

如果 server-deck 帮到了你,欢迎到 GitHub 仓库 点个 Star ⭐,让更多 DSH 用户看到它。问题与建议请提 Issue。

📋 兼容性

| 插件版本 | 状态 | 对应 DSH | |---|---|---| | 0.3.x(当前主线) | ✅ | 0.1.5-rc.1 / 0.1.5-rc.2(及之后的 0.1.5 线;页签走官方原生右侧栏) | | 0.2.x | 🔧 维护态(仅修 bug) | DSH ≤ 0.1.2-rc.1(仍兼容 0.1.1-rc.2 / 0.1.2-alpha.4;better-sidebar 页签或独立抽屉) |

本次升级功能变化

  • 页签宿主迁移:DSH 0.1.5+ 优先注册官方原生右侧栏(ctx.sidebarRightTabs),better-sidebar 降为旧宿主回退,独立抽屉兜底不变。
  • 官方已有的交给官方:不画赞踩、不画交付文件卡。服务器页签、PTY、指标卡新旧两线都在。
  • 0.3.x 在 DSH 0.1.2 + better-sidebar 上 页签会退化成独立抽屉;要旧页签请留在 0.2.x。

✨ 功能一览

卡片式服务器仪表盘

每台服务器一张卡,状态一目了然:

| 元素 | 说明 | |---|---| | 🟢🟡🔴⚪ 状态点 | 在线(带呼吸光晕)/ 离线 / 探测中 / 未知 | | 系统信息行 | OS 名称(Linux PRETTY_NAME / macOS 回退)、运行时长、核数、握手延迟 | | 三条用量条 | CPU · 内存 · 磁盘,<60% 绿 / ≥60% 黄 / ≥85% 红 | | 错误详情 | 离线时内联展示失败原因(悬停看全文) |

自动刷新周期可选 手动 / 10s / 15s / 30s / 60s(读主机侧快照,不再现场 SSH);「刷新」按钮强制立即探测一轮。

📈 趋势视图

卡片与趋势两个独立视图互相切换(不是叠在卡片里)。每台主机 CPU / 内存 / 磁盘各一张独立图(不叠线):

| 项 | 说明 | |---|---| | 窗口 | 1 小时(滚动,默认)/ 24 小时(滚动)/ 一周 / 一个月(本地自然日 0 点起,含今天)/ 自定义(≤31 天) | | 粒度 | 自动 / 10s / 30s / 1m / 5m / 15m / 1h;单次查询上限 1200 点,超限自动升档 | | 摘要 | 最新值 + 窗口均值;悬停竖线读该时刻数值,tooltip 含最高 / 最低 / 样本数 | | 采集 | 主机侧常驻,默认 10s(可选 30s / 1m / 5m),与面板是否打开无关;离线也记一条用于画断档 | | 落盘 | ~/.dsh/server-deck-metrics/{hostId}/:raw 3h、1m 24h、15m 7d、1h 31d;删除主机级联清理 | | 历史回填 | 窗口早于本地记录时,尝试 sar -u / sar -r(sysstat)回填 CPU / 内存;磁盘容量无法回填 |

打开「服务器」页签 → 点工具栏「📈 趋势」。窗口默认 1 小时滚动;「24 小时」也是滚动过去 24 小时,不是当天 0 点起。刚启用时图上可能只有右侧一小段,等几个采集周期就会铺开。

⌨ 点卡片进交互终端

xterm.js 全功能终端:5000 行回滚、256 色、窗口尺寸实时同步、光标闪烁。Node 半区做 WebSocket ↔ ssh2 shell 双向桥。

⤓ 一键导入 ~/.ssh/config

解析标准 ssh config(Host / HostName / User / Port / IdentityFile / ProxyJump),自动:

  • 跳过通配条目(Host *)与已存在主机;
  • 跳过 Git 托管平台密钥别名(如 Host github.com-xxx / User git——它们不是可管理的服务器);
  • 多别名行(Host 1.2.3.4 prod-gw)优先取语义化别名做展示名。

+ 手动添加主机

密码 / 私钥文件(+口令)/ SSH Agent 三种认证;连接测试按钮即时反馈延迟。

🔀 双形态挂载

| 环境 | 形态 | |---|---| | 安装了 dsh-better-sidebar | 注册为侧边栏「🖥 服务器」页签(order 45),原生 tab chrome、设置页开关、visible 门控轮询 | | 未安装 | 自绘右侧可展开/收起面板:右缘竖条开关 + 拖缘调宽,宽度持久化 |

装载顺序无关:client 入口不声明强制依赖,由内层动态子插件等待服务就绪后注册页签并自动收起独立面板。

📦 安装

# 方式〇:npm 安装(推荐)
dsh plugin --profile web add dsh-server-deck

# 方式一:从 GitHub 直接装(dsh CLI,免 npm)
dsh plugin --profile web add github:meyaomiao/dsh-server-deck

# 方式二:克隆后本地挂载
git clone https://github.com/meyaomiao/dsh-server-deck.git
cd dsh-server-deck && pnpm install && pnpm build
dsh plugin --profile web add .

安装后重启 dsh web(host 半新增了路由与常驻采集器),浏览器 Ctrl+F5 强刷。侧边栏「+」菜单出现「服务器」页签即成功。

🔐 安全模型

  • 所有 API 与 PTY 升级路由仅回环放行(127.0.0.1/::1),防 DNS rebinding 与局域网直连;
  • 密码 / 私钥口令单独存放 ~/.dsh/server-deck.secrets.json(0600),台账文件不含秘密,API 响应永不回传;
  • 删除主机仅移出台账并断开连接池,不会在远端执行任何操作;
  • 指标采集通过一段只读 POSIX sh 探针(固定交给 /bin/sh,不经过登录壳)。Linux 读 /proc,兼容 Ubuntu / Debian / RHEL / Alpine / Arch(含 fish、zsh 登录壳);macOS 走 Darwin 回退。解析失败的字段显示「—」。

🏗️ 架构

┌─ Client(lib/client.js)──────────────────┐   ┌─ Host(lib/index.js)─────────────────────┐
│ 官方原生栏/better-sidebar 页签 ⇄ 独立抽屉 │◄──│ /server-deck/api/*  REST(仅回环)         │
│ React 卡片网格 / 趋势图 / 表单 / xterm.js │WS▶│ /server-deck/ws/pty ws↔ssh2 PTY 桥      │
└─────────────────────────────────────────┘   │ ssh2 连接池 · 台账 ~/.dsh/*.json         │
                                              │ MetricRecorder 常驻采集(默认 10s)        │
                                              └─────────────────────────────────────────┘

🛠️ 开发

pnpm install
pnpm build       # esbuild:server bundle + client bundle(ModuleLoader 包装)
pnpm typecheck   # tsc --noEmit
pnpm test        # ssh config / 探针解析 / 台账校验 / 窗口粒度 / sar 回填 / 时序落盘

改仓库前先读 CONTRIBUTING.md(Issue → 分支 → Draft PR)。思考原则见 AI-ISSUE-WORKFLOW.md

License

MIT