claude-codex-wechat 0.1.55 → 0.1.56
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/server/cli.js +39 -1
- package/package.json +1 -1
package/dist/server/cli.js
CHANGED
|
@@ -6450,6 +6450,37 @@ async function performUpgrade(deps) {
|
|
|
6450
6450
|
return { outcome: "upgraded", from: currentVersion, to: latest };
|
|
6451
6451
|
}
|
|
6452
6452
|
|
|
6453
|
+
// src/daemon/entrypoint.ts
|
|
6454
|
+
import { posix, win32 } from "node:path";
|
|
6455
|
+
var PACKAGE_NAME = "claude-codex-wechat";
|
|
6456
|
+
var PACKAGE_ENTRY = ["dist", "server", "cli.js"];
|
|
6457
|
+
function resolveDaemonEntrypoint(input) {
|
|
6458
|
+
if (input.override) return input.override;
|
|
6459
|
+
const path = input.platform === "win32" ? win32 : posix;
|
|
6460
|
+
if (isInsideNodeModules(input.currentPath, path)) return input.currentPath;
|
|
6461
|
+
for (const root of globalNodeModulesCandidates(input, path)) {
|
|
6462
|
+
const candidate = path.join(root, PACKAGE_NAME, ...PACKAGE_ENTRY);
|
|
6463
|
+
if (input.exists(candidate)) return candidate;
|
|
6464
|
+
}
|
|
6465
|
+
return input.currentPath;
|
|
6466
|
+
}
|
|
6467
|
+
function isInsideNodeModules(target, path) {
|
|
6468
|
+
return target.split(path.sep).includes("node_modules");
|
|
6469
|
+
}
|
|
6470
|
+
function globalNodeModulesCandidates(input, path) {
|
|
6471
|
+
const nodeDir = path.dirname(input.execPath);
|
|
6472
|
+
const candidates = [...input.globalNodeModules ?? []];
|
|
6473
|
+
if (input.platform === "win32") {
|
|
6474
|
+
candidates.push(path.join(nodeDir, "node_modules"));
|
|
6475
|
+
return candidates;
|
|
6476
|
+
}
|
|
6477
|
+
candidates.push(path.join(nodeDir, "..", "lib", "node_modules"));
|
|
6478
|
+
candidates.push("/opt/homebrew/lib/node_modules");
|
|
6479
|
+
candidates.push("/usr/local/lib/node_modules");
|
|
6480
|
+
candidates.push("/usr/lib/node_modules");
|
|
6481
|
+
return candidates;
|
|
6482
|
+
}
|
|
6483
|
+
|
|
6453
6484
|
// src/cli.ts
|
|
6454
6485
|
var execFileAsync2 = promisify2(execFile2);
|
|
6455
6486
|
var here = dirname10(fileURLToPath4(import.meta.url));
|
|
@@ -6652,7 +6683,14 @@ async function cmdUninstall() {
|
|
|
6652
6683
|
}
|
|
6653
6684
|
function createServiceContext() {
|
|
6654
6685
|
return {
|
|
6655
|
-
|
|
6686
|
+
// 服务配置长期存活,必须指向已安装的 npm 包而非当前源码目录。
|
|
6687
|
+
cliEntrypointPath: resolveDaemonEntrypoint({
|
|
6688
|
+
currentPath: fileURLToPath4(import.meta.url),
|
|
6689
|
+
execPath: process.execPath,
|
|
6690
|
+
platform: process.platform,
|
|
6691
|
+
exists: existsSync11,
|
|
6692
|
+
override: process.env.BRIDGE_CLI_ENTRYPOINT
|
|
6693
|
+
}),
|
|
6656
6694
|
nodePath: process.execPath,
|
|
6657
6695
|
configPath: process.env.BRIDGE_CONFIG ?? defaultConfigPath(),
|
|
6658
6696
|
port: Number(process.env.BRIDGE_PORT ?? 8787)
|