@eclaw/openclaw-channel 1.0.5 → 1.0.7
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/config.js +13 -2
- package/dist/gateway.js +4 -0
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
/** Extract accounts map from full openclaw config or eclaw-specific config */
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
|
+
function getAccounts(cfg) {
|
|
4
|
+
// Full openclaw config: { channels: { eclaw: { accounts: {...} } } }
|
|
5
|
+
if (cfg?.channels?.eclaw?.accounts)
|
|
6
|
+
return cfg.channels.eclaw.accounts;
|
|
7
|
+
// Eclaw channel config: { accounts: {...} }
|
|
8
|
+
if (cfg?.accounts && typeof cfg.accounts === 'object')
|
|
9
|
+
return cfg.accounts;
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
1
12
|
/** List all configured account IDs from OpenClaw config */
|
|
2
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
14
|
export function listAccountIds(cfg) {
|
|
4
|
-
const accounts = cfg
|
|
15
|
+
const accounts = getAccounts(cfg);
|
|
5
16
|
if (!accounts || typeof accounts !== 'object')
|
|
6
17
|
return [];
|
|
7
18
|
return Object.keys(accounts);
|
|
@@ -9,7 +20,7 @@ export function listAccountIds(cfg) {
|
|
|
9
20
|
/** Resolve a specific account's config, with defaults */
|
|
10
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
22
|
export function resolveAccount(cfg, accountId) {
|
|
12
|
-
const accounts = cfg
|
|
23
|
+
const accounts = getAccounts(cfg);
|
|
13
24
|
const id = accountId ?? Object.keys(accounts)[0] ?? 'default';
|
|
14
25
|
const account = accounts[id];
|
|
15
26
|
return {
|
package/dist/gateway.js
CHANGED
|
@@ -16,7 +16,11 @@ import { createWebhookHandler } from './webhook-handler.js';
|
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
17
|
export async function startAccount(ctx) {
|
|
18
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));
|
|
19
22
|
const account = resolveAccount(config, accountId);
|
|
23
|
+
console.log(`[E-Claw] resolved account: enabled=${account.enabled}, apiKey=${account.apiKey ? 'SET' : 'MISSING'}`);
|
|
20
24
|
if (!account.enabled || !account.apiKey) {
|
|
21
25
|
console.log(`[E-Claw] Account ${accountId} disabled or missing credentials, skipping`);
|
|
22
26
|
return;
|