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

@lnsiaxe/dsh-web-restart

v0.1.0

Published

Ensure or rotate the DSH web server (detached) when this bundle is loaded in a profile

Readme

dsh-web-restart

一个 DeepSeek Harness (dsh) bundle 插件: 确保 / 重启 dsh web 服务。加载即生效——服务挂了自动拉起;需要换新代码时一键脱管重启。

背景

dsh 的 agent 运行在 web 服务进程内部。如果 agent 直接 Stop-Process 杀掉 web 服务, 等于杀掉自己所在的进程树,重启命令永远执行不到后半段("自杀式重启")。 本插件通过 WMI Win32_Process.Create 把新服务进程创建在 WMI 宿主下, 完全脱离 agent 进程树,重启后依然存活。

功能

| 模式 (mode) | 行为 | |---|---| | ensure(默认)| 端口未监听 → 脱管启动 web 服务;已监听 → 不动 | | rotate | 已监听 → 脱管重启(等调用方返回后 kill 再拉起);未监听 → 直接启动 |

另外支持 flag 文件触发重启:在 web profile 内运行时(此时服务必然在跑), 创建 <DSH_HOME>/dsh-web-restart.flag,下一个会话回合开始时插件会删除 flag 并脱管重启服务, 用于加载新插件/新代码。

安装

# Install from npm (requires dsh >= 0.1.0-rc.6)
dsh plugin --profile headless add @lnsiaxe/dsh-web-restart   # 服务挂了之后,跑一次 headless 任务即可复活 web 服务
dsh plugin --profile web add @lnsiaxe/dsh-web-restart        # 启用 flag 触发重启

# Restart dsh web; the plugin activates on boot
dsh web

本地开发(fork 修改后自用):

dsh plugin --profile headless add file:<你的插件目录>
dsh plugin --profile web add file:<你的插件目录>

使用

# 服务挂掉后:headless 启动,插件在 boot 时自动拉起 web 服务
dsh --profile headless "启动 web 服务"

# 在 web profile 里请求重启(换新代码后):
#   1) 创建 flag:  New-Item C:\Users\<you>\.dsh\dsh-web-restart.flag
#   2) 发一条消息触发新回合 → 插件自动脱管重启

配置(cordis.patch.yml)

- insert:
    - id: web-restart
      name: '@lnsiaxe/dsh-web-restart'
      config:
        port: 3080        # web 服务端口
        mode: ensure      # ensure | rotate
        # workspace: C:\Users\<you>\my-workspace  # 可选,默认取进程 cwd
        # gitDir: C:\Users\<you>\git\cmd  # 可选,默认 ~\git\cmd(给 side-panel 的 git 用)

工作原理

  1. 激活时把 dsh-web-restart-launch.cmd / dsh-web-restart-rotate.cmd 生成到 DSH_HOME:
    • launch.cmd:设置 DSH_HOME/PATH(含 git),cd 到工作区,以 node …\lib\bin.js web --port <port> 前台运行并重定向日志
    • rotate.cmd:ping 延时让调用方安全返回 → kill 3080 监听进程 → 调用 launch.cmd
  2. 通过 powershell Invoke-CimMethod Win32_Process.Create 启动脚本——新进程父进程是 WMI 宿主, 不在 agent/服务进程树内,因此不受进程树回收影响。
  3. 服务本身在 web profile 里加载本插件时(argv 含 web),自动跳过自重启,仅响应 flag。

非 Windows 平台回退为 spawn(..., { detached: true }).unref()。

相关

  • dsh-side-panel:本插件的配套面板(Git 审查 / 文件 / 终端)。 它曾有一个"打开面板后聊天区消失"的布局 bug(issue #1), 可参考该 issue 的修复思路。

许可证

MIT