dsh-plugin-mesh 0.5.4 → 0.5.5

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/lib/switch.js ADDED
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Mesh 一键关闭(kill switch)的判定与合并 —— 纯函数,便于单测。
3
+ *
4
+ * 单独成模块的理由和 pairing.js 一样:这是**安全相关**的判定。用户点了一键
5
+ * 关闭,如果判定写错(比如把字符串 "true" 当关闭、或者"关闭全部"只关了一半),
6
+ * 界面上照样显示"已关闭",实际上端口还开着、组播还发着 —— 这种错误看不见。
7
+ * 埋在一个 3000 行的文件里没人会为它写测试,所以拆出来、单测它。
8
+ *
9
+ * 三种范围:
10
+ * · `lan` 局域网 mesh:组播广播、主动扫描、ping,对端 HTTP 端口只绑回环
11
+ * · `internet` 互联网 mesh:停掉全部 tailnet sidecar(通道配置保留,可再打开)
12
+ * · `all` 两者都关 —— 就是「一键关闭 Mesh」
13
+ *
14
+ * 状态存在 state.json 的 `shutdown` 字段里:
15
+ *
16
+ * { "lan": true, "internet": false, "at": "2026-01-01T00:00:00.000Z", "by": "ui" }
17
+ *
18
+ * `true` = **已关闭**;缺失 / false = 开着(与历史行为一致 —— 升级不会突然把
19
+ * 所有人的 mesh 断开)。落盘而不是只放内存:一键关闭的语义是"我现在不想让这台
20
+ * 机器被找到、被派活",重启 DSH 后自己悄悄恢复是最坏的结果。
21
+ */
22
+
23
+ /** 允许的范围。顺序即界面顺序:全部 → 局域网 → 互联网。 */
24
+ export const MESH_SWITCH_SCOPES = ["all", "lan", "internet"];
25
+
26
+ /** 范围的中文名(日志、工具回执、界面共用同一套说法)。 */
27
+ export const MESH_SWITCH_LABEL = {
28
+ all: "全部 mesh",
29
+ lan: "局域网 mesh",
30
+ internet: "互联网 mesh",
31
+ };
32
+
33
+ /**
34
+ * 把用户/agent 传来的范围归一化。
35
+ *
36
+ * 除了英文 id,也接受界面上那三个中文词 —— agent 很容易直接照着界面文案
37
+ * 传「局域网」,拒掉它只会让人以为功能坏了。
38
+ *
39
+ * @returns {"all"|"lan"|"internet"|""} 不认识时返回空串(调用方报错)
40
+ */
41
+ export function normalizeSwitchScope(raw) {
42
+ const s = String(raw ?? "").trim().toLowerCase();
43
+ if (!s) return "";
44
+ if (s === "all" || s === "全部" || s === "全部mesh" || s === "全部 mesh") return "all";
45
+ if (s === "lan" || s === "局域网" || s === "局域网mesh" || s === "局域网 mesh") return "lan";
46
+ if (s === "internet" || s === "互联网" || s === "互联网mesh" || s === "互联网 mesh") return "internet";
47
+ return "";
48
+ }
49
+
50
+ /**
51
+ * state.json 里的 `shutdown` → 期望状态。
52
+ *
53
+ * 只有严格的布尔 true 才算关闭。从 YAML / 手工编辑里读出来的字符串 "true"
54
+ * 不算 —— 和 pairing.js 同一条规则:宁可当作"没关",也不要让一个看起来
55
+ * 生效、实际没生效的开关骗人。
56
+ *
57
+ * @param {object} state state.json 解析结果
58
+ * @returns {{lan: boolean, internet: boolean, all: boolean, at: string, by: string}}
59
+ * lan/internet = **是否已关闭**;all = 两者都关。
60
+ */
61
+ export function resolveMeshSwitch(state = {}) {
62
+ const raw = state && typeof state === "object" ? state.shutdown : null;
63
+ const off = (v) => v === true;
64
+ const lan = off(raw?.lan);
65
+ const internet = off(raw?.internet);
66
+ return {
67
+ lan,
68
+ internet,
69
+ all: lan && internet,
70
+ at: typeof raw?.at === "string" ? raw.at : "",
71
+ by: typeof raw?.by === "string" ? raw.by : "",
72
+ };
73
+ }
74
+
75
+ /**
76
+ * 一次开关操作之后要写进 `state.shutdown` 的对象(不修改入参)。
77
+ *
78
+ * `off` 默认 **true**:一键关闭是主动作,调用方漏传时按"关"处理更像用户的意图。
79
+ * 但这只影响 `off` 的缺省,不影响范围 —— 范围不认识就直接抛错,绝不猜。
80
+ *
81
+ * @param {{lan?: boolean, internet?: boolean}|null} current 当前状态(resolveMeshSwitch 的结果)
82
+ * @param {{scope?: string, off?: boolean, by?: string, at?: string}} op
83
+ * @returns {{lan: boolean, internet: boolean, at: string, by: string}}
84
+ */
85
+ export function applyMeshSwitch(current, { scope, off = true, by = "ui", at = new Date().toISOString() } = {}) {
86
+ const s = normalizeSwitchScope(scope);
87
+ if (!s) {
88
+ throw new Error(`未知的开关范围:${String(scope)}(应为 all / lan / internet)`);
89
+ }
90
+ const want = off !== false;
91
+ const next = {
92
+ lan: current ? current.lan === true : false,
93
+ internet: current ? current.internet === true : false,
94
+ };
95
+ if (s === "all" || s === "lan") next.lan = want;
96
+ if (s === "all" || s === "internet") next.internet = want;
97
+ return { ...next, at, by: String(by || "ui") };
98
+ }
99
+
100
+ /**
101
+ * 一行中文摘要,给工具回执 / mesh_peers 用。
102
+ *
103
+ * 刻意把"关"和"开"都说出来(不只说关了什么):agent 读到这行时要能判断
104
+ * 现在到底能不能派任务,而不是靠猜。
105
+ */
106
+ export function describeMeshSwitch(sw = {}) {
107
+ const state = (off) => (off ? "已关闭" : "开启");
108
+ if (sw.lan === true && sw.internet === true) return "mesh 已全部关闭(局域网 + 互联网)";
109
+ return `局域网 ${state(sw.lan)} · 互联网 ${state(sw.internet)}`;
110
+ }
@@ -163,6 +163,81 @@ export function channelSignature(channel = {}) {
163
163
  .slice(0, 12);
164
164
  }
