@kira905/dsh-butler-panel 0.9.2 → 0.9.4

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/cordis.patch.yml CHANGED
@@ -3,6 +3,14 @@
3
3
  # latest changelog, memory pulse). The node half (exports ".") serves
4
4
  # GET /api/dsh-butler/state; the `dsh.client` declaration makes the browser
5
5
  # half (exports "./client") load in the web GUI sidebar bottom area.
6
+ #
7
+ # 🔴 name 必须等于 package.json#name(发行名带 scope)。
8
+ # 0.9.3 及更早写的是不带 scope 的 `dsh-butler-panel` —— 那是"本地手放实体"时代的
9
+ # 名字。从注册表装(`dsh plugin --profile <p> add @kira905/dsh-butler-panel`)时,
10
+ # profile 里只有 `@kira905/dsh-butler-panel` 这个包,宿主解析不到 `dsh-butler-panel`
11
+ # 那一行 ⇒ **宿主半根本没挂上 ⇒ 它的 dsh.client 也不会被扫进 boot graph ⇒ 侧边栏连
12
+ # 入口都不出现,而且没有任何报错**(2026-11-09 A-8 关 4 实测,桌面版上就是这个症状)。
13
+ # 同一处坑在 @kira905/dsh-task-board-local 的 patch 里已有同文提醒,这里是同一类错误。
6
14
  - insert:
7
15
  - id: butler-panel
