Back to catalog

Ruler4396 /

dsh-launcher-lifetime

Verified

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

2 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
READMESource: master@6bb13b55

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

配置

方式一: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

/ 5

No ratings yet

Community comments

No comments yet. Be the first to write one.