165
165
 
166
+ /**
167
+ * 启动多久还没有 tailnet 地址、也没有授权链接,就判定「启动受阻」。
168
+ *
169
+ * 为什么需要这条:sidecar 连不上控制面(DNS 被代理劫持成假 IP、代理只放行
170
+ * HTTP 客户端、防火墙…)时,tsnet 会一直重试,`srv.Up()` 永不返回,
171
+ * phase 永远停在 "starting"。界面就一直显示「正在启动」—— 用户看到的是
172
+ * 一个永不结束的转圈,比一条明确的失败更难排查(真机反馈 2026-10-29:
173
+ * 「互联网一直在启动中」)。这里把我们能确定的证据(sidecar 自己的登录
174
+ * 错误)翻出来,并给一句可执行的提示。
175
+ *
176
+ * 75s 的取值:正常注册(含一次 DERP 握手)通常 < 10s;等到 75s 还没地址,
177
+ * 几乎一定是卡在控制面上,而不是"再等等就好"。
178
+ */
179
+ export const TSNET_STALL_MS = 75000;
180
+
181
+ /**
182
+ * 从 sidecar 的诊断环里提取「为什么还没登录」。
183
+ *
184
+ * 只认两类行,都是 sidecar 自己打的:
185
+ * · `health(warnable=login-state): error: …`
186
+ * · `Received error: …`
187
+ * 取最后一条 —— 环里最新的就是当前状态。
188
+ */
189
+ export function extractLoginFailure(diagnostics) {
190
+ const list = Array.isArray(diagnostics) ? diagnostics.map((l) => String(l)) : [];
191
+ let last = "";
192
+ for (const line of list) {
193
+ const health = /health\(warnable=login-state\):\s*(?:error|warning):\s*(.+)$/i.exec(line);
194
+ if (health) last = health[1].trim();
195
+ const recv = /^Received error:\s*(.+)$/i.exec(line);
196
+ if (recv) last = recv[1].trim();
197
+ }
198
+ return last.replace(/^You are logged out\.\s*The last login error was:\s*/i, "").trim();
199
+ }
200
+
201
+ /**
202
+ * 把登录错误翻成一句用户能动手的提示。
203
+ * 认不出来就返回空串 —— 宁可不猜,也不要给一条错误的建议。
204
+ */
205
+ export function explainTailnetFailure(text) {
206
+ const s = String(text ?? "");
207
+ if (!s) return "";
208
+ if (/deadline exceeded|i\/o timeout|timed out|no route to host|connection refused|unreachable/i.test(s)) {
209
+ return "控制面连不上:检查本机网络或代理。sidecar 走的是裸 TCP/UDP,只放行 HTTP 客户端的代理设置对它无效。";
210
+ }
211
+ if (/invalid key|auth ?key|unauthorized|not authorized|403/i.test(s)) {
212
+ return "授权码无效或已过期:换一把勾了 Reusable 的 auth key(后台开了设备审批还要 Pre-approved)。";
213
+ }
214
+ if (/logged out|needs login|login required/i.test(s)) {
215
+ return "节点已被注销:重新填授权码,或删掉这条通道再加一次。";
216
+ }
217
+ return "";
218
+ }
219
+
220
+ /**
221
+ * 根据 sidecar 的状态判断"启动受阻",并给出下一步的 phase。
222
+ *
223
+ * 纯函数:这段是「界面到底显示正在启动还是启动受阻」的唯一判据,值得单独测。
224
+ * 规则:
225
+ * · 只有「还在启动」的节点才会受阻(已经在 running/needs-login 的不算)
226
+ * · 有 tailnet 地址或授权链接就说明在正常推进,不算受阻
227
+ * · 从受阻恢复的中途(已有地址、后端还没翻 Running)退回 "starting",
228
+ * 既不继续吓人,也不提前说"已连接"
229
+ */
230
+ export function evaluateTailnetProgress({ phase, selfIpv4 = "", authUrl = "", startingSince = 0, now = Date.now(), stallMs = TSNET_STALL_MS } = {}) {
231
+ // needs-login **没有授权链接** 也是卡住:有链接才是在等用户点授权,
232
+ // 没链接说明登录请求本身在失败(实测:backendState=NeedsLogin、authUrl 为空,
233
+ // 界面只显示「需要授权」却没有任何可点的东西,比转圈还难懂)。
234
+ const waiting = phase === "starting" || phase === "stalled" || (phase === "needs-login" && !authUrl);
235
+ const since = Number(startingSince) || 0;
236
+ const stalled = Boolean(waiting && !selfIpv4 && !authUrl && since > 0 && now - since >= stallMs);
237
+ const nextPhase = stalled ? "stalled" : phase === "stalled" ? "starting" : phase;
238
+ return { stalled, phase: nextPhase };
239
+ }
240
+
166
241
  /**
167
242
  * 一个 tsnet 节点的句柄。可以自己拉起 sidecar,也可以复用它人已拉起的。
168
243
  */
