@eclaw/openclaw-channel 1.0.7 → 1.0.8

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/gateway.js +18 -6
  2. package/package.json +1 -1
package/dist/gateway.js CHANGED
@@ -1,9 +1,23 @@
1
1
  import { createServer } from 'node:http';
2
2
  import { randomBytes } from 'node:crypto';
3
+ import { readFileSync } from 'node:fs';
4
+ import { join } from 'node:path';
5
+ import { homedir } from 'node:os';
3
6
  import { resolveAccount } from './config.js';
4
7
  import { EClawClient } from './client.js';
5
8
  import { setClient } from './outbound.js';
6
9
  import { createWebhookHandler } from './webhook-handler.js';
10
+ /** Read full openclaw.json config from disk */
11
+ function readFullConfig() {
12
+ const configPath = process.env.OPENCLAW_CONFIG_PATH
13
+ || join(homedir(), '.openclaw', 'openclaw.json');
14
+ try {
15
+ return JSON.parse(readFileSync(configPath, 'utf8'));
16
+ }
17
+ catch {
18
+ return {};
19
+ }
20
+ }
7
21
  /**
8
22
  * Gateway lifecycle: start an E-Claw account.
9
23
  *
@@ -15,12 +29,10 @@ import { createWebhookHandler } from './webhook-handler.js';
15
29
  */
16
30
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
31
  export async function startAccount(ctx) {
18
- const { accountId, config } = ctx;
19
- console.log(`[E-Claw] startAccount called, accountId=${accountId}, config keys=${Object.keys(config || {}).join(',')}`);
20
- console.log(`[E-Claw] config.channels.eclaw=`, JSON.stringify(config?.channels?.eclaw ?? null));
21
- console.log(`[E-Claw] config.accounts=`, JSON.stringify(config?.accounts ?? null));
22
- const account = resolveAccount(config, accountId);
23
- console.log(`[E-Claw] resolved account: enabled=${account.enabled}, apiKey=${account.apiKey ? 'SET' : 'MISSING'}`);
32
+ const { accountId } = ctx;
33
+ // OpenClaw passes an empty config object to the gateway — read config from disk directly
34
+ const fullConfig = readFullConfig();
35
+ const account = resolveAccount(fullConfig, accountId);
24
36
  if (!account.enabled || !account.apiKey) {
25
37
  console.log(`[E-Claw] Account ${accountId} disabled or missing credentials, skipping`);
26
38
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclaw/openclaw-channel",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
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",