claude-codex-wechat 0.1.26 → 0.1.27

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.
Files changed (2) hide show
  1. package/dist/server/cli.js +22 -25
  2. package/package.json +1 -1
@@ -4943,20 +4943,12 @@ var execFileAsync = promisify(execFile);
4943
4943
  async function installService(context) {
4944
4944
  if (process.platform === "darwin") {
4945
4945
  const spec = buildLaunchdSpec(context);
4946
- await mkdir4(dirname8(spec.plistPath), { recursive: true });
4947
- await mkdir4(dirname8(spec.stdoutPath), { recursive: true });
4948
- await writeFile4(spec.plistPath, renderLaunchdPlist(spec), "utf8");
4949
- const guiDomain = `gui/${process.getuid?.() ?? 0}`;
4950
- await runLaunchctl(["bootout", guiDomain, spec.plistPath]).catch(() => void 0);
4951
- await runLaunchctl(["bootstrap", guiDomain, spec.plistPath]);
4952
- await runLaunchctl(["kickstart", "-k", `${guiDomain}/${spec.label}`]);
4946
+ await applyLaunchdService(spec);
4953
4947
  return await readServiceStatus(context);
4954
4948
  }
4955
4949
  if (process.platform === "linux") {
4956
4950
  const spec = buildSystemdUserSpec(context);
4957
- await mkdir4(dirname8(spec.unitPath), { recursive: true });
4958
- await mkdir4(dirname8(spec.stdoutPath), { recursive: true });
4959
- await writeFile4(spec.unitPath, renderSystemdUnit(spec), "utf8");
4951
+ await writeSystemdUnit(spec);
4960
4952
  await runSystemctl(["--user", "daemon-reload"]);
4961
4953
  await runSystemctl(["--user", "enable", "--now", spec.unitName]);
4962
4954
  return await readServiceStatus(context);
@@ -4969,15 +4961,13 @@ async function installService(context) {
4969
4961
  async function startService(context) {
4970
4962
  if (process.platform === "darwin") {
4971
4963
  const spec = buildLaunchdSpec(context);
4972
- await ensureFileExists(spec.plistPath, "service_not_installed");
4973
- const guiDomain = `gui/${process.getuid?.() ?? 0}`;
4974
- await runLaunchctl(["bootstrap", guiDomain, spec.plistPath]).catch(() => void 0);
4975
- await runLaunchctl(["kickstart", "-k", `${guiDomain}/${spec.label}`]);
4964
+ await applyLaunchdService(spec);
4976
4965
  return await readServiceStatus(context);
4977
4966
  }
4978
4967
  if (process.platform === "linux") {
4979
4968
  const spec = buildSystemdUserSpec(context);
4980
- await ensureFileExists(spec.unitPath, "service_not_installed");
4969
+ await writeSystemdUnit(spec);
4970
+ await runSystemctl(["--user", "daemon-reload"]);
4981
4971
  await runSystemctl(["--user", "start", spec.unitName]);
4982
4972
  return await readServiceStatus(context);
4983
4973
  }
@@ -5042,16 +5032,13 @@ async function uninstallService(context) {
5042
5032
  async function restartService(context) {
5043
5033
  if (process.platform === "darwin") {
5044
5034
  const spec = buildLaunchdSpec(context);
5045
- await ensureFileExists(spec.plistPath, "service_not_installed");
5046
- const guiDomain = `gui/${process.getuid?.() ?? 0}`;
5047
- await runLaunchctl(["bootstrap", guiDomain, spec.plistPath]).catch(() => void 0);
5048
- await runLaunchctl(["kickstart", "-k", `${guiDomain}/${spec.label}`]);
5035
+ await applyLaunchdService(spec);
5049
5036
  return await readServiceStatus(context);
5050
5037
  }
5051
5038
  if (process.platform === "linux") {
5052
5039
  const spec = buildSystemdUserSpec(context);
5053
- await ensureFileExists(spec.unitPath, "service_not_installed");
5054
- await runSystemctl(["--user", "daemon-reload"]).catch(() => void 0);
5040
+ await writeSystemdUnit(spec);
5041
+ await runSystemctl(["--user", "daemon-reload"]);
5055
5042
  await runSystemctl(["--user", "restart", spec.unitName]);
5056
5043
  return await readServiceStatus(context);
5057
5044
  }
@@ -5184,6 +5171,20 @@ function buildServiceEnvironment(context) {
5184
5171
  }
5185
5172
  return env;
5186
5173
  }
5174
+ async function applyLaunchdService(spec) {
5175
+ await mkdir4(dirname8(spec.plistPath), { recursive: true });
5176
+ await mkdir4(dirname8(spec.stdoutPath), { recursive: true });
5177
+ await writeFile4(spec.plistPath, renderLaunchdPlist(spec), "utf8");
5178
+ const guiDomain = `gui/${process.getuid?.() ?? 0}`;
5179
+ await runLaunchctl(["bootout", guiDomain, spec.plistPath]).catch(() => void 0);
5180
+ await runLaunchctl(["bootstrap", guiDomain, spec.plistPath]);
5181
+ await runLaunchctl(["kickstart", "-k", `${guiDomain}/${spec.label}`]);
5182
+ }
5183
+ async function writeSystemdUnit(spec) {
5184
+ await mkdir4(dirname8(spec.unitPath), { recursive: true });
5185
+ await mkdir4(dirname8(spec.stdoutPath), { recursive: true });
5186
+ await writeFile4(spec.unitPath, renderSystemdUnit(spec), "utf8");
5187
+ }
5187
5188
  function renderLaunchdPlist(spec) {
5188
5189
  const programArgs = spec.programArgs.map((arg) => ` <string>${escapeXml(arg)}</string>`).join("\n");
5189
5190
  const envEntries = Object.entries(spec.environment).map(([key, value]) => ` <key>${escapeXml(key)}</key>
@@ -5315,10 +5316,6 @@ async function spawnDetachedDaemon(spec) {
5315
5316
  closeSync2(errFd);
5316
5317
  }
5317
5318
  }
5318
- async function ensureFileExists(path, errorCode) {
5319
- if (!existsSync9(path)) throw new Error(errorCode);
5320
- await readFile6(path, "utf8");
5321
- }
5322
5319
  async function tailFile(path, lines) {
5323
5320
  if (!existsSync9(path)) return "";
5324
5321
  const content = await readFile6(path, "utf8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-codex-wechat",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.5.0",