@@ -179,7 +254,22 @@ export class TsnetNode extends EventEmitter {
179
254
  #port = 0;
180
255
  #rendezvous = null;
181
256
  #events = [];
182
- #status = { phase: "idle", backendState: "", authUrl: "", selfIpv4: "", selfDnsName: "", error: "", hostname: "", pid: 0 };
257
+ #status = {
258
+ phase: "idle",
259
+ backendState: "",
260
+ authUrl: "",
261
+ selfIpv4: "",
262
+ selfDnsName: "",
263
+ error: "",
264
+ hostname: "",
265
+ pid: 0,
266
+ /** 本次启动开始时间:用来判断"卡了多久"(见 TSNET_STALL_MS) */
267
+ startingSince: 0,
268
+ /** true = 启动超过 TSNET_STALL_MS 还没有地址/授权链接,界面必须说出来 */
269
+ stalled: false,
270
+ stalledReason: "",
271
+ stalledHint: "",
272
+ };
183
273
  #pollTimer = null;
184
274
  #restarts = 0;
185
275
  #stopping = false;
@@ -396,7 +486,14 @@ export class TsnetNode extends EventEmitter {
396
486
  }
397
487
 
398
488
  async #startInner() {
399
- this.#setStatus({ phase: "starting", error: "" });
489
+ this.#setStatus({
490
+ phase: "starting",
491
+ error: "",
492
+ stalled: false,
493
+ stalledReason: "",
494
+ stalledHint: "",
495
+ startingSince: Date.now(),
496
+ });
400
497
 
