dsh-easy2restart
dsh-easy2restart icon
DSH 重启 + 安全归档插件。0.2.0 起由 dsh-plugin-easy2restart 与 dsh-plugin-safe-archive 合并而来,0.2.1 完成界面重做与「自动备份」可配置化。
📦 包名 / 仓库已改名
旧:dsh-plugin-easy2restart(GitHub 同名仓库)+ dsh-plugin-safe-archive → 新:dsh-easy2restart
旧包仍可安装但不再更新,请迁移到新包,详见 RENAME.md。
- 重启:侧边栏底部「重启」按钮,双击即整进程重启 DeepSeek Harness;会话运行中自动置灰。
- 安全归档:任何归档入口先弹确认框;会话仍在活动时给出活动清单 + 10 秒倒计时,倒计时结束才能「停止并归档」。
- 归档即备份:归档成功后宿主在 3 秒后自动备份会话文件、附件、标题缓存与元数据;备份目录可在界面里改,也能整个关掉。
- 右侧栏「已归档会话」:以归档会话文件夹为根的文件树,可在资源管理器中直接定位。
⚠️ 已知 DSH 启动问题(与本插件无关)
现象|Symptom
DSH 启动失败弹窗(截图)
启动 DSH 时弹出上面这个窗口:「The application could not start or stopped unexpectedly.」,正文是 desktop welcome: Web authentication failed,并附诊断日志路径(%APPDATA%\@deepseek-ai\dsh-desktop\logs\ 下的 crash/host 日志);按钮为 Exit / Restart / Disable third-party plugins, back up profile patch, and restart。主界面进不去,日志目录里每次多一条 phase: startup 的崩溃记录。
原因|Cause
每次启动 DSH 都会向桌面 cookie 库新增一条 dsh-auth-* cookie(127.0.0.1、每次启动端口随机,所以 cookie 名不同、不会覆盖旧条目)。它的有效期是 30 天,30 天内不会自己消失;累积到 71 条时 Cookie 请求头超过 16 KB 上限,host 返回 431,桌面握手失败 —— 就是上面这个弹窗。所以重启越频繁,越快撞线:一天重启几次的话,大约一个月内必然出现。
为什么点「Disable…」没用|Why the "Disable" button doesn't help
这个按钮只是禁用所有第三方插件(注意是禁用,不是删除、不是清空 —— 插件本体和配置都还在),然后重启一次。问题出在 cookie 累积,跟插件没有关系,所以点完照样起不来,反而暂时失去全部第三方插件能力,还得手动重新启用。Restart 按钮同理,只会再撞一次。
处理办法|Fix
- 完全退出 DSH(含托盘与后台进程)。
- 清掉
%APPDATA%\@deepseek-ai\dsh-desktop\Network\Cookies 里的 dsh-auth-*:用 SQLite 执行 DELETE FROM cookies WHERE host_key='127.0.0.1' AND name LIKE 'dsh-auth-%';,或直接删除 Cookies 文件(只影响免登录状态,不影响账号与会话)。
- 或安装
dsh-cookie-guard:DSH 关闭时每分钟自动清理,推荐用于长期防复发。
- 重新打开 DSH;cookie 会按需重新签发,不用重新登录,会话与工作区不受影响。
🀄 中文(默认展开)
已发布到官方 NPM
DSH 重启 + 安全归档插件:双击侧边栏按钮整体重启 DeepSeek Harness;归档会话前先确认,会话仍在活动时倒计时后才能停止归档;归档成功自动备份,备份到哪、备不备份都由你定。
功能
一、重启 DSH
- 侧边栏
sidebar.footer.action 位置注入「重启 DSH」按钮(账号头像、设置上方),图标为手绘缺口环 + 箭头。
- 双击按钮 → 宿主用 Windows 计划任务拉起一个脱离 DSH 进程树的 PowerShell 脚本,
taskkill /T 强杀整个 DSH 进程树,随后重新启动 DeepSeek Harness.exe。
- 有 Agent 会话运行中时按钮置灰禁用(依据 DSH 会话状态
running),鼠标悬停给出原因。
- 宿主保存一个「重启待办」,便于后续扩展「重启后回到原会话」等流程。
二、安全归档(确认 + 活动保护)
- 点击归档(菜单 / 行尾按钮 / 快捷键)先弹确认框
- 开启自动备份时:「确认归档该会话吗?归档后会话窗口会关闭。归档完成后会自动备份到:
<备份目录>。」
- 关闭自动备份时:第二行变红字「自动备份已关闭,本次归档不生成备份副本。」
- 会话仍在活动时的二次确认
- 点「确认归档」后若 Host 拒绝(
workspace/session-active),对话框切换为「会话正在活动」+ 活动清单(进行中回合 / 子代理 / 后台任务 / 定时任务);
- 「停止并归档」按钮 10 秒倒计时后才解禁,防止误操作。
三、归档即备份(事件驱动,不轮询)
- 宿主半侧包装
workspaceRegistry.archiveSession:归档成功后等 3 秒收尾,把会话文件 + 附件 + 标题缓存 + 元数据复制到
<备份根目录>\<会话名>-<归档日期-时间>\;
- 去重/状态按 会话 ID + SHA256 记录在
<备份根目录>\_auto-backup-state.json;manifest.json 自动落种子;
- 插件启动 5 秒后补扫「已归档但未备份」的会话,也可
POST /scan 手动补扫;
- 每次备份追加一行到
归档清单.md 与 _auto-backup-manifest.json;
- 备份根目录可改、自动备份可关闭(见下一节)。
四、自动备份设置(右侧栏内直接改)
右侧栏「已归档会话」页顶部有「自动备份」卡片,默认收起成一行摘要(开关状态 + 当前目录 + 状态徽章),点开后:
- 开启 / 关闭:关闭后归档照常进行,只是不生成备份副本;
- 备份根目录:输入框直接改,或点「选择…」弹系统文件夹对话框;
- 保存前先探测:目录不存在会自动创建,再写一个探针文件验证真的可写;不可写则红字提示原因且不落盘;
- 字段下方常驻一行状态:「✓ 可写,已备份 N 个会话」/「目录不存在,保存后自动创建」/「目录不可写,请换一个位置」/「自动备份已关闭:归档只留在 DSH 会话目录」,并标出来源(默认路径 / 用户设置 / 环境变量);
- 配置写在
~/.dsh/storages/dsh-easy2restart/config.json,环境变量优先(见「配置」);
- 改路径只影响之后的归档,已有备份不会被搬动。
五、右侧栏「已归档会话」
- DSH 右侧栏引导页新增「已归档会话」条目(文件资源管理器式页面);
- 根目录 = 归档会话文件夹
<DSH_HOME>/sessions(归档会话文件真实位置);
🌐 English
Published on official NPM
DSH restart + safe-archive plugin: double-click the sidebar button to fully relaunch DeepSeek Harness; every archive goes through a confirm dialog (with a 10s countdown while the session is still busy) and is backed up automatically — where, and whether, is up to you.
📦 Renamed. Old packages dsh-plugin-easy2restart + dsh-plugin-safe-archive are now dsh-easy2restart; see RENAME.md.
Features
1. Restart DSH
- Injects a restart button into the
sidebar.footer.action slot (above the account avatar / settings), drawn as an inline SVG open ring with an arrow.
- Double-click → the host launches a PowerShell script detached from the DSH process tree via Windows Task Scheduler; the script uses
taskkill /T to force-kill the whole DSH process tree, then relaunches DeepSeek Harness.exe.
- The button is greyed out while an agent session is running, with a tooltip explaining why.
- The host keeps a "restart pending" record so flows such as "return to the original session after restart" can be added later.
2. Safe archiving (confirm + activity guard)
- Every archive entry (menu / row button / shortcut) opens a confirm dialog first. When auto-backup is on, it also names the target folder; when off, it warns in red that no backup copy will be made.
- Second confirmation while the session is still busy: if the host rejects with
workspace/session-active, the dialog switches to "session is active" plus an activity list (running turn / subagents / background jobs / schedules); "stop and archive" unlocks only after a 10-second countdown.
3. Archive means backup (event-driven, no polling)
- The host wraps
workspaceRegistry.archiveSession: 3 seconds after a successful archive it copies the session file, attachments, title cache and metadata to <backup root>\<title>-<archive-time>\.
- Deduplication is recorded per session id + SHA256 in
<backup root>\_auto-backup-state.json; a catch-up scan runs 5 seconds after the plugin starts, and POST /scan triggers it manually.