@kira905/dsh-butler-install 0.3.7 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,6 +14,9 @@
14
14
  > ```
15
15
  > 想点着鼠标装也行:`dsh-butler-install --ui` 会起一个本地向导页(只绑 `127.0.0.1`、只读、不执行)。
16
16
  >
17
+ > 💬 那个 `profile` 是什么?就是 DSH 放插件的一个「格子」的名字。你平时用网页版,格子里填 `web` 就对了;
18
+ > 用的桌面版(Electron)则是 `desktop`。**不知道填什么,照抄 `web` 即可**。
19
+ >
17
20
  > ### 先看它长什么样(真实输出)
18
21
  > ```text
19
22
  > dsh-butler-install —— 大管家全家桶薄壳安装器
@@ -34,6 +37,14 @@
34
37
  > 找到那条自带命令 ⇒ 用 `--profile desktop` 时**自动改用它**(命令原语不变,只是换了一条壳)。
35
38
  > 找不到自带命令时**不会硬来**:直接停手(rc=2),并告诉你怎么指路(`DSH_DESKTOP_DIR`)。
36
39
  > ⚠️ 桌面版只加载 `desktop` 这一个 profile;往 `--profile web` 里装 = 装了看不见。
40
+ >
41
+ > ### 它不附带什么(先看清楚,省得装完失望)
42
+ > 这套开源出来的是**能用的工具 + 装完自检 + 设计文档**。有两块**不在开源范围里**:
43
+ >
44
+ > 1. **「自己盯着活干」的那套引擎**:定时调度、队列盯守、管家日报、自主决定要不要动手 —— 这几件还没整理出来放(整理完会陆续放)。它的**设计本身是公开的**,写在 [`ops-handoff-design`](https://github.com/kira905/ops-handoff-design) 仓里,想自己实现的人照着做得到。
45
+ > 2. **「出事喊到人」的通道**:企业微信、语音播报这类 —— **不随开源发布**。
46
+ >
47
+ > 所以:装完你拿到的是一套**能用的工具**,不是一个会自己上班的管家。
37
48
 
38
49
  ---
39
50
 
@@ -92,6 +92,17 @@ export async function runEntry({
92
92
  out.write(`端口 ${port} 上没有我们自己的向导页(${found.reason})⇒ 现在起一个。\n`);
93
93
  }
94
94
 
95
+ // 桌面版探测**在这里做一次**(允许探进程),结果挂到 options 上给每个请求复用:
96
+ // · 向导要求"每请求零 spawn" ⇒ 不能每次请求都去探进程;
97
+ // · 而要知道"桌面版正开着",又必须探进程(source === 'process')——
98
+ // 不然同机装了 CLI + 桌面版的人会默认落回 web,装完桌面版界面一个插件都看不到(2026-11-07 实测)。
99
+ if (options.ui && !options.desktopPre) {
100
+ try {
101
+ const { detectDesktop } = await import('../lib/desktop.mjs');
102
+ options.desktopPre = await detectDesktop({ home: options.home, allowProcessProbe: true });
103
+ } catch { /* 探测失败就当没桌面版:退回原来的默认 web */ }
104
+ }
105
+
95
106
  const started = await startServer({ options, port: options.uiPort });
96
107
  if (!started.ok) {
97
108
  for (const line of started.log) out.write(`${line}\n`);
package/lib/plan.mjs CHANGED
@@ -208,6 +208,8 @@ export function resetDesktopDetectCache() {
208
208
  }
209
209
 
210
210
  async function desktopFor(home, options) {
211
+ // 启动时已解析过的(--ui 用它保证每请求零 spawn,同时也才有资格做进程探测)
212
+ if (options.desktopPre) return options.desktopPre;
211
213
  const env = options.env || process.env;
212
214
  const key = `${home}|${env.DSH_DESKTOP_DIR || ''}|${env.DSH_DESKTOP_CLI || ''}`;
213
215
  if (desktopDetectCache.has(key)) return desktopDetectCache.get(key);
@@ -247,6 +249,13 @@ export function decideProfile({ options, home, desktop }) {
247
249
  return { profile: requested, changed: false, source: 'explicit', notices };
248
250
  }
249
251
  if (!options.profileExplicit) {
252
+ // ① 桌面版**正在运行** ⇒ 用户此刻就在用它,默认就该装 desktop。
253
+ // 为什么要这条:下面 ② 只处理"只有 desktop、没有 web"的机器;而同时装了 CLI 与桌面版的人
254
+ // 两个 profile 都在,② 不命中 ⇒ 会落回 web ⇒ 装完桌面版界面上一个插件都看不到(2026-11-07 实测)。
255
+ if (desktop.source === 'process' && desktop.cliCmd) {
256
+ notices.push('检测到桌面版(Electron)正在运行,已默认改成 --profile desktop —— 装进 web 的那套界面,桌面版永远不加载');
257
+ return { profile: 'desktop', changed: true, source: 'auto-desktop-running', notices };
258
+ }
250
259
  const webExists = readProfile(home, 'web').exists;
251
260
  if (desktop.desktopProfileExists && desktop.cliCmd && !webExists) {
252
261
  notices.push('这台机器的数据根里只有桌面版自建的 desktop profile(没有 web),已改成 --profile desktop —— 装进 web 的那套界面桌面版永远不加载');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kira905/dsh-butler-install",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "Thin installer for the DSH butler suite: one command installs the plugin + CLI bundle through the host's own commands, then tells you whether it actually took effect, and can roll the whole batch back. Also ships a local wizard page (--ui) that lives outside DSH and can install from the browser: nothing runs until you press confirm; loopback only, per-process token + same-origin check, four POST entry points (preview/start/cancel/rollback), two honest rollbacks. It does not isolate you from other programs running as the same local user.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -5,7 +5,7 @@
5
5
  "items": [
6
6
  {
7
7
  "name": "@kira905/dsh-ecosystem-panel",
8
- "versionRange": "^0.5.0",
8
+ "versionRange": "^0.5.1",
9
9
  "type": "plugin",
10
10
  "group": "核心",
11
11
  "mount": "auto",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  {
17
17
  "name": "@kira905/dsh-butler-archive",
18
- "versionRange": "^0.5.0",
18
+ "versionRange": "^0.5.1",
19
19
  "type": "plugin",
20
20
  "group": "界面",
21
21
  "mount": "auto",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  {
27
27
  "name": "@kira905/dsh-session-title-live",
28
- "versionRange": "^0.3.0",
28
+ "versionRange": "^0.3.1",
29
29
  "type": "plugin",
30
30
  "group": "界面",
31
31
  "mount": "auto",