401
498
  // 先看有没有已在跑的 sidecar 可以复用 —— 整机一个设备,不重复注册。
402
499
  const reused = await this.#tryAdopt();
@@ -487,6 +584,9 @@ export class TsnetNode extends EventEmitter {
487
584
 
488
585
  async #spawnOwn() {
489
586
  try {
587
+ // 自动重启(#onExit 的退避重试)不走 #startInner,这里也要重置计时,
588
+ // 否则上一轮的"卡住时长"会漏到新一轮,刚重启就报受阻。
589
+ this.#setStatus({ startingSince: Date.now(), stalled: false, stalledReason: "", stalledHint: "" });
490
590
  return await this.#spawnOwnInner();
491
591
  } catch (err) {
492
592
  // 与 start() 同一个理由,但这条路径必须单独兜:自动重启(#onExit 的退避重试)
@@ -633,6 +733,10 @@ export class TsnetNode extends EventEmitter {
633
733
  selfIpv4: ev.selfIpv4 ?? "",
634
734
  selfDnsName: ev.selfDnsName ?? "",
635
735
  error: "",
736
+ stalled: false,
737
+ stalledReason: "",
738
+ stalledHint: "",
739
+ startingSince: 0,
636
740
  });
637
741
  this.#log(`tailnet 已连接:${ev.selfIpv4 || "?"}(${ev.selfDnsName || this.#hostname})`);
638
742
  this.emit("ready", ev);
@@ -693,6 +797,25 @@ export class TsnetNode extends EventEmitter {
693
797
  const st = await this.statusRemote();
694
798
  const phase =
695
799
  st.backendState === "Running" ? "running" : st.authUrl ? "needs-login" : st.backendState === "NeedsLogin" ? "needs-login" : this.#status.phase;
800
+ // 启动受阻:还在"启动中"、却既没有 tailnet 地址也没有授权链接,且已经卡了很久。
801
+ // 判据在 evaluateTailnetProgress 里(纯函数、有单测)。
802
+ const progress = evaluateTailnetProgress({
803
+ phase,
804
+ selfIpv4: st.selfIpv4 || "",
805
+ authUrl: st.authUrl || "",
806
+ startingSince: this.#status.startingSince,
807
+ });
808
+ const stalled = progress.stalled;
809
+ const reason = stalled ? extractLoginFailure(st.diagnostics) : "";
810
+ const hint = stalled ? explainTailnetFailure(reason) : "";
811
+ // 只在进入"受阻"的那一刻记一条:界面之外(日志/诊断)也要留下证据,
812
+ // 否则用户只会看到"一直正在启动",事后无从判断卡在哪一步。
813
+ if (stalled && !this.#status.stalled) {
814
+ this.#warn(
815
+ `[${this.#label}] 启动受阻(${Math.round(TSNET_STALL_MS / 1000)}s 内没有拿到 tailnet 地址)` +
816
+ `${reason ? `:${reason}` : ""}${hint ? ` —— ${hint}` : ""}`,
817
+ );
818
+ }
696
819
  this.#setStatus({
697
820
  pid: st.pid || this.#status.pid,
698
821
  backendState: st.backendState ?? "",
@@ -702,7 +825,10 @@ export class TsnetNode extends EventEmitter {
702
825
  machineKey: st.machineKey || "",
703
826
  forwards: st.forwards ?? [],
704
827
  diagnostics: st.diagnostics ?? [],
705
- phase: phase === "idle" ? this.#status.phase : phase,
828
+ stalled,
829
+ stalledReason: stalled ? reason || "控制面一直没有回应(sidecar 仍在后台重试)" : "",
830
+ stalledHint: hint,
831
+ phase: progress.phase,
706
832
  });