8
- name: 'dsh-butler-panel'
16
+ name: '@kira905/dsh-butler-panel'
package/lib/client.js CHANGED
@@ -28,8 +28,19 @@ window.__ModuleLoader__.load({
28
28
  * 浏览器 bundle 拿不到各包的 lib/host-adapter.js 副本(宿主按 exports["./client"] **单文件**
29
29
  * serve),故由 dsh-host-adapter-client 的 client 面提供常量;本包 package.json 的
30
30
  * `dsh.client.external` 已声明它 —— 宿主据此排序 boot graph,保证依赖先 register,
31
- * 同步 require 才命中模块表(不声明 = require MISS = 整个 client bundle 崩)。 */
32
- const ADAPTER = require("dsh-host-adapter-client");
31
+ * 同步 require 才命中模块表(不声明 = require MISS = 整个 client bundle 崩)。
32
+ *
33
+ * 🔴【0.9.4 · 2026-11-09】两条曾经把整个面板打死的事实:
34
+ * ① 从注册表装的是 **@kira905/dsh-host-adapter-client**(package.json#name 带 scope),
35
+ * 而 boot graph 的行 id = 那个 name ⇒ 裸 `require("dsh-host-adapter-client")` 找不到行、
36
+ * 整个 client bundle 在 factory 顶层就抛,侧边栏连入口都不出现(没有任何错误提示)。
37
+ * ② 老 profile 里那份是**不带 scope** 的本地件(name = dsh-host-adapter-client)。
38
+ * ⇒ 两个名字都试,谁在就用谁;都没有也只是缺一个常量,本面板照常挂(下面有同值兜底),
39
+ * 绝不因为一个依赖名字对不上而整块消失。 */
40
+ let ADAPTER = null;
41
+ try { ADAPTER = require("@kira905/dsh-host-adapter-client"); } catch (e1) {
42
+ try { ADAPTER = require("dsh-host-adapter-client"); } catch (e2) { ADAPTER = null; }
43
+ }
33
44
  //#region consts
34
45
  const ENTRY_ATTR = "data-dsh-butler-entry";
35
46
  const ENTRY_SELECTOR = "[" + ENTRY_ATTR + "]";
@@ -62,7 +73,10 @@ window.__ModuleLoader__.load({
62
73
  const COLD_MS_DEFAULT = 3200;
63
74
  const SLOW_MS = 1000; // "重算慢"阈值(连续退化判据的一半)
64
75
  const DEGRADE_STREAK_ALERT = 3; // 连续退化 ≥3 次 → 显式提示(别让主人以为一直正常)
65
- const inject = [ADAPTER.SVC.slots];
76
+ // 【0.9.4】适配层只在常量层需要:拿不到就退回同值字面量("slots")。
77
+ // 这一条就是当年"适配层名字对不上 ⇒ 整个面板消失"的兜底;不是新语义,值与 ADAPTER.SVC.slots 相同。
78
+ const SLOTS_SERVICE = (ADAPTER && ADAPTER.SVC && ADAPTER.SVC.slots) || "slots";
79
+ const inject = [SLOTS_SERVICE];
66
80
  // 大管家图标(账本清单,16px 描边,与生态面板 grid 同视觉语言)
67
81
  const ICON = "<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M2.6 3.2h6.8M2.6 8h6.8M2.6 12.8h6.8\"/><path d=\"M11.4 4.6l1.4 1.4 2.6-2.8M11.4 9.4l1.4 1.4 2.6-2.8\"/></svg>";
68
82
  const CSS_ID = "dsh-butler-panel-css";
package/lib/shards.mjs CHANGED
@@ -1112,10 +1112,18 @@ export async function collectServiceShard(ctx = {}) {
1112
1112
  const home = dshHome();
1113
1113
  const asOf = { at: now, source: 'compute' };
1114
1114
  // 可选依赖:宿主若提供了「外部通道健康」判定件(butlerLib 能解析到),就渲染它的结论;
1115
- // 解析不到 ⇒ 走下面的显式降级。**开源包里不带这份判定件**(它属于宿主侧能力),这不是故障。
1115
+ // 解析不到 ⇒ 走下面的显式降级。**开源包里不带这份判定件**(它属于宿主侧能力、且不开源),这不是故障。
1116
+ // 🔴 降级话术必须把"为什么没有"说成人话:不是"坏了",是"这个模块不在包里"。留一行可照做的指引。
1116
1117
  const sh = await butlerLib('secretary-health.mjs');
1117
1118
  if (!sh || typeof sh.collectHealth !== 'function') {
1118
- return { ok: false, reason: '宿主没有提供「外部通道健康」判定件(这是可选能力,面板本身不判健康)—— 所以这里不是「服务面正常」', asOf };
1119
+ return {
1120
+ ok: false,
1121
+ // 机器可读的降级原因(面板 UI 不需要它,给夹具/排障用;新增字段,向后兼容)
1122
+ unavailable: 'module-not-shipped',
1123
+ reason: '该模块不开源,本功能不可用(开源包里不带「外部通道健康」判定件;要接就由宿主自己提供同名模块,'
1124
+ + '放进大管家工具目录或设 BUTLER_ROOT)—— 面板本身不判健康,所以这里不是「服务面正常」',
1125
+ asOf,
1126
+ };
1119
1127
  }
1120
1128
  let health = null;
1121
1129
  let healthError = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kira905/dsh-butler-panel",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "description": "大管家的可视化面板:在 DSH 侧边栏看今天该看什么(结论 / 待处理 / 资产 / 流水 / 健康),只读为主;另带 P5 写入守门人(可挂可摘)。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -39,7 +39,7 @@
39
39
  "node": ">=18.17"
40
40
  },
41
41
  "dependencies": {
42
- "dsh-host-adapter-client": "npm:@kira905/dsh-host-adapter-client@^0.1.2"
42
+ "dsh-host-adapter-client": "npm:@kira905/dsh-host-adapter-client@^0.2.0"
43
43
  },
44
44
  "peerDependencies": {},
45
45
  "license": "AGPL-3.0-only",
@@ -52,6 +52,7 @@
52
52
  },
53
53
  "client": {
54
54
  "external": [
55
+ "@kira905/dsh-host-adapter-client",
55
56
  "dsh-host-adapter-client"
56
57
  ],
57
58
  "inject": [],