🎁 福利专区全网大模型免费应用 + 新用户福利 + 注册活动入口,低成本玩转 AI
广告☁️ 云服务器特惠阿里云首购 8 折 · 腾讯云合作特惠
DeepSeek Harness Hub
← 返回列表

RoyougiShiki/dsh-restart-systemd

DeepSeek Harnessspec-screened扫描:中风险在 GitHub 查看 ↗
未验证

DSH WebUI 重启按钮systemd 版:侧栏一键重启 dsh-web,WSL/Linux systemd 通道…

尚未跑自动兼容性验证,可查看页面内的依赖与入口分析。 · 最近上游提交 2026/8/21 · 已提供中文文档

DSH WebUI 重启按钮(systemd 版):侧栏一键重启 dsh-web,WSL/Linux systemd 通道 + Windows 分支,/restart 命令,会话自动续接

综合分
27.5
GitHub 分
27.5
用户评分
—
★ Stars
1
周下载量
—
安装插件(需先安装 dsh CLI 引擎:npm install -g @deepseek-ai/dsh)
dsh plugin --profile web add RoyougiShiki/dsh-restart-systemd
该插件未发布到 npm,走 GitHub 源安装(pnpm 若拦截 prepare 脚本,按其提示在 pnpm-workspace.yaml 的 allowBuilds 中放行后重跑)
信任档位:仅索引本站尚未对其实装验证,仅收录元数据
是什么
dsh 原生插件 · ui
装得上吗
本站尚未做安装检查
安全吗
本站尚未对该插件做风险分级(暂未覆盖,不等同于无风险)
还在维护吗
更新放缓:最近一次提交在 35 天前

档位由下列信号合成:本站实装验证(真实安装,当前最高到 L4)· 验证所用 dsh 版本 · 静态安装检查 · 风险分级 · 仓库维护状态。下方各区块是它的证据明细。 验证判据与等级说明 →

数据截至 2026/9/23(元数据每日更新 · 实装验证按队列轮转,单条结论的验证时间见上方)
依赖的 DSH / Cordis 模块
@deepseek-ai/cordis@deepseek-ai/dsh-agent@deepseek-ai/dsh-client-locale@deepseek-ai/dsh-client-runtime@deepseek-ai/dsh-client-ui-conversation@deepseek-ai/dsh-client-ui-sidebar@deepseek-ai/dsh-client-ui-slots@deepseek-ai/dsh-commands@deepseek-ai/dsh-home-paths@deepseek-ai/dsh-host-webserver@deepseek-ai/dsh-llm@deepseek-ai/dsh-session
用户评分
还没有人投票,来当第一个
订阅周报,不错过优质插件更新
每周一封 · 高评分插件 + 新用户活动

README

由 DeepSeek 最新模型翻译生成
dsh-restart-systemd

_英文摘要。_
一个 DeepSeek Harness WebUI 重启按钮(systemd 版)。在远程 web-ui 电话图标旁边的侧边栏页脚添加一个
重启触发器,外加一个 /restart 命令。
点击后会调度 systemctl --user restart dsh-web(约 3 秒后,以便浏览器
先收到 202),重复请求会被拒绝(409),非回环调用者会被拒绝
(403),flag 文件 + 残留窗口设计可防止重启循环,且服务恢复后
浏览器无需手动刷新即可自动重连
(ConnectionController 指数退避 500ms→10s),同时被中断的 agent 轮次会自动恢复。平台:WSL/Linux → systemctl --user(主要,已测试);
Windows → 分离式 helper 分支存在但在 WSL 上未使用。

GitHub topics(主代理创建仓库时使用): dsh · dsh-plugin · restart · systemd

设计总览

双面插件(与 dsh-client-ui-aionui-panel 同构):

| 半边 | entry(exports) | 运行环境 | 职责 |
|------|------------------|----------|------|
| host | "." → lib/index.js | node(宿主导进) | /api/restart-dsh 路由、/restart 命令、flag/resume 状态、restart-recover |
| client | "./client" → lib/client.js | 浏览器(WebUI) | 侧边栏 footer 重启按钮 + 二次确认 + 状态反馈 |