707
833
  } catch (err) {
708
834
  if (!this.#ownsProcess && !pidAlive(this.#rendezvous?.pid ?? 0)) {
package/llms.txt CHANGED
@@ -39,6 +39,7 @@ Verify after restart: `GET http://127.0.0.1:45917/mesh/v1/health` returns JSON c
39
39
  | `mesh_scan` | none | Actively scan the local subnet for mesh peers. Use when multicast is blocked. |
40
40
  | `mesh_run` | `peer: string` (required), `task: string` (required), `thread?: string`, `noWake?: boolean`, `newSession?: boolean`, `workspace?: string` | Dispatch a task to another machine. Asynchronous — a successful call means "accepted", not "done". |
41
41
  | `mesh_tasks` | none | Show recently received and sent mesh tasks. |
42
+ | `mesh_switch` | `scope: "all" \| "lan" \| "internet"` (required), `action?: "off" \| "on"` | One-click kill switch. `off` is the default action. |
42
43
 
43
44
  `peer` accepts a machine name, an instance id, or `ip:port`. **Do not pass `machine/user`** — `from` fields look like `machine/user`, but the peer key is the machine name only.
44
45
 
@@ -46,6 +47,44 @@ Reuse the same `thread` value for the same piece of work: the receiving side reu
46
47
 
47
48
  `newSession: true` forces a fresh session while keeping the same conversation key (i.e. it is still the same conversation, with a clean context).
48
49
 
50
+ ## Kill switch (one-click shutdown)
51
+
52
+ Three scopes, available as the **一键关闭** pills on the home overview card, as the
53
+ detailed **连接 → 一键关闭** section of the Mesh panel, and as the `mesh_switch` tool
54
+ (`POST /mesh/api/switch` with `{scope, off}`):
55
+
56
+ | Scope | Effect |
57
+ |---|---|
58
+ | `all` | LAN and internet both off: no multicast, no subnet scan, no inbound tasks, all tailnet sidecars stopped |
59
+ | `lan` | Stops multicast announcements, subnet scan and keepalive pings; the peer HTTP port is rebound from `0.0.0.0` to `127.0.0.1` so nothing on the LAN can connect. Internet channels keep working |
60
+ | `internet` | Stops every tailnet sidecar. Channel config and auth keys are kept and resume on reopen |
61
+
62
+ - **Immediate, and it survives a restart.** The desired state lives in
63
+ `<profile>/mesh/state.json` under `shutdown` (`{lan, internet, at, by}`, `true` = off),
64
+ not in the plugin config. `enabled: false` in config is a different thing: it removes
65
+ the plugin at load time, including the panel, so it cannot be undone from the UI.
66
+ - The Mesh panel and `/mesh/api/*` stay available while everything is off — otherwise
67
+ "one-click off" would lock you out of turning it back on.
68
+ - `/mesh/api/state` reports `switch.lan|internet.{off, active, bind, port, note}`:
69
+ `off` is the requested state, `active` the real one. A failed rebind shows up as a
70
+ non-empty `note` instead of silently looking closed.
71
+ - While closed, outbound dispatch, `mesh_scan`, and the peer HTTP API (including
72
+ `/mesh/v1/health`) answer with an explicit "closed" error (HTTP 503/409), never with
73
+ a generic "unreachable" — "no answer" must not be mistaken for "not there".
74
+
75
+ ## Tailnet stalls are reported, not hidden
76
+
77
+ A sidecar that cannot reach the control plane keeps retrying, and `srv.Up()` never
78
+ returns. Rather than showing "starting" forever, the host marks the channel as
79
+ **启动受阻** (`node.stalled`, `node.stalledReason`, `node.stalledHint`) once
80
+ `TSNET_STALL_MS` (75 s) passes with no tailnet address and no auth URL, taking the
81
+ reason from the sidecar's own `health(warnable=login-state)` / `Received error`
82
+ diagnostics. The panel shows the reason plus an actionable hint and turns the
83
+ button into 重试连接; `switch.internet.stalled` and a `note` carry the same fact to
84
+ the kill-switch section. Most common cause on a machine with a local proxy: the
85
+ sidecar dials raw TCP/UDP, so an "HTTP clients only" proxy setting does not cover
86
+ it (`register request: … context deadline exceeded`).
87
+
49
88
  ## Configuration
50
89
 
51
90
  Override by id in the profile's `cordis.patch.yml`:
@@ -126,7 +165,7 @@ Outbound dispatch tries LAN first, then each tailnet channel in order.
126
165
 
127
166
  ```bash
128
167
  npm run check # version consistency + TDZ scan + syntax + loadability
129
- npm test # = check + regression suites (~280 assertions, network-free)
168
+ npm test # = check + regression suites (~310 assertions, network-free)
130
169
  npm run selftest:caps # capability collection: sanitising, GPU parsing, retries, claim rules
131
170
  npm run selftest:client # client bundle rendering without a browser
132
171
  npm run selftest:prompt # task prompt generation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-mesh",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "type": "module",
5
5
  "description": "DSH Mesh:局域网自动发现同网段的 DSH 实例、显示每台机器上报的能力,并双向派发任务;可用内置的用户态 Tailscale 节点跨互联网组网。Discovers other DSH instances on the LAN, shows the capabilities each one reports, and dispatches tasks between machines in both directions, with an optional userspace Tailscale node for links across networks.",
6
6
  "license": "MIT",
@@ -66,8 +66,8 @@
66
66
  "selftest:layout": "node lib/_selftest-layout.mjs",
67
67
  "selftest:diagnostics": "node lib/_selftest-diagnostics.mjs",
68
68
  "selftest:osinfo": "node lib/_selftest-osinfo.mjs",
69
- "test": "npm run check && npm run selftest && npm run selftest:prompt && npm run selftest:pairing && npm run selftest:client && npm run selftest:caps && npm run selftest:release && npm run selftest:reply && npm run selftest:reasoning && npm run selftest:resume && npm run selftest:persist && npm run selftest:layout && npm run selftest:diagnostics && npm run selftest:osinfo",
70
- "check": "node scripts/check-version.mjs && node scripts/check-tdz.mjs && node --check lib/index.js && node --check lib/layout.js && node --check lib/discovery.js && node --check lib/conversation.js && node --check lib/identity.js && node --check lib/capabilities.js && node --check lib/prompt.js && node --check lib/pairing.js && node --check lib/scan.js && node --check lib/tsnet/download.js && node --check lib/tsnet/manager.js && node --check lib/tsnet/bridge.js && node --check lib/tsnet/channels.js && node --check client/client.js && node --check scripts/release-plan.mjs && npm run check:loadable && npm run check:docs",
69
+ "test": "npm run check && npm run selftest && npm run selftest:prompt && npm run selftest:pairing && npm run selftest:switch && npm run selftest:client && npm run selftest:caps && npm run selftest:release && npm run selftest:reply && npm run selftest:reasoning && npm run selftest:resume && npm run selftest:persist && npm run selftest:layout && npm run selftest:diagnostics && npm run selftest:osinfo",
70
+ "check": "node scripts/check-version.mjs && node scripts/check-tdz.mjs && node --check lib/index.js && node --check lib/layout.js && node --check lib/discovery.js && node --check lib/conversation.js && node --check lib/identity.js && node --check lib/capabilities.js && node --check lib/prompt.js && node --check lib/pairing.js && node --check lib/switch.js && node --check lib/scan.js && node --check lib/tsnet/download.js && node --check lib/tsnet/manager.js && node --check lib/tsnet/bridge.js && node --check lib/tsnet/channels.js && node --check client/client.js && node --check scripts/release-plan.mjs && npm run check:loadable && npm run check:docs",
71
71
  "build:sidecar": "bash scripts/build-sidecar.sh",
72
72
  "verify:mirror": "node scripts/verify-lan-mirror.mjs",
73
73
  "release:plan": "node scripts/release-plan.mjs",
@@ -77,7 +77,8 @@
77
77
  "check:scope": "python3 tools/scopecheck.py lib/index.js",
78
78
  "prepublishOnly": "npm test && node scripts/check-tarball.mjs",
79
79
  "check:docs": "node scripts/sync-llms.mjs",
80
- "selftest:pairing": "node lib/_selftest-pairing.mjs"
80
+ "selftest:pairing": "node lib/_selftest-pairing.mjs",
81
+ "selftest:switch": "node lib/_selftest-switch.mjs"
81
82
  },
82
83
  "publishConfig": {
83
84
  "registry": "https://registry.npmjs.org/",
@@ -31,6 +31,7 @@ const REQUIRED = [
31
31
  "lib/index.js", // 入口
32
32
  "lib/capabilities.js",
33
33
  "lib/prompt.js",
34
+ "lib/switch.js", // 一键关闭的判定(安全相关),漏了就是装上即坏
34
35
  "lib/discovery.js",
35
36
  "lib/conversation.js",
36
37
  "lib/identity.js",