rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:jiboda394-glitch/dsh-sidebar-actions
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
给 DeepSeek Harness 的左侧边栏底部加三个按钮:刷新 / 重启 / 退出。 刷新只是重新加载页面;重启和退出会让整个桌面端退出(重启后自动拉起)。
A DSH plugin that puts reload / restart / quit in the sidebar footer.
仓库 / repo: https://github.com/jiboda394-glitch/dsh-sidebar-actions ·
从 Releases 下载 dsh-sidebar-actions-<版本>.tgz 即可离线分发。
dsh web)下重启/退出自动禁用;失败时按钮旁出现小红点,悬停可看原因。dist/dsh-sidebar-actions-1.0.2.tgz 的路径填进安装框。dsh webdsh plugin --profile <profile> add ./dsh-sidebar-actions-<版本>.tgz
# 或直接从 GitHub 安装(源码):
dsh plugin --profile <profile> add github:jiboda394-glitch/dsh-sidebar-actions
# 或用 release 里的 tarball 地址(版本号按需替换):
dsh plugin --profile <profile> add https://github.com/jiboda394-glitch/dsh-sidebar-actions/releases/download/v1.0.2/dsh-sidebar-actions-1.0.2.tgz
装完重启一次 dsh web。
桌面端本身没有把「退出」暴露给插件:页面拿不到 app.quit(),宿主进程也只是 Electron 的一个子进程。所以插件按机器能力选两条路径,并在 GET /dsh-sidebar-actions/api/state 里如实报告用的是哪一条。
桌面端主进程里加一小段轮询(见文末「可选:让重启走优雅路径」),插件写请求文件,主进程自己调用 app.relaunch() / app.quit()——和托盘菜单同一条路径,运行中的任务会走原生确认框。
插件不靠猜:桥接方启动时在 %LOCALAPPDATA%\dsh-restart.bridge 留下标记文件,插件看到标记才走桥接。标记过期(应用升级把补丁覆盖掉)也不会卡死——请求文件 2.5 秒没人消费就自动退回下面的独立助手。
没有桥接时,插件用一个每次用户级计划任务(任务名 DSH-SidebarActions)启动 scripts/dsh-stop.ps1。助手跑在应用进程树之外,所以:
Win32_Process.Create)把应用拉起来。这条路径能在未打补丁的原版应用上工作,代价是:它是强制结束,不会弹「当前任务会被中断」的原生确认——所以按钮要求二次确认,悬停提示也会写明。Windows 专属;其他平台只能用桥接。
助手只结束进程再用原始命令行拉起,不写应用安装目录。1.0.1 及更早版本会在这一步把一个「待安装的」app.asar.new 拷进安装目录:如果那个包是升级前打的旧补丁,重启就会把新版本的应用包换成旧的,启动直接失败(app.asar.unpacked 里报 ENOENT)。1.0.2 已移除该行为。
重启前还会比对 app.asar 的版本与主程序文件版本,不一致就拒绝重启并返回 version-mismatch——坏掉的安装会被指出来,而不是被启动。
| 东西 | 位置 |
|---|---|
| 状态接口 | GET /dsh-sidebar-actions/api/state(同源) |
| 只读自检 | GET /dsh-sidebar-actions/api/diagnose:shell 解析、助手任务、桥接、路由、页面是否挂载 |
| 插件日志 | %LOCALAPPDATA%\dsh-sidebar-actions\host.log |
| 助手日志 | %LOCALAPPDATA%\dsh-sidebar-actions\helper.log |
| 助手任务 | schtasks /query /tn DSH-SidebarActions /v /fo list |
/diagnose 的 checks 就是「功能是否可用」的清单:desktop、shellReachable、helperReady、routeReady、clientMounted。应用升级后先打开这个地址跑一次,比点按钮试错快。
clientMounted 由页面自己请求 /state 时置位。桌面端页面来自 dsh-app://,Chromium 不会带 Sec-Fetch-Site,所以这里也认「浏览器类 User-Agent」;命令行 curl/PowerShell 探测不算。刚重载宿主时它是 false,刷新一次页面再看。
常见现象:
helper.log。若里面连 helper start 都没有,多半是任务没建起来(schtasks /query 查不到),看 host.log 里的 task ensure failed。helper.log 里的 replacement started 与 replacement processes after 4s 会写明是否起来了;start failed 一般是杀毒软件拦截,手动启动一次即可。/state 里的 via 是 graceful / forced / unsupported。dsh plugin --profile <profile> remove dsh-sidebar-actions)。schtasks /delete /tn DSH-SidebarActions /f
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\dsh-sidebar-actions"
这一步改的是应用自己的
app.asar,属于「你自己机器上的取舍」:应用每次升级都会覆盖回去,需要重新打。 不打也能用,只是走上面的「独立助手」强制路径。
在主进程(resources/app.asar 里的 lib/main.js)中,托盘初始化之后加:
// dsh-sidebar-actions: graceful relaunch / quit requested by the sidebar.
{
const { join } = require('node:path');
const { existsSync, rmSync, writeFileSync } = require('node:fs');
const base = process.env.LOCALAPPDATA || app.getPath('temp');
const restart = join(base, 'dsh-restart.request');
const quit = join(base, 'dsh-quit.request');
// The marker tells the plugin this shell really polls the two files.
try { writeFileSync(join(base, 'dsh-restart.bridge'), new Date().toISOString()); } catch {}
setInterval(() => {
try {
if (existsSync(restart)) { rmSync(restart, { force: true }); app.relaunch(); app.quit(); }
if (existsSync(quit)) { rmSync(quit, { force: true }); app.quit(); }
} catch (error) { console.warn('dsh-sidebar-actions: request poll failed', error); }
}, 1000);
}
改完重启一次应用,/state 的 via 会变成 graceful。
若之后不再想用桥接,删掉 %LOCALAPPDATA%\dsh-restart.bridge 即可,插件会退回独立助手。
dsh web 下只有「刷新」可用,这是有意为之。process.versions.electron / ELECTRON_RUN_AS_NODE / resources/app.asar,桥接看标记文件,重启只看操作系统进程。/state.dshVersion 会报出当前宿主版本。process.ppid 确实是桌面 shell(可执行文件一致、命令行不含 --type=)。将来若宿主不再是 shell 的直接子进程,插件会返回 shell-not-found 并拒绝执行,而不是杀错进程。resources/app.asar 的版本与主程序文件版本(/diagnose.installVersions),不一致返回 version-mismatch 并拒绝重启;任一版本读不到或格式不认识时放行。DSH_SIDEBAR_ACTIONS_SKIP_VERSION_CHECK=1 可关闭这项检查。webServer.register 或槽位接口若在某次升级里改名,按钮/接口会失效但不会拖垮应用:宿主日志会写 webServer.register unavailable,页面半则只是不注册。POST(Sec-Fetch-Site / Origin 校验),别的网页无法触发重启。schtasks /run 拉起;不会常驻。Adds reload / restart / quit to the sidebar footer.
location.reload().%LOCALAPPDATA%\dsh-restart.bridge exists and the shell polls dsh-restart.request / dsh-quit.request; an ignored request falls back to a detached helper after 2.5 s: a per-user scheduled task (DSH-SidebarActions) running scripts/dsh-stop.ps1 outside the app's process tree, which stops the shell process and starts the executable again with its original command line.version-mismatch) when the app.asar version does not match the executable's file version.State and logs: GET /dsh-sidebar-actions/api/state, %LOCALAPPDATA%\dsh-sidebar-actions\{host,helper}.log.
MIT. See LICENSE.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。