deskbuddy 0.2.0-beta.27 → 0.2.0-beta.28

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.
@@ -132,7 +132,10 @@ function loadConfig() {
132
132
  workbuddyCdpPort: typeof parsed.workbuddyCdpPort === "number" && Number.isInteger(parsed.workbuddyCdpPort) && parsed.workbuddyCdpPort >= 1024 && parsed.workbuddyCdpPort <= 65535 ? parsed.workbuddyCdpPort : void 0,
133
133
  qoderAppTask: typeof parsed.qoderAppTask === "boolean" ? parsed.qoderAppTask : void 0,
134
134
  qoderCnCdpPort: portOrUndefined(parsed.qoderCnCdpPort),
135
- qoderCdpPort: portOrUndefined(parsed.qoderCdpPort)
135
+ qoderCdpPort: portOrUndefined(parsed.qoderCdpPort),
136
+ qwenworkAppApproval: typeof parsed.qwenworkAppApproval === "boolean" ? parsed.qwenworkAppApproval : void 0,
137
+ qwenworkCdpPort: portOrUndefined(parsed.qwenworkCdpPort),
138
+ qwenworkNewTask: typeof parsed.qwenworkNewTask === "boolean" ? parsed.qwenworkNewTask : void 0
136
139
  };
137
140
  } catch {
138
141
  return fallback;
@@ -718,6 +721,7 @@ function isOurLauncherCmdline(cmdline) {
718
721
  return i >= 1 && argv[i + 1] === "daemon";
719
722
  }
720
723
  async function stopPidFileDaemon() {
724
+ markIntentionalStop();
721
725
  await stopByPidFile(launcherPidPath(), isOurLauncherCmdline);
722
726
  await stopByPidFile(pidFilePath(), isOurDaemonCmdline);
723
727
  }
@@ -803,6 +807,7 @@ async function installAutostart(t, platform = process.platform, opts = {}) {
803
807
  return { ok: false, message: `DESKBUDDY_HOME \u4E0D\u662F\u9ED8\u8BA4\u76EE\u5F55\uFF08${opts.home ?? deskbuddyHome()}\uFF09\uFF0C\u6CA1\u6709\u8BBE\u7F6E\u5F00\u673A\u81EA\u542F\uFF0C\u9700\u8981\u65F6\u8BF7\u624B\u52A8\u8DD1 deskbuddy daemon` };
804
808
  }
805
809
  try {
810
+ markIntentionalStop();
806
811
  if (platform === "darwin") {
807
812
  const p = launchAgentPath();
808
813
  write(p, launchAgentPlist(t));
@@ -819,6 +824,7 @@ async function installAutostart(t, platform = process.platform, opts = {}) {
819
824
  write(systemdUnitPath(), systemdUnit(t));
820
825
  await run("systemctl", ["--user", "daemon-reload"]);
821
826
  await run("systemctl", ["--user", "enable", "--now", SYSTEMD_UNIT]);
827
+ markIntentionalStop();
822
828
  await run("systemctl", ["--user", "restart", SYSTEMD_UNIT]);
823
829
  return { ok: true, message: "\u5DF2\u8BBE\u7F6E\u5F00\u673A\u81EA\u542F\uFF08systemd --user\uFF09" };
824
830
  }
@@ -854,6 +860,7 @@ function defaultUninstallDeps() {
854
860
  systemdUnitPath: systemdUnitPath(),
855
861
  winStartupVbsPath: winStartupVbsPath(),
856
862
  stopDaemon: stopPidFileDaemon,
863
+ markStop: (home) => markIntentionalStop(home),
857
864
  log: () => {
858
865
  }
859
866
  };
@@ -891,6 +898,7 @@ async function uninstallAutostart(platform = process.platform, deps = {}) {
891
898
  }
892
899
  }
893
900
  try {
901
+ d.markStop(d.home);
894
902
  if (platform === "darwin") {
895
903
  await d.run("launchctl", ["bootout", `gui/${process.getuid?.() ?? 501}/${LAUNCH_LABEL}`]).catch(() => {
896
904
  });
@@ -920,6 +928,32 @@ async function uninstallAutostart(platform = process.platform, deps = {}) {
920
928
  function pidFilePath() {
921
929
  return join4(deskbuddyHome(), "daemon.pid");
922
930
  }
931
+ var STOP_MARK_FILE = "daemon.stopping";
932
+ var STOP_MARK_TTL_MS = 2 * 60 * 1e3;
933
+ function stopMarkPath(home = deskbuddyHome()) {
934
+ return join4(home, STOP_MARK_FILE);
935
+ }
936
+ function markIntentionalStop(home = deskbuddyHome(), now = Date.now()) {
937
+ try {
938
+ mkdirSync4(home, { recursive: true });
939
+ writeFileSync4(stopMarkPath(home), String(now), "utf8");
940
+ } catch {
941
+ }
942
+ }
943
+ function intentionalStopFresh(home = deskbuddyHome(), now = Date.now()) {
944
+ try {
945
+ const t = Number(readFileSync4(stopMarkPath(home), "utf8").trim());
946
+ return Number.isFinite(t) && t > 0 && now - t >= 0 && now - t < STOP_MARK_TTL_MS;
947
+ } catch {
948
+ return false;
949
+ }
950
+ }
951
+ function clearIntentionalStop(home = deskbuddyHome()) {
952
+ try {
953
+ rmSync2(stopMarkPath(home), { force: true });
954
+ } catch {
955
+ }
956
+ }
923
957
  function launcherPidPath() {
924
958
  return join4(deskbuddyHome(), "launcher.pid");
925
959
  }
@@ -4359,7 +4393,7 @@ var defaultLoginOpenDeps = () => ({
4359
4393
  });
4360
4394
  async function installCodebuddyHooks(log) {
4361
4395
  try {
4362
- const { installTools: installTools2 } = await import("./enable-5LD65FLH.js");
4396
+ const { installTools: installTools2 } = await import("./enable-3RAZKEON.js");
4363
4397
  installTools2(["workbuddy"], () => {
4364
4398
  }, null, { auto: true });
4365
4399
  } catch (e) {
@@ -4928,7 +4962,7 @@ function defaultOfferDeps(log) {
4928
4962
  }),
4929
4963
  openLogin: () => defaultOpenLogin(platform),
4930
4964
  installHooks: async () => {
4931
- const { installTools: installTools2 } = await import("./enable-5LD65FLH.js");
4965
+ const { installTools: installTools2 } = await import("./enable-3RAZKEON.js");
4932
4966
  installTools2(["workbuddy"], (l) => log(`[WorkBuddy \u72EC\u7ACB\u7248] ${l}`), null, { auto: true });
4933
4967
  },
4934
4968
  log: (l) => log(`[WorkBuddy \u72EC\u7ACB\u7248] ${l}`),
@@ -5214,6 +5248,8 @@ export {
5214
5248
  installAutostart,
5215
5249
  uninstallAutostart,
5216
5250
  pidFilePath,
5251
+ intentionalStopFresh,
5252
+ clearIntentionalStop,
5217
5253
  launcherPidPath,
5218
5254
  autostartTarget,
5219
5255
  hasVendoredPty,