src/
index.ts               # host apply():串联路由 + 命令 + boot 消费/resume
host/gate.ts           # loopback fence(照抄 dsh-aionui-panel 的 gate)
host/restart.ts        # 调度 + 延迟 spawn + 平台分支 + flag/单飞锁
host/recover.ts        # agent/created -> lastTurnInterrupted -> followup continue
client/index.ts        # client apply():locale + sidebar.footer.action 注入
client/RestartButton.tsx   # 按钮 + 确认对话框(内联样式,无需 CSS bundle)
client/api.ts          # POST 助手 + 重连探活

内部依赖:官方 socket sidebar.footer.action(list/root additive,remote-web-ui 电话图标同座)+ 备选 conversation.session.header.utilities。

重启流程

1. 点按钮(或输入 /restart)→ 二次确认:“进行中的 agent 任务将中断并自动续接,页面约几秒后自动重连。”
2. 确认 → POST /api/restart-dsh(或命令回调)。
3. host 把当前 running 的 agent id 快照到 $DSH_HOME/dsh-restart-resume.json,写 flag $DSH_HOME/dsh-restart.flag,随即回 202 {scheduled:true, delayMs:3000}。
4. 3s 后 host 用白名单 argv(无 shell 拼串)spawn systemctl --user restart dsh-web。服务重启;浏览器靠 ConnectionController 指数退避(500ms→10s)自动重连,无需手动刷新。
5. 重启后插件消费(删除)flag token,装上 agent/created 监听,读 resume 列表——对每个最后 turn 被中断(存在未闭合 turn/start 或最近的 turn/end.reason === 'interrupted')的会话,agent.followup("Continue.") 自动续接;idle/正常结束的会话绝不打扰。

平台三态

| 平台 | 行为 | 代码位置 |
|------|------|----------|
| WSL | process.platform === 'linux' → systemctl --user restart dsh-web(本机主场景,已实测) | restartArgv() / platformSupported() |
| Linux | 同上(systemd 用户态) | 同上 |
| Windows(原生 win32,非 WSL) | spawn(process.execPath, [helper, 'win-restart.mjs']) detached helper,重启可脱离当前进程存活(机器相关,WSL 场景不走此分支) | 同上 |

安全(三合一 + 单飞)

- flag 文件 $DSH_HOME/dsh-restart.flag:spawn 前写入,boot 消费一次即删,绝不自行触发重启 → 残留 flag 无法造成二次重启。
- 残留窗口:插件驱动的 boot(flag 被消费)后 15s 内再次点击 → 429,防重试乒乓。
- 单飞锁:已有一发在途时重复 POST → 409。
- loopback fence:socket/Host 非 127.0.0.1/::1 或 sec-fetch-site === 'cross-site' 或 Origin 不同源 → 403;X-Forwarded-For 永不被信任。

状态文件($DSH_HOME → ~/.dsh)

| 文件 | 用途 |
|------|------|
| dsh-restart.flag | 一次性 boot token { reason, ts, sessionIds } |
| dsh-restart-resume.json | 续接列表 { ts, reason, sessionIds } |

独立仓库 / 发布形态

本目录即一个独立 Git + npm 包(社区格式 dsh-,systemd 版包名唯一且表意):

- package.json 已补全:name: dsh-restart-systemd、version: 0.1.0、license: MIT、
repository(GitHub 占位 https://github.com//dsh-restart-systemd.git,主代理稍后创建)、
keywords(['dsh','dsh-plugin','deepseek-harness','restart','systemd','systemctl','wsl','webui'])、
files(lib, src, cordis.patch.yml, README.md, LICENSE)、dsh.bundle.patch ⇒ ./cordis.patch.yml。
- LICENSE 已就位(MIT,2026 contributors)。
- cordis.patch.yml 注入一行双面插件,安装后 host+client 同时挂载,无需手改 bundle:
- insert:
- id: ui-dsh-restart-systemd
name: dsh-restart-systemd

创建 GitHub 仓库时建议 topics:dsh、dsh-plugin、restart、systemd。

安装

1) 构建(需 devDependencies)
cd dsh-restart-systemd
npm install
npm run build          # tsc -b → lib/(host=lib/index.js,client=lib/client.js,内联样式无需 CSS bundle)

