mioku 1.2.1 → 1.2.3

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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { buildSpawnPlan, commandExists, compareVersions, pickHighestVersion, resolveCommand, runCommand, runCommandInherit, version } from "./exec-CBlGXt5y.js";
1
+ import { buildSpawnPlan, commandExists, compareVersions, pickHighestVersion, resolveCommand, runCommand, runCommandInherit, version } from "./exec-BPj3FRdI.js";
2
2
  import { createRequire } from "node:module";
3
3
  import * as fs$5 from "node:fs";
4
4
  import * as fs$4 from "node:fs";
@@ -450,7 +450,7 @@ var MessageImpl = class extends Array {
450
450
  return this.map((seg) => seg.toString()).join("");
451
451
  }
452
452
  text() {
453
- return this.raw_message ?? this.filterByType("text").map((seg) => String(seg.data.text ?? "")).join("");
453
+ return this.filterByType("text").map((seg) => String(seg.data.text ?? "")).join("");
454
454
  }
455
455
  filterByType(type) {
456
456
  return this.filter((seg) => seg.type === type);
@@ -4112,6 +4112,11 @@ function ensureDataDir(pluginName) {
4112
4112
  //#endregion
4113
4113
  //#region src/builtin/core/system/restart.ts
4114
4114
  const isInPm2 = Boolean(typeof process !== "undefined" && (process.env.PM2_HOME || process.env.PM2 || process.env.pm_id));
4115
+ const isSupervised = [
4116
+ "1",
4117
+ "true",
4118
+ "yes"
4119
+ ].includes(String(process.env.MIOKU_SUPERVISED ?? "").trim().toLowerCase());
4115
4120
  const RESTART_MARKER_PATH = path$4.join(getPluginDataDir("core"), "restart.json");
4116
4121
  function ensureDataDir$1() {
4117
4122
  const dir = path$4.dirname(RESTART_MARKER_PATH);
@@ -4186,6 +4191,11 @@ function triggerRestart(marker) {
4186
4191
  setTimeout(() => process.exit(0), 300);
4187
4192
  return;
4188
4193
  }
4194
+ if (isSupervised) {
4195
+ rootLogger.info("[core] 检测到受管运行环境,退出进程后由守护方自动重启");
4196
+ setTimeout(() => process.exit(0), 300);
4197
+ return;
4198
+ }
4189
4199
  const scriptPath = writeRestartScript();
4190
4200
  try {
4191
4201
  const child = spawn(process.platform === "win32" ? "cmd.exe" : "sh", process.platform === "win32" ? ["/c", scriptPath] : [scriptPath], {