@eclaw/openclaw-channel 1.1.3 → 1.1.5

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
@@ -6,6 +6,16 @@ This plugin enables OpenClaw bots to communicate with E-Claw users as a native c
6
6
 
7
7
  ## Installation
8
8
 
9
+ **In OpenClaw terminal (Zeabur / Railway SSH):**
10
+
11
+ ```bash
12
+ openclaw plugins install @eclaw/openclaw-channel
13
+ ```
14
+
15
+ > ⚠️ Do **not** use `npm install` directly — OpenClaw uses pnpm internally, and mixing package managers will cause a crash (`Cannot read properties of null`).
16
+
17
+ **In a standalone Node.js project:**
18
+
9
19
  ```bash
10
20
  npm install @eclaw/openclaw-channel
11
21
  ```
@@ -207,8 +217,11 @@ fs.writeFileSync(p, JSON.stringify(cfg, null, 2));
207
217
  // 3. Remove old plugin files
208
218
  execSync('rm -rf /home/node/.openclaw/extensions/openclaw-channel');
209
219
 
210
- // 4. Install new version (update version number below)
211
- var out = execSync('openclaw plugins install @eclaw/openclaw-channel@1.1.2 2>&1', { encoding: 'utf8' });
220
+ // 4. Fetch latest version from GitHub and install
221
+ var pkgJson = execSync('curl -sf https://raw.githubusercontent.com/HankHuang0516/openclaw-channel-eclaw/main/package.json', { encoding: 'utf8' });
222
+ var latestVersion = JSON.parse(pkgJson).version;
223
+ console.log('Installing @eclaw/openclaw-channel@' + latestVersion + ' ...');
224
+ var out = execSync('openclaw plugins install @eclaw/openclaw-channel@' + latestVersion + ' 2>&1', { encoding: 'utf8' });
212
225
  console.log(out);
213
226
 
214
227
  // 5. Restore channel config
package/dist/client.d.ts CHANGED
@@ -11,7 +11,7 @@ export declare class EClawClient {
11
11
  private entityId;
12
12
  constructor(config: EClawAccountConfig);
13
13
  /** Register callback URL with E-Claw backend */
14
- registerCallback(callbackUrl: string, callbackToken: string): Promise<RegisterResponse>;
14
+ registerCallback(callbackUrl: string, callbackToken: string, callbackUsername?: string, callbackPassword?: string): Promise<RegisterResponse>;
15
15
  /** Bind an entity via channel API (bypasses 6-digit code).
16
16
  * If entityId is omitted, the backend auto-selects the first free slot.
17
17
  */
package/dist/client.js CHANGED
@@ -14,15 +14,21 @@ export class EClawClient {
14
14
  this.entityId = config.entityId; // undefined until assigned by bindEntity
15
15
  }
16
16
  /** Register callback URL with E-Claw backend */
17
- async registerCallback(callbackUrl, callbackToken) {
17
+ async registerCallback(callbackUrl, callbackToken, callbackUsername, callbackPassword) {
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ const body = {
20
+ channel_api_key: this.apiKey,
21
+ callback_url: callbackUrl,
22
+ callback_token: callbackToken,
23
+ };
24
+ if (callbackUsername && callbackPassword) {
25
+ body.callback_username = callbackUsername;
26
+ body.callback_password = callbackPassword;
27
+ }
18
28
  const res = await fetch(`${this.apiBase}/api/channel/register`, {
19
29
  method: 'POST',
20
30
  headers: { 'Content-Type': 'application/json' },
21
- body: JSON.stringify({
22
- channel_api_key: this.apiKey,
23
- callback_url: callbackUrl,
24
- callback_token: callbackToken,
25
- }),
31
+ body: JSON.stringify(body),
26
32
  });
27
33
  const data = await res.json();
28
34
  if (!data.success) {
package/dist/gateway.js CHANGED
@@ -77,8 +77,12 @@ export async function startAccount(ctx) {
77
77
  registerWebhookToken(callbackToken, accountId, handler);
78
78
  console.log(`[E-Claw] Webhook registered at: ${callbackUrl}`);
79
79
  try {
80
+ // Detect WEB_PASSWORD / SETUP_PASSWORD for Railway Basic Auth
81
+ const webPassword = process.env.WEB_PASSWORD || process.env.SETUP_PASSWORD;
82
+ const callbackUsername = webPassword ? 'admin' : undefined;
83
+ const callbackPassword = webPassword || undefined;
80
84
  // Register callback with E-Claw backend
81
- const regData = await client.registerCallback(callbackUrl, callbackToken);
85
+ const regData = await client.registerCallback(callbackUrl, callbackToken, callbackUsername, callbackPassword);
82
86
  console.log(`[E-Claw] Registered with E-Claw. Device: ${regData.deviceId}, Entities: ${regData.entities.length}`);
83
87
  // Bind entity via channel API.
84
88
  // /api/channel/bind is idempotent for the same channel account:
@@ -33,15 +33,6 @@ export const eclawOnboardingAdapter = {
33
33
  initialValue: resolved.apiKey || '',
34
34
  validate: (v) => (String(v ?? '').trim() ? undefined : 'Required'),
35
35
  });
36
- const entityIdStr = await prompter.text({
37
- message: 'Entity ID (0–3)',
38
- placeholder: '0',
39
- initialValue: String(resolved.entityId ?? 0),
40
- validate: (v) => {
41
- const n = Number(v);
42
- return Number.isInteger(n) && n >= 0 && n <= 3 ? undefined : 'Must be 0–3';
43
- },
44
- });
45
36
  const botName = await prompter.text({
46
37
  message: 'Bot display name (optional)',
47
38
  placeholder: 'My Bot',
@@ -63,7 +54,7 @@ export const eclawOnboardingAdapter = {
63
54
  [accountId]: {
64
55
  apiKey: String(apiKey).trim(),
65
56
  apiBase: resolved.apiBase || 'https://eclawbot.com',
66
- entityId: Number(entityIdStr),
57
+ entityId: resolved.entityId, // keep existing if re-configuring, else undefined = auto-assign
67
58
  botName: String(botName).trim() || undefined,
68
59
  webhookUrl: String(webhookUrl).trim() || undefined,
69
60
  enabled: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclaw/openclaw-channel",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "E-Claw channel plugin for OpenClaw — AI chat platform for live wallpaper entities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",