nodus-wechat 0.6.2 → 0.7.0
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/README.md +4 -4
- package/bin/nodus-wechat.js +43 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ npx nodus-wechat install-openilink
|
|
|
18
18
|
npx nodus-wechat doctor
|
|
19
19
|
npx nodus-wechat start
|
|
20
20
|
npx nodus-wechat start --no-install
|
|
21
|
+
npx nodus-wechat start --no-hermes
|
|
21
22
|
npx nodus-wechat start --docker
|
|
22
23
|
npx nodus-wechat status
|
|
23
24
|
npx nodus-wechat logs
|
|
@@ -52,8 +53,8 @@ the official OpeniLink installer.
|
|
|
52
53
|
- Writes runtime `.env`, Docker Compose, webhook server, helper scripts, and the OpeniLink reply plugin.
|
|
53
54
|
- Stores gateway base URL, api key, model, Hermes paths, OpeniLink origin, webhook port, and runtime path.
|
|
54
55
|
- Checks Node.js, local configuration, Hermes files, runtime files, Python, OpeniLink CLI, optional Docker Compose availability, Hermes CLI availability, and WeChat app detection with `doctor`.
|
|
55
|
-
- Starts/stops the local
|
|
56
|
-
- Installs OpeniLink automatically during `start` when the native
|
|
56
|
+
- Starts/stops Hermes Gateway, OpeniLink, and the local webhook with native host processes by default.
|
|
57
|
+
- Installs Hermes and OpeniLink automatically during `start` when the native CLIs are missing.
|
|
57
58
|
- Keeps Docker Compose available only when `--docker` is passed.
|
|
58
59
|
- Removes Nodus WeChat config/runtime files with `uninstall --yes`.
|
|
59
60
|
- Cleans Nodus WeChat config/runtime plus generated Hermes settings with `clean --yes`.
|
|
@@ -77,9 +78,8 @@ the config generated by this CLI.
|
|
|
77
78
|
|
|
78
79
|
## Current non-goals
|
|
79
80
|
|
|
80
|
-
- Does not run the Hermes installer unless `--install-hermes` or `install-hermes` is explicitly requested.
|
|
81
81
|
- Does not automate, inject into, read, or control WeChat directly.
|
|
82
|
-
- Does not
|
|
82
|
+
- Does not install a LaunchAgent or system service; `start` uses managed host processes that `stop` can terminate.
|
|
83
83
|
- Does not redeem real CDKs or mutate sub2api accounts; the bundled webhook keeps the existing dry-run POC boundary.
|
|
84
84
|
|
|
85
85
|
## Runtime wiring
|
package/bin/nodus-wechat.js
CHANGED
|
@@ -8,7 +8,7 @@ const os = require("node:os");
|
|
|
8
8
|
const path = require("node:path");
|
|
9
9
|
const childProcess = require("node:child_process");
|
|
10
10
|
|
|
11
|
-
const VERSION = "0.
|
|
11
|
+
const VERSION = "0.7.0";
|
|
12
12
|
const DEFAULT_BASE_URL = "https://api.nodus.sbs/";
|
|
13
13
|
const DEFAULT_MODEL = "gpt-5.5";
|
|
14
14
|
const DEFAULT_OPENILINK_ORIGIN = "http://localhost:9800";
|
|
@@ -43,7 +43,7 @@ Usage:
|
|
|
43
43
|
nodus-wechat install-hermes
|
|
44
44
|
nodus-wechat install-openilink
|
|
45
45
|
nodus-wechat doctor
|
|
46
|
-
nodus-wechat start [--docker] [--no-install]
|
|
46
|
+
nodus-wechat start [--docker] [--no-install] [--no-hermes]
|
|
47
47
|
nodus-wechat status [--docker]
|
|
48
48
|
nodus-wechat logs [--docker]
|
|
49
49
|
nodus-wechat stop [--docker]
|
|
@@ -56,7 +56,7 @@ Commands:
|
|
|
56
56
|
install-openilink
|
|
57
57
|
Install OpeniLink Hub native CLI with the official installer.
|
|
58
58
|
doctor Check local prerequisites and configuration.
|
|
59
|
-
start Start OpeniLink
|
|
59
|
+
start Start Hermes Gateway, OpeniLink, and webhook on the host by default.
|
|
60
60
|
status Show local process status.
|
|
61
61
|
logs Follow local runtime logs.
|
|
62
62
|
stop Stop the local runtime.
|
|
@@ -78,7 +78,7 @@ function parseArgs(argv) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
const key = item.slice(2);
|
|
81
|
-
if (key === "help" || key === "yes" || key === "install-hermes" || key === "docker" || key === "no-install") {
|
|
81
|
+
if (key === "help" || key === "yes" || key === "install-hermes" || key === "docker" || key === "no-install" || key === "no-hermes") {
|
|
82
82
|
result[key] = true;
|
|
83
83
|
continue;
|
|
84
84
|
}
|
|
@@ -377,7 +377,7 @@ function setup(options) {
|
|
|
377
377
|
console.log(`OpeniLink Hub: ${config.openilink.publicOrigin}`);
|
|
378
378
|
console.log(`Webhook URL for OpeniLink: http://poc-webhook:${config.webhook.port}/webhook`);
|
|
379
379
|
console.log("Runtime mode: host process by default; Docker is used only with `--docker`.");
|
|
380
|
-
console.log("Run `nodus-wechat start` to start the local host runtime
|
|
380
|
+
console.log("Run `nodus-wechat start` to start Hermes Gateway plus the local host runtime.");
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
function installHermes() {
|
|
@@ -519,6 +519,16 @@ function commandPath(name) {
|
|
|
519
519
|
return result.stdout.trim() || null;
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
+
function hermesPath(config) {
|
|
523
|
+
return (
|
|
524
|
+
commandPath("hermes") ||
|
|
525
|
+
(fs.existsSync(path.join(os.homedir(), ".local", "bin", "hermes")) ? path.join(os.homedir(), ".local", "bin", "hermes") : null) ||
|
|
526
|
+
(config?.hermes?.home && fs.existsSync(path.join(config.hermes.home, "hermes-agent", "venv", "bin", "hermes"))
|
|
527
|
+
? path.join(config.hermes.home, "hermes-agent", "venv", "bin", "hermes")
|
|
528
|
+
: null)
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
|
|
522
532
|
function runtimePath(config, name) {
|
|
523
533
|
return path.join(config.runtime.dir, name);
|
|
524
534
|
}
|
|
@@ -597,6 +607,7 @@ function localRuntimeEnv(config) {
|
|
|
597
607
|
return {
|
|
598
608
|
...process.env,
|
|
599
609
|
...env,
|
|
610
|
+
HERMES_HOME: config.hermes?.home || hermesHome(),
|
|
600
611
|
LISTEN: `:${config.openilink?.port || DEFAULT_OPENILINK_PORT}`,
|
|
601
612
|
RP_ORIGIN: config.openilink?.publicOrigin || DEFAULT_OPENILINK_ORIGIN,
|
|
602
613
|
RP_ID: config.openilink?.rpId || DEFAULT_OPENILINK_RP_ID,
|
|
@@ -682,6 +693,24 @@ function startLocal(options) {
|
|
|
682
693
|
return 1;
|
|
683
694
|
}
|
|
684
695
|
|
|
696
|
+
let hermes = options["no-hermes"] ? null : hermesPath(config);
|
|
697
|
+
if (!hermes && !options["no-hermes"]) {
|
|
698
|
+
if (options["no-install"]) {
|
|
699
|
+
console.error("Hermes CLI `hermes` is not installed.");
|
|
700
|
+
console.error("Run: nodus-wechat install-hermes");
|
|
701
|
+
return 1;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
console.log("Hermes CLI `hermes` is not installed; installing it now.");
|
|
705
|
+
runHermesInstaller(config.hermes?.home || hermesHome());
|
|
706
|
+
hermes = hermesPath(config);
|
|
707
|
+
if (!hermes) {
|
|
708
|
+
console.error("Hermes installer completed, but `hermes` is still not on PATH.");
|
|
709
|
+
console.error("Open a new terminal or add the installed Hermes path to PATH, then rerun `nodus-wechat start`.");
|
|
710
|
+
return 1;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
685
714
|
let oih = commandPath("oih");
|
|
686
715
|
if (!oih) {
|
|
687
716
|
if (options["no-install"]) {
|
|
@@ -707,6 +736,11 @@ function startLocal(options) {
|
|
|
707
736
|
const webhookPath = path.join(config.runtime.dir, "poc-webhook", "server.py");
|
|
708
737
|
startManagedProcess(config, "webhook", python, [webhookPath], env);
|
|
709
738
|
startManagedProcess(config, "openilink", oih, [], env);
|
|
739
|
+
if (hermes) {
|
|
740
|
+
startManagedProcess(config, "hermes", hermes, ["gateway", "run"], env);
|
|
741
|
+
} else {
|
|
742
|
+
console.log("hermes: skipped (--no-hermes)");
|
|
743
|
+
}
|
|
710
744
|
console.log(`OpeniLink Hub: ${config.openilink?.publicOrigin || DEFAULT_OPENILINK_ORIGIN}`);
|
|
711
745
|
console.log(`Webhook health: http://127.0.0.1:${config.webhook?.port || DEFAULT_WEBHOOK_PORT}/health`);
|
|
712
746
|
return 0;
|
|
@@ -731,7 +765,7 @@ async function statusLocal() {
|
|
|
731
765
|
return 1;
|
|
732
766
|
}
|
|
733
767
|
|
|
734
|
-
for (const name of ["openilink", "webhook"]) {
|
|
768
|
+
for (const name of ["hermes", "openilink", "webhook"]) {
|
|
735
769
|
const pid = readPid(pidPath(config, name));
|
|
736
770
|
console.log(`${name}: ${processRunning(pid) ? `running (pid ${pid})` : "stopped"}`);
|
|
737
771
|
}
|
|
@@ -759,7 +793,7 @@ function logsLocal() {
|
|
|
759
793
|
return 1;
|
|
760
794
|
}
|
|
761
795
|
|
|
762
|
-
const files = ["openilink", "webhook"].map((name) => logPath(config, name)).filter((filePath) => fs.existsSync(filePath));
|
|
796
|
+
const files = ["hermes", "openilink", "webhook"].map((name) => logPath(config, name)).filter((filePath) => fs.existsSync(filePath));
|
|
763
797
|
if (files.length === 0) {
|
|
764
798
|
console.error("No local runtime logs found.");
|
|
765
799
|
return 1;
|
|
@@ -799,6 +833,7 @@ function stopLocal() {
|
|
|
799
833
|
|
|
800
834
|
stopManagedProcess(config, "webhook");
|
|
801
835
|
stopManagedProcess(config, "openilink");
|
|
836
|
+
stopManagedProcess(config, "hermes");
|
|
802
837
|
return 0;
|
|
803
838
|
}
|
|
804
839
|
|
|
@@ -856,7 +891,7 @@ function clean(options) {
|
|
|
856
891
|
|
|
857
892
|
const config = fs.existsSync(configPath()) ? readConfig() : null;
|
|
858
893
|
if (config) {
|
|
859
|
-
for (const name of ["webhook", "openilink"]) {
|
|
894
|
+
for (const name of ["webhook", "openilink", "hermes"]) {
|
|
860
895
|
stopManagedProcess({ ...config, runtime: { ...config.runtime, dir: config.runtime?.dir || path.join(configHome(), "runtime") } }, name);
|
|
861
896
|
}
|
|
862
897
|
const docker = dockerComposeAvailable();
|