mihomo-cli 26.11.118 → 26.11.120

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [26.11.120] - 2026-11-27
4
+
5
+ ### 修复
6
+
7
+ - **冷启动不再被 3 秒观察窗误报为失败**:已装载但尚未运行的服务最长等待 90 秒,重复执行 `start` 会附着等待而非 bootout 重排;等待完成后仍热重载本次配置。超时报告「启动待确认」,真实异常退出仍立即报错。重装遇到这种待启动状态时也会恢复运行,不再误关自启
8
+
9
+ ## [26.11.119] - 2026-11-22
10
+
11
+ ### 变更
12
+
13
+ - 常见的 CN/private GeoSite DNS 策略默认改用独立、完整的 CN/private MRS,避免精简 GeoSite 漏判国内域名,同时不下载用不到的海外分类;自定义 DNS、混合 GeoSite 分类和同名 provider 保持原配置
14
+ - 仅由阿里、腾讯重复 DoH/DoT 写法组成的国内 DNS 列表默认收敛为两路 DoH,减少重复并发查询;未显式设置 `tolerance` 的 `url-test` 组默认使用 `50`,降低小幅延迟波动造成的节点切换
15
+
3
16
  ## [26.11.118] - 2026-11-21
4
17
 
5
18
  ### 变更
@@ -92,30 +105,3 @@
92
105
  ### 变更(内部清理,无用户可见变化)
93
106
 
94
107
  - 删除一批从不被读取的返回字段与从不传值的函数参数;订阅下载与配置准备的订阅名参数去掉 `default` 静默回退改为必传——新调用方漏传不再悄悄写进 default.yaml。测试并发基建统一进 `src/test-support/`(新增 spawn-eval、poll 两个夹具),各 spec 私抄的七处子进程骨架与两份逐字重复的帮助函数随之收敛。957 用例全绿