2) 装入 web profile(注册 bundle + 补丁插件行)
dsh plugin --profile web add /tmp/dsh-restart-systemd
或 pnpm add /tmp/dsh-restart-systemd + 手补 cordis.patch.yml 行到 profile bundle 列表

3) 无热重载,需重启生效
systemctl --user restart dsh-web

exports."." → lib/index.js,exports."./client" → lib/client.js;main/types 与之对应。

验证

1. 插件加载:新会话打开;journalctl --user -u dsh-web 出现 dsh-restart-systemd: ...。
2. 侧边栏按钮:设置按钮旁的 footer 行出现重启图标(在 remote-web-ui 电话图标旁边),悬停标题“重启 DeepSeek Harness”。
3. 点击→确认→202→重启:确认后页面短暂显示“正在重启…”,~3s 后服务重启,页面自动重连:
- journald 依次出现 restart scheduled … delayMs=3000 → spawning restart for dsh-web … → 新 boot 的 consumed leftover restart flag。
4. /restart 命令:聊天输入 /restart → 返回确认文本。
5. 会话自动续接:重启前若有 running agent,boot 后 journald 出现 recovery armed for N session(s) 与 resuming interrupted agent ,agent 自动继续。
6. 单飞:快速点两次 → 第二次返回 409 already-scheduled。
7. loopback:curl -H 'Host: evil.example' -X POST http://127.0.0.1:3080/api/restart-dsh → 403 forbidden: loopback-only。
8. 失败兜底:systemctl --user status dsh-web 确认单元存活。

回滚

dsh plugin --profile web remove ui-dsh-restart-systemd
或手删包 + bundle 行后
systemctl --user restart dsh-web
清理残留状态(随时可删)
rm -f ~/.dsh/dsh-restart.flag ~/.dsh/dsh-restart-resume.json

重启后按钮与命令即消失,不改动其它配置。

平台说明

- WSL/Linux:systemctl --user restart dsh-web,主目标已实测。
- Windows(原生,非 WSL):restartArgv() 走 detached spawn(process.execPath, [helper])
win-restart.mjs(未随包附带;参考 anweat/dsh-restart 的 detached helper、
LnsiAxe/dsh-web-restart 的 WMI Win32_Process.Create、shaoyi1991 的 lsof 杀端口+spawn)。
路由、单飞、flag、loopback fence、restart-recover 均平台无关。WSL 本机场景不进入此分支。
- 重启后前端自动重连,无需手动刷新(ConnectionController 指数退避 500ms→10s)。

已知限制

- 单一服务单元:systemctl 命令固定 dsh-web(SYSTEMD_UNIT)。
- 非 systemctl 启动则不生效:若以 node … 手跑,spawn systemctl 会失败并记日志,不产生重启。
- 恢复为尽力而为:60s RECOVERY_TIMEOUT_MS 窗口内未重建的 agent 会被丢弃;无法判定“最后 turn 被中断”的会话会被跳过(clean 会话永不被主动续接)。
- Windows helper 为占位:仅提供 spawn 目标,helper 本体机器相关,超出 WSL 主目标范围。
- 路由避开 /plugins(官方 client-modules 拥有该前缀),仅注册 /api/restart-dsh,无 bundle 供数冲突。

License

MIT — see LICENSE.

上游仓库有新提交时邮件通知你(每天最多一封,无更新不打扰),随时一键退订。

同作者(RoyougiShiki)的其他插件

💬 加入社群

插件用法、部署报错、新插件第一时间同步——群里问,比一个人翻文档快。

DPharness QQ 群二维码,QQ 扫码进群
QQ 扫码进群
DPharness 飞书群二维码,飞书扫码进群
飞书扫码进群