← Back to home@Ruler4396

dsh-launcher-lifetime

DeepSeek Harness (dsh) plugin: control the dsh service lifetime (always-on / tray / follow-window) for the dsh-launcher shell

Stars
2
Language
TypeScript
Created
Aug 14, 2026
Updated
Sep 19, 2026

Introduction

dsh-launcher-lifetime

npm license GitHub

DeepSeek Harness (dsh) 插件:控制 node 服务的驻留——配合 dsh-launcher 壳,决定关闭窗口 / 托盘退出时 node 服务是继续运行还是退出。

为什么需要它

dsh 是一个完整的服务进程(几百 MB 内存)。默认情况下它常驻运行(秒开,但一直占内存)。本插件把"node 服务何时退出"的控制权交给你:

  • 想要省内存 → 关窗即停服务,下次启动自动拉起(约 1–3 秒)
  • 想要秒开 → 保持常驻
  • 想要折中 → 托盘驻留(关窗最小化到托盘,明确"退出"才停服务)

特性

  • 🎛️ 三种驻留模式:跟随窗口 / 常驻 / 托盘驻留
  • ⚙️ 配置入口:dsh 设置页的 "Node 服务驻留" 页面(竖排单选,即时生效);也可用 dsh 的 cordis 配置
  • 🪶 零运行时依赖:只写一个 JSON 文件,不加载任何第三方包
  • 🛡️ 安全:只停 dsh-launcher 壳自己拉起的服务,外部托管 / 手动启动的服务不受影响

工作原理

用户配置 → 插件写入 DSH_HOME\dsh-launcher\settings.json
                    ↓(每次关窗/托盘退出时读取)
        dsh-launcher 壳执行:继续运行 / 最小化到托盘 / 停止服务
值模式行为
0常驻(默认)服务一直运行,关窗/托盘退出都不停
1托盘驻留关窗最小化到托盘;托盘"退出"才停服务
2跟随窗口关窗即停服务并退出(最省内存)

安装

dsh plugin --profile web add dsh-launcher-lifetime

兼容性

逐版本兼容声明写在 package.json 的 dsh.compatibility.dshReleases(DSH STORE 的自动检查读取的就是这张表,宽泛范围不被接受为证据):

DSH 版本状态依据
0.1.5-rc.1compatible本机 profile 实装:dsh.profile.bundles 含本包,壳按 settings.json 的 serviceLifetime 生效(壳检测不到插件时会抹掉该键)
0.1.5-rc.2compatible与 0.1.5-rc.1 相比,提供本插件所用全部接缝的包(dsh-host-webserver、dsh-client-modules、dsh-client-ui-settings、dsh-cordis-client-runner、dsh-web、dsh-web-app、dsh-app-boot、dsh-package-manifest)逐文件一致,去掉版本号串后无任何差异
0.1.6-alpha.1 / 0.1.6-alpha.2compatibledsh-host-webserver、dsh-client-ui-settings、dsh-web 仍逐文件一致;有变化的 dsh-client-modules / dsh-cordis-client-runner / dsh-web-app / dsh-app-boot / dsh-package-manifest 均为增量:window.__ModuleLoader__.load({id, factory}) 握手不变、require 新增 .async()、注册可带可选 chunk、dsh.client 新增可选 immediately/external、manifestVersion 仅可选不强制;dsh.bundle.patch 的 profile 分层规则逐字未变

边界(不要把它读成运行验收):以上是源码契约比对——对照 npm 上发行的官方包产物核对插件实际消费的面,不是在这些版本上做过一次性 Profile 安装/启动/卸载。插件实际只依赖四个面:宿主半的 ctx.webServer.register({kind:'exact', path, handler}) 与 ctx.effect,客户端半的 window.__ModuleLoader__.load({id, factory}) 信封、settings.section 席位注册和 react 模块边。任一面在未来版本变动时本表需重新核对。核对方法:从 npm registry 取上述各包在该版本的发行产物,解包 lib/(不安装、不执行任何 lifecycle),抹掉版本号后逐文件比对,再对改动文件判定是否影响上述四个面。

配置

方式一:dsh 设置页(Web GUI)(推荐,即时生效)

打开 dsh 设置页 → "Node 服务驻留" → 选择其一(竖排单选,每个选项下有说明)。 更改通过 HTTP 路由(GET/POST /dsh-launcher-lifetime/settings)写入设置,无需重启, 下次关窗/托盘退出即按新模式执行。

方式二:dsh 的 cordis 配置(需重启 dsh 生效)

在 profile 的 cordis.patch.yml 中加入:

- id: dsh-launcher-lifetime
  config:
    serviceLifetime: 1

侧边栏图标(可选,本机定制)

dsh 设置页的导航图标由 dsh 内置的 navIcon(id) 映射决定:只有 models / agent-presets / plugins 有专属图标,其余设置页(包括本插件)统一显示齿轮。 如需给本插件的设置页换成专属图标,可编辑全局 dsh 包(dsh 升级后需重新应用):

node_modules/@deepseek-ai/dsh/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js

在 navIcon 函数的 return IconSettingsOutline16(齿轮兜底)之前加入:

if (id === "launcher-lifetime") return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline16, {
    className: SettingsRoot_module_css_default.navIcon,
    size: 16
});

改完重启 dsh 服务生效(IconRefreshOutline16 可换成 primitives 中任意图标)。

开发

npm install -D esbuild   # 仅开发依赖
npm run build            # src/index.ts → lib/index.js;src/client/* → lib/client.js(构建产物已提交,可直接用)

插件刻意不 import 任何 @deepseek-ai/* 包(dsh 的模块解析按 profile bundle 进行,外部依赖不可靠),配置手动校验。 Web 客户端面(src/client/)通过 dsh.client + exports["./client"] 声明,由 dsh 的 client-modules 挂载到设置页 slot。

贡献

欢迎提交 issue(bug、建议、文档)。本项目与 dsh-launcher 主仓库同步维护,PR 请说明改动动机。

相关项目

  • dsh-launcher — 本插件配套的 Windows 启动器壳(托盘菜单、服务生命周期执行)

许可证

MIT © dsh-launcher contributors