openclaw-elys 1.4.0 → 1.4.2

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 CHANGED
@@ -7,7 +7,7 @@ Elys App 的 OpenClaw 频道插件 — 将本地 OpenClaw 智能体连接到 Ely
7
7
  ## Install / 安装
8
8
 
9
9
  ```bash
10
- openclaw plugins install openclaw-elys
10
+ openclaw plugins install openclaw-elys@latest
11
11
  # Installs the latest version by default / 默认安装最新版本
12
12
  ```
13
13
 
@@ -18,13 +18,13 @@ Get a one-time register token from the Elys App, then run:
18
18
  从 Elys App 获取一次性注册令牌,然后执行:
19
19
 
20
20
  ```bash
21
- npx openclaw-elys setup <gateway_url> <register_token>
21
+ npx openclaw-elys@latest setup <gateway_url> <register_token>
22
22
  ```
23
23
 
24
24
  Example / 示例:
25
25
 
26
26
  ```bash
27
- npx openclaw-elys setup https://your-gateway.com reg_abc123def456
27
+ npx openclaw-elys@latest setup https://your-gateway.com reg_abc123def456
28
28
  # Device registered successfully!
29
29
  # Device ID: d_xxxxxxxxxxxx
30
30
  # Credentials saved to ~/.elys/config.json
@@ -33,17 +33,9 @@ npx openclaw-elys setup https://your-gateway.com reg_abc123def456
33
33
  # Restart OpenClaw gateway to activate: openclaw gateway restart
34
34
  ```
35
35
 
36
- The setup command automatically configures `channels.elys` in `~/.openclaw/openclaw.json`.
36
+ The setup command automatically configures `channels.elys` in `~/.openclaw/openclaw.json`. OpenClaw will auto-detect the config change — no restart needed.
37
37
 
38
- setup 命令会自动配置 `~/.openclaw/openclaw.json` 中的 `channels.elys`。
39
-
40
- Restart the OpenClaw gateway to activate:
41
-
42
- 重启 OpenClaw 网关以激活:
43
-
44
- ```bash
45
- openclaw gateway restart
46
- ```
38
+ setup 命令会自动配置 `~/.openclaw/openclaw.json` 中的 `channels.elys`。OpenClaw 会自动检测配置变更,无需重启。
47
39
 
48
40
  ## Status / 查看状态
49
41
 
package/dist/src/cli.js CHANGED
@@ -7,25 +7,39 @@ import { loadCredentials, loadGatewayUrl, deleteCredentials, } from "./config.js
7
7
  const OPENCLAW_CONFIG = path.join(os.homedir(), ".openclaw", "openclaw.json");
8
8
  /**
9
9
  * Auto-configure channels.elys in ~/.openclaw/openclaw.json
10
+ * Retries if OpenClaw's file watcher overwrites the change.
10
11
  */
11
12
  function configureOpenClawChannel(gatewayUrl) {
12
- try {
13
- if (!fs.existsSync(OPENCLAW_CONFIG))
13
+ const maxAttempts = 3;
14
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
15
+ try {
16
+ if (!fs.existsSync(OPENCLAW_CONFIG))
17
+ return false;
18
+ const raw = fs.readFileSync(OPENCLAW_CONFIG, "utf-8");
19
+ const cfg = JSON.parse(raw);
20
+ if (!cfg.channels)
21
+ cfg.channels = {};
22
+ cfg.channels.elys = { gatewayUrl };
23
+ fs.writeFileSync(OPENCLAW_CONFIG, JSON.stringify(cfg, null, 2), "utf-8");
24
+ // Wait and verify the write wasn't overwritten
25
+ if (attempt < maxAttempts - 1) {
26
+ const delay = (attempt + 1) * 1000;
27
+ const start = Date.now();
28
+ while (Date.now() - start < delay) { /* busy wait */ }
29
+ const verify = JSON.parse(fs.readFileSync(OPENCLAW_CONFIG, "utf-8"));
30
+ if (verify.channels?.elys?.gatewayUrl === gatewayUrl) {
31
+ return true;
32
+ }
33
+ // Was overwritten, retry
34
+ continue;
35
+ }
36
+ return true;
37
+ }
38
+ catch {
14
39
  return false;
15
- const raw = fs.readFileSync(OPENCLAW_CONFIG, "utf-8");
16
- const cfg = JSON.parse(raw);
17
- if (!cfg.channels)
18
- cfg.channels = {};
19
- cfg.channels.elys = {
20
- enabled: true,
21
- gatewayUrl,
22
- };
23
- fs.writeFileSync(OPENCLAW_CONFIG, JSON.stringify(cfg, null, 2), "utf-8");
24
- return true;
25
- }
26
- catch {
27
- return false;
40
+ }
28
41
  }
42
+ return false;
29
43
  }
30
44
  /**
31
45
  * Remove channels.elys from ~/.openclaw/openclaw.json
@@ -67,13 +81,12 @@ if (command === "setup") {
67
81
  if (configureOpenClawChannel(gatewayUrl)) {
68
82
  console.log(` OpenClaw config updated: channels.elys.gatewayUrl = ${gatewayUrl}`);
69
83
  console.log("");
70
- console.log("Restart OpenClaw gateway to activate: openclaw gateway restart");
84
+ console.log("OpenClaw will auto-detect the config change. You're all set!");
71
85
  }
72
86
  else {
73
87
  console.log("");
74
88
  console.log("Add to ~/.openclaw/openclaw.json:");
75
- console.log(` "channels": { "elys": { "enabled": true, "gatewayUrl": "${gatewayUrl}" } }`);
76
- console.log("Then restart: openclaw gateway restart");
89
+ console.log(` "channels": { "elys": { "gatewayUrl": "${gatewayUrl}" } }`);
77
90
  }
78
91
  })
79
92
  .catch((err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-elys",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "OpenClaw Elys channel plugin — connects to Elys App",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -43,4 +43,4 @@
43
43
  "defaultChoice": "npm"
44
44
  }
45
45
  }
46
- }
46
+ }