@eclaw/openclaw-channel 1.0.5 → 1.0.6

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/config.js +13 -2
  2. 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?.channels?.eclaw?.accounts;
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?.channels?.eclaw?.accounts ?? {};
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclaw/openclaw-channel",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
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",