95
-
96
- ## [26.10.110] - 2026-10-11
97
-
98
- ### 修复
99
-
100
- - **帮助与报错文案的准确性收口**:`sub use` / `use` / `ow on|off` 的「自动重启」统一为「运行中自动重启」——停止状态下这些命令只切换、不重启也不启动,原描述让用户预期落空;平台守卫报错与 README 统一为「适配尚无时间表」;reset 帮助行的「留空保留」清单补上此前遗漏的「服务」
101
- - **`ui` 在 ports 配置非法时不再输出畸形控制器行**:原输出把说明文字拼进 URL 冒号后面(`http://127.0.0.1:(settings.json 的 ports…)`),形似坏数据;改为整行「控制器: 端口无法确定(settings.json 的 ports 配置非法)」
102
-
103
- ### 变更
104
-
105
- - **README 与帮助文案的可读性修订**:「端口逃生口」改「端口可配置」、「紧急度着色」改「按紧急程度着色」、内核低速失败的换节点指引不再假设订阅主分组名(改「主分组(通常名为 Default Proxy 或 PROXY)」)、「重启透传」改「重启时可用/可带」;布尔开关清单把同一开关的 `-s`/`--no-update` 合并为一项,README 交叉引用补锚点链接
106
-
107
- ## [26.10.109] - 2026-10-11
108
-
109
- ### 变更
110
-
111
- - **移除旧版(v3.0–v4.0)root 服务的检测与自动清理**:兼容窗口面向 2026-07–08 的安装,存量设备已全部升级。极少数仍残留旧 root 服务的机器(症状:代理停不掉、`/Library/LaunchDaemons/com.mihomo-cli.daemon.plist` 存在)需手动清理——`sudo launchctl bootout system/com.mihomo-cli.daemon` 后 `sudo rm -f /Library/LaunchDaemons/com.mihomo-cli.daemon.plist`
112
- - **Node 版本要求升至 >= 24.20.0**:低版本运行时入口守卫直接报错并给出升级指引(brew / nvm)
113
- - **`status --json` 移除 `service.legacySystemInstall` 字段**:随旧 root 服务检测一并移除,脚本消费者如有引用需更新
114
-
115
- ### 修复
116
-
117
- - **root 残留清理的取消提示统一措辞**:sudo 密码取消/错误此前在不同命令下有三种说法,统一为「sudo 已取消或密码错误,root 残留未被清理」
118
-
119
- ### 变更(内部清理,无用户可见变化)
120
-
121
- - uninstall 无服务分支少一次重复的进程探测;残留分档用例归位 process-stop.spec、service.ts 拆除 process-stop 转发 re-export、StatusJson 公开契约改回显式声明。956 用例全绿
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  - [安装](#安装) · [快速开始](#快速开始) · [命令参考](#命令参考) · [状态与生效](#状态与生效)
10
10
  - [模式说明](#模式说明) · [服务托管](#服务托管) · [内核更新通道](#内核更新通道) · [订阅自动更新](#订阅自动更新)
11
- - [数据保护](#数据保护) · [数据目录](#数据目录) · [覆写配置](#覆写配置) · [Web UI](#web-ui)
11
+ - [数据保护](#数据保护) · [数据目录](#数据目录) · [覆写配置](#覆写配置) · [内置配置优化](#内置配置优化) · [Web UI](#web-ui)
12
12
  - [故障排除](#故障排除) · [安全特性](#安全特性)
13
13
 
14
14
  ## 功能特性
@@ -466,6 +466,16 @@ mihomo-cli start --update-timeout=30000
466
466
 
467
467
  文件格式、加载顺序、YAML 操作符、JS 契约、match、多机场与 SSH 示例见 [覆写配置详版](docs/overwrite.md)
468
468
 
469
+ ## 内置配置优化
470
+
471
+ 构建候选配置时,CLI 会先对订阅应用以下默认优化,再执行用户覆写;原始订阅文件不会被修改,覆写仍可覆盖优化结果
472
+
473
+ - **中国域名 DNS 使用独立规则集**:常见的 `geosite:cn,private` / `geosite:private,cn` 策略改用上游完整 CN/private MRS,避免 `geosite-lite.dat` 的精简 CN 集合漏判。规则集每天更新并通过 `DIRECT` 下载,只改变 DNS 选路,不额外增加域名直连规则;混合其他 GeoSite 分类时保持原配置
474
+ - **国内 DNS 去重**:列表全部属于阿里、腾讯的已知重复 DoH/DoT 写法时,收敛为 `https://223.5.5.5/dns-query` 和 `https://1.12.12.12/dns-query` 两路;含自定义地址的列表原样保留
475
+ - **自动测速减少小幅跳动**:`url-test` 未设置 `tolerance` 时默认使用 `50`,已有显式数值不受影响
476
+
477
+ 内置 provider 名为 `mihomo-cli-cn` 和 `mihomo-cli-private`。订阅已经使用同名 provider 时,CLI 不覆盖其定义,也不替换对应的 GeoSite 策略
478
+
469
479
  ## Web UI
470
480
 
471
481
  `mihomo-cli ui` 打开以下**在线页面**,需要联网;CLI 不下载或托管这些前端:
@@ -513,7 +523,9 @@ mihomo-cli doctor
513
523
 
514
524
  清单按总开关、文件开关和 `match` 选择;脚本列入只表示会被调用,不证明它实际修改了配置。没有文件参与时不显示这一段。若订阅与覆写都看似正常,也可能是内核过旧,可尝试 `mihomo-cli kernel`
515
525
 
516
- 校验通过后仍需确认进程运行,端口占用、权限等启动问题会报错并附日志信息:
526
+ 校验通过后仍需确认进程运行。开机等慢启动场景中,如果 launchd 已装载服务但尚未进入运行状态,`start` 会等待而不是卸载重试;等待超时显示「启动待确认」,服务仍由 launchd 继续启动,无需重复执行 `start`,可稍后运行 `mihomo-cli status` 确认
527
+
528
+ 端口占用、权限问题或内核异常退出会报错并附日志信息:
517
529
 
518
530
  ```bash
519
531
  mihomo-cli logs 0 # 查看日志
package/dist/index.js CHANGED
@@ -4704,6 +4704,71 @@ function parseConfigContent(content, errorMsg) {
4704
4704
  function dumpYaml(obj) {
4705
4705
  return dump(obj, { indent: 2, lineWidth: -1 });
4706
4706
  }
4707
+ var DEFAULT_URL_TEST_TOLERANCE = 50;
4708
+ var DOMESTIC_DNS_SERVERS = ["https://223.5.5.5/dns-query", "https://1.12.12.12/dns-query"];
4709
+ var REDUNDANT_DOMESTIC_DNS_SERVERS = /* @__PURE__ */ new Set([
4710
+ ...DOMESTIC_DNS_SERVERS,
4711
+ "https://doh.pub/dns-query",
4712
+ "https://dns.alidns.com/dns-query",
4713
+ "tls://223.5.5.5#skip-cert-verify=true",
4714
+ "tls://dot.pub#skip-cert-verify=true",
4715
+ "tls://dns.alidns.com#skip-cert-verify=true"
4716
+ ]);
4717
+ var CN_PROVIDER_NAME = "mihomo-cli-cn";
4718
+ var PRIVATE_PROVIDER_NAME = "mihomo-cli-private";
4719
+ var CN_PRIVATE_RULE_SET_POLICY = `rule-set:${CN_PROVIDER_NAME},${PRIVATE_PROVIDER_NAME}`;
4720
+ var CN_PRIVATE_GEOSITE_POLICIES = ["geosite:private,cn", "geosite:cn,private"];
4721
+ var RULE_PROVIDER_URL_BASE = "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@meta/geo/geosite";
4722
+ function compactDomesticNameservers(value) {
4723
+ if (!Array.isArray(value) || value.length <= DOMESTIC_DNS_SERVERS.length) return value;
4724
+ if (!value.every((item) => typeof item === "string" && REDUNDANT_DOMESTIC_DNS_SERVERS.has(item))) return value;
4725
+ return [...DOMESTIC_DNS_SERVERS];
4726
+ }
4727
+ function createDomainRuleProvider(category) {
4728
+ return {
4729
+ type: "http",
4730
+ behavior: "domain",
4731
+ format: "mrs",
4732
+ proxy: "DIRECT",
4733
+ interval: 86400,
4734
+ path: `./provider/rule-set/mihomo-cli-${category}.mrs`,
4735
+ url: `${RULE_PROVIDER_URL_BASE}/${category}.mrs`
4736
+ };
4737
+ }
4738
+ function applySubscriptionDefaults(config) {
4739
+ const groups = config["proxy-groups"];
4740
+ if (Array.isArray(groups)) {
4741
+ for (const group of groups) {
4742
+ if (isPlainObject(group) && group.type === "url-test" && !Object.hasOwn(group, "tolerance")) {
4743
+ group.tolerance = DEFAULT_URL_TEST_TOLERANCE;
4744
+ }
4745
+ }
4746
+ }
4747
+ if (!isPlainObject(config.dns)) return;
4748
+ const dns = config.dns;
4749
+ for (const key of ["proxy-server-nameserver", "direct-nameserver"]) {
4750
+ if (key in dns) dns[key] = compactDomesticNameservers(dns[key]);
4751
+ }
4752
+ const policy = dns["nameserver-policy"];
4753
+ if (!isPlainObject(policy)) return;
4754
+ for (const [key, value] of Object.entries(policy)) {
4755
+ const compacted = compactDomesticNameservers(value);
4756
+ if (compacted !== value) policy[key] = compacted;
4757
+ }
4758
+ const geoPolicyKey = CN_PRIVATE_GEOSITE_POLICIES.find((key) => Object.hasOwn(policy, key));
4759
+ if (!geoPolicyKey || Object.hasOwn(policy, CN_PRIVATE_RULE_SET_POLICY)) return;
4760
+ const rawProviders = config["rule-providers"];
4761
+ if (rawProviders !== void 0 && rawProviders !== null && !isPlainObject(rawProviders)) return;
4762
+ const providers = isPlainObject(rawProviders) ? rawProviders : {};
4763
+ if (Object.hasOwn(providers, CN_PROVIDER_NAME) || Object.hasOwn(providers, PRIVATE_PROVIDER_NAME)) return;
4764
+ const nameservers = policy[geoPolicyKey];
4765
+ delete policy[geoPolicyKey];
4766
+ policy[CN_PRIVATE_RULE_SET_POLICY] = nameservers;
4767
+ providers[CN_PROVIDER_NAME] = createDomainRuleProvider("cn");
4768
+ providers[PRIVATE_PROVIDER_NAME] = createDomainRuleProvider("private");
4769
+ config["rule-providers"] = providers;
4770
+ if (!Object.hasOwn(policy, "+.jsdelivr.net")) policy["+.jsdelivr.net"] = [...DOMESTIC_DNS_SERVERS];
4771
+ }
4707
4772
  function assertDnsShape(dnsRaw) {
4708
4773
  if (dnsRaw === void 0 || dnsRaw === null) return;
4709
4774
  if (!isPlainObject(dnsRaw)) {
@@ -4766,6 +4831,7 @@ function assertConfigShape(config) {
4766
4831
  }
4767
4832
  function buildConfig(subRawContent, mode, scope) {
4768
4833
  const subscriptionConfig = parseConfigContent(subRawContent, "\u8BA2\u9605\u5185\u5BB9");
4834
+ applySubscriptionDefaults(subscriptionConfig);
4769
4835
  const settings = readSettings();
4770
4836
  const allFiles = isOverwriteEnabled(settings) ? loadOverwriteFile() : [];
4771
4837
  const overwriteFiles = selectActiveOverwriteFiles(allFiles, scope);
@@ -6408,14 +6474,22 @@ function startAbortedByConcurrentStop() {
6408
6474
  // src/service.ts
6409
6475
  var SERVICE_HEALTH_INTERVAL_MS = 100;
6410
6476
  var SERVICE_OBSERVE_MS = 1200;
6411
- var SERVICE_HEALTH_GRACE_MS = 1800;
6412
- async function waitServiceHealthy() {
6413
- const deadline = Date.now() + SERVICE_OBSERVE_MS;
6414
- const graceDeadline = deadline + SERVICE_HEALTH_GRACE_MS;
6477
+ var SERVICE_STARTUP_TIMEOUT_MS = 9e4;
6478
+ var SERVICE_STARTUP_MAX_INTERVAL_MS = 1e3;
6479
+ var SERVICE_QUERY_STALE_MS = 3e3;
6480
+ function healthyResult(pid) {
6481
+ return { healthy: true, crashed: false, pending: false, pid, exitCode: null, terminatingSignal: null };
6482
+ }
6483
+ async function waitServiceHealthy(options = {}) {
6484
+ const startedAt = Date.now();
6485
+ const deadline = startedAt + SERVICE_OBSERVE_MS;
6486
+ const startupDeadline = startedAt + (options.startupTimeoutMs ?? SERVICE_STARTUP_TIMEOUT_MS);
6487
+ let lastSuccessfulQueryAt = startedAt;
6415
6488
  let last = null;
6416
6489
  const unhealthy = (state, crashed, pid = null) => ({
6417
6490
  healthy: false,
6418
6491
  crashed,
6492
+ pending: !crashed && state.loaded,
6419
6493
  pid,
6420
6494
  exitCode: state.lastExitCode,
6421
6495
  terminatingSignal: state.lastTerminatingSignal
@@ -6424,6 +6498,7 @@ async function waitServiceHealthy() {
6424
6498
  await sleep3(SERVICE_HEALTH_INTERVAL_MS);
6425
6499
  try {
6426
6500
  last = getServiceStatus({ withDisabled: false });
6501
+ lastSuccessfulQueryAt = Date.now();
6427
6502
  } catch {
6428
6503
  continue;
6429
6504
  }
@@ -6435,32 +6510,33 @@ async function waitServiceHealthy() {
6435
6510
  }
6436
6511
  } while (Date.now() < deadline);
6437
6512
  if (last === null) return healthViaProcessProbe();
6438
- if (last.running) return { healthy: true, crashed: false, pid: last.pid, exitCode: null, terminatingSignal: null };
6439
- let graceQueried = false;
6440
- while (Date.now() < graceDeadline) {
6441
- await sleep3(SERVICE_HEALTH_INTERVAL_MS);
6513
+ if (last.running) return healthyResult(last.pid);
6514
+ let startupIntervalMs = SERVICE_HEALTH_INTERVAL_MS;
6515
+ while (Date.now() < startupDeadline) {
6516
+ await sleep3(startupIntervalMs);
6517
+ startupIntervalMs = Math.min(startupIntervalMs * 2, SERVICE_STARTUP_MAX_INTERVAL_MS);
6442
6518
  try {
6443
6519
  last = getServiceStatus({ withDisabled: false });
6520
+ lastSuccessfulQueryAt = Date.now();
6444
6521
  } catch {
6522
+ if (Date.now() - lastSuccessfulQueryAt >= SERVICE_QUERY_STALE_MS) return healthViaProcessProbe();
6445
6523
  continue;
6446
6524
  }
6447
- graceQueried = true;
6448
6525
  if (isCrashed(last)) {
6449
6526
  return unhealthy(last, true);
6450
6527
  }
6451
- if (!last.loaded) break;
6452
- if (last.running) return { healthy: true, crashed: false, pid: last.pid, exitCode: null, terminatingSignal: null };
6528
+ if (!last.loaded) return unhealthy(last, false);
6529
+ if (last.running) return healthyResult(last.pid);
6453
6530
  }
6454
- if (!graceQueried) return healthViaProcessProbe();
6455
6531
  return unhealthy(last, false, last.pid);
6456
6532
  }
6457
6533
  function healthViaProcessProbe() {
6458
6534
  try {
6459
6535
  const pids = getMihomoPids();
6460
- if (pids.length > 0) return { healthy: true, crashed: false, pid: pids[0], exitCode: null, terminatingSignal: null };
6536
+ if (pids.length > 0) return healthyResult(pids[0]);
6461
6537
  } catch {
6462
6538
  }
6463
- return { healthy: false, crashed: false, pid: null, exitCode: null, terminatingSignal: null };
6539
+ return { healthy: false, crashed: false, pending: false, pid: null, exitCode: null, terminatingSignal: null };
6464
6540
  }
6465
6541
  function describeExitCause(exitCode, terminatingSignal) {
6466
6542
  if (terminatingSignal !== null) return `\u88AB\u4FE1\u53F7\u7EC8\u6B62\uFF08${terminatingSignal}\uFF09`;
@@ -6471,6 +6547,9 @@ function isCrashed(status) {
6471
6547
  if (status.running) return false;
6472
6548
  return describeExitCause(status.lastExitCode, status.lastTerminatingSignal) !== null;
6473
6549
  }
6550
+ function isServiceLaunchPending(status) {
6551
+ return status.loaded && !status.running && !status.disabled && !isCrashed(status);
6552
+ }
6474
6553
  function describeAbnormalExit(status) {
6475
6554
  return describeExitCause(status.lastExitCode, status.lastTerminatingSignal);
6476
6555
  }
@@ -6534,7 +6613,7 @@ function bootoutService(timeoutMs = LAUNCHCTL_TIMEOUT_MS) {
6534
6613
  hint: [detail, `\u624B\u52A8\u786E\u8BA4: launchctl print ${serviceTarget()}`].filter(Boolean)
6535
6614
  });
6536
6615
  }
6537
- async function installService(wasRunning) {
6616
+ async function installService(restoreAfterInstall) {
6538
6617
  assertServiceLabelSafe();
6539
6618
  ensureDirs();
6540
6619
  ensureServiceSymlink();
@@ -6552,7 +6631,7 @@ async function installService(wasRunning) {
6552
6631
  await waitUntilUnloaded();
6553
6632
  fs11.mkdirSync(path7.dirname(PATHS.userAgentPlist), { recursive: true });
6554
6633
  atomicWriteFileSync(PATHS.userAgentPlist, fs11.readFileSync(stagePath, "utf8"), { mode: 420 });
6555
- if (wasRunning) {
6634
+ if (restoreAfterInstall) {
6556
6635
  withFileLock(PATHS.serviceLock, () => {
6557
6636
  if (startAbortedByConcurrentStop()) {
6558
6637
  restoreSkipped = true;
@@ -6568,7 +6647,7 @@ async function installService(wasRunning) {
6568
6647
  } catch {
6569
6648
  }
6570
6649
  }
6571
- if (!wasRunning) {
6650
+ if (!restoreAfterInstall) {
6572
6651
  disableServiceAutoStart();
6573
6652
  }
6574
6653
  return { restoreSkipped };
@@ -6760,7 +6839,15 @@ async function launchOrRestart(mode) {
6760
6839
  await throwIfTunStartCancelled();
6761
6840
  return pid;
6762
6841
  }
6763
- const status = getServiceStatus();
6842
+ let status = getServiceStatus();
6843
+ if (isServiceLaunchPending(status)) {
6844
+ const pendingPid = await confirmServiceHealth();
6845
+ try {
6846
+ status = getServiceStatus();
6847
+ } catch {
6848
+ }
6849
+ if (isServiceLaunchPending(status)) status = { ...status, running: true, pid: pendingPid };
6850
+ }
6764
6851
  let hotReloaded = false;
6765
6852
  let started;
6766
6853
  if (status.running && !status.disabled) {
@@ -6776,6 +6863,9 @@ async function launchOrRestart(mode) {
6776
6863
  return null;
6777
6864
  }
6778
6865
  }
6866
+ return await confirmServiceHealth();
6867
+ }
6868
+ async function confirmServiceHealth() {
6779
6869
  try {
6780
6870
  return await assertServiceHealthy();
6781
6871
  } catch (e) {
@@ -6816,9 +6906,22 @@ function assertTunStartNotRaced() {
6816
6906
  function startCommandForCurrentMode(state) {
6817
6907
  return state.kind === "tun" ? "mihomo-cli start tun" : "mihomo-cli start";
6818
6908
  }
6819
- async function assertServiceHealthy(label = "\u542F\u52A8\u5931\u8D25") {
6820
- const health = await waitServiceHealthy();
6909
+ var ServiceLaunchPendingError = class extends CliError {
6910
+ };
6911
+ async function assertServiceHealthy(label = "\u542F\u52A8\u5931\u8D25", options = {}) {
6912
+ const health = await waitServiceHealthy(options);
6821
6913
  if (health.healthy) return health.pid;
6914
+ if (health.pending) {
6915
+ throw new ServiceLaunchPendingError("\u670D\u52A1\u4ECD\u5728\u542F\u52A8\uFF0C\u6682\u672A\u786E\u8BA4\u53EF\u7528", {
6916
+ label: "\u542F\u52A8\u5F85\u786E\u8BA4",
6917
+ hint: [
6918
+ "launchd \u4ECD\u5728\u542F\u52A8\u8BE5\u670D\u52A1\uFF1B\u672C\u6B21\u7B49\u5F85\u5DF2\u7ED3\u675F\uFF0C\u4F46\u670D\u52A1\u672A\u88AB\u505C\u6B62\u6216\u91CD\u542F\u3002",
6919
+ "\u65E0\u9700\u91CD\u590D\u6267\u884C mihomo-cli start\uFF0C\u7A0D\u540E\u786E\u8BA4: mihomo-cli status",
6920
+ "",
6921
+ "\u5B8C\u6574\u65E5\u5FD7: mihomo-cli logs 0"
6922
+ ]
6923
+ });
6924
+ }
6822
6925
  const tail = readLogTail();
6823
6926
  const cause = describeExitCause(health.exitCode, health.terminatingSignal);
6824
6927
  const reason = health.crashed ? `\u5185\u6838\u542F\u52A8\u540E\u7ACB\u5373\u9000\u51FA\uFF08${cause ?? "\u6B7B\u56E0\u672A\u8BB0\u5F55"}\uFF09` : "\u5185\u6838\u672A\u80FD\u8FDB\u5165\u8FD0\u884C\u72B6\u6001";
@@ -8770,8 +8873,9 @@ async function cmdInstall(args) {
8770
8873
  assertKnownFlags(args.slice(1), [], "install");
8771
8874
  assertPositionalCount(args, 0, 1, "mihomo-cli install");
8772
8875
  assertKernelInstalled();
8773
- const wasRunning = getServiceStatus().running;
8774
- const { restoreSkipped } = await installService(wasRunning);
8876
+ const serviceBefore = getServiceStatus();
8877
+ const restoreAfterInstall = serviceBefore.running || isServiceLaunchPending(serviceBefore);
8878
+ const { restoreSkipped } = await installService(restoreAfterInstall);
8775
8879
  console.log(`${colors.green("\u5DF2\u5B89\u88C5\u670D\u52A1")}`);
8776
8880
  console.log(colors.gray(` plist: ${PATHS.userAgentPlist}`));
8777
8881
  console.log(colors.gray(` \u767B\u5F55\u9879\u4E0E\u6269\u5C55\u4E2D\u663E\u793A\u4E3A: ${SERVICE_BINARY_NAME}`));
@@ -8780,7 +8884,7 @@ async function cmdInstall(args) {
8780
8884
  printRestoreSkipped();
8781
8885
  return;
8782
8886
  }
8783
- if (wasRunning) {
8887
+ if (restoreAfterInstall) {
8784
8888
  try {
8785
8889
  await assertServiceHealthy("\u6062\u590D\u8FD0\u884C\u5931\u8D25");
8786
8890
  } catch (e) {
@@ -8790,7 +8894,7 @@ async function cmdInstall(args) {
8790
8894
  return;
8791
8895
  }
8792
8896
  throw relabelCliError(e, {
8793
- hint: [...e.hint, "", "\u670D\u52A1\u5DF2\u5B89\u88C5\u6210\u529F\uFF0C\u4EC5\u6062\u590D\u8FD0\u884C\u5931\u8D25\uFF1B\u4FEE\u6B63\u914D\u7F6E\u540E\u53EF\u6267\u884C mihomo-cli start \u91CD\u8BD5\u3002"]
8897
+ hint: e instanceof ServiceLaunchPendingError ? [...e.hint, "", "\u670D\u52A1\u5DF2\u5B89\u88C5\u6210\u529F\uFF1B\u6062\u590D\u8FD0\u884C\u5C1A\u672A\u786E\u8BA4\uFF0C\u4E0D\u5F71\u54CD launchd \u7EE7\u7EED\u542F\u52A8\u3002"] : [...e.hint, "", "\u670D\u52A1\u5DF2\u5B89\u88C5\u6210\u529F\uFF0C\u4EC5\u6062\u590D\u8FD0\u884C\u5931\u8D25\uFF1B\u4FEE\u6B63\u914D\u7F6E\u540E\u53EF\u6267\u884C mihomo-cli start \u91CD\u8BD5\u3002"]
8794
8898
  });
8795
8899
  }
8796
8900
  console.log(colors.green("\u5DF2\u6309\u539F\u72B6\u6001\u91CD\u65B0\u542F\u52A8"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mihomo-cli",
3
- "version": "26.11.118",
3
+ "version": "26.11.120",
4
4
  "type": "module",
5
5
  "description": "A terminal-based mihomo (Clash.Meta) client for macOS",
6
6
  "bin": {