@eclaw/openclaw-channel 1.0.1 → 1.0.3
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/client.d.ts +0 -1
- package/dist/client.js +0 -5
- package/dist/config.js +1 -1
- package/dist/onboarding.js +10 -16
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -5,14 +5,12 @@
|
|
|
5
5
|
export class EClawClient {
|
|
6
6
|
apiBase;
|
|
7
7
|
apiKey;
|
|
8
|
-
apiSecret;
|
|
9
8
|
deviceId = null;
|
|
10
9
|
botSecret = null;
|
|
11
10
|
entityId;
|
|
12
11
|
constructor(config) {
|
|
13
12
|
this.apiBase = config.apiBase;
|
|
14
13
|
this.apiKey = config.apiKey;
|
|
15
|
-
this.apiSecret = config.apiSecret;
|
|
16
14
|
this.entityId = config.entityId;
|
|
17
15
|
}
|
|
18
16
|
/** Register callback URL with E-Claw backend */
|
|
@@ -22,7 +20,6 @@ export class EClawClient {
|
|
|
22
20
|
headers: { 'Content-Type': 'application/json' },
|
|
23
21
|
body: JSON.stringify({
|
|
24
22
|
channel_api_key: this.apiKey,
|
|
25
|
-
channel_api_secret: this.apiSecret,
|
|
26
23
|
callback_url: callbackUrl,
|
|
27
24
|
callback_token: callbackToken,
|
|
28
25
|
}),
|
|
@@ -41,7 +38,6 @@ export class EClawClient {
|
|
|
41
38
|
headers: { 'Content-Type': 'application/json' },
|
|
42
39
|
body: JSON.stringify({
|
|
43
40
|
channel_api_key: this.apiKey,
|
|
44
|
-
channel_api_secret: this.apiSecret,
|
|
45
41
|
entityId,
|
|
46
42
|
name: name || undefined,
|
|
47
43
|
}),
|
|
@@ -83,7 +79,6 @@ export class EClawClient {
|
|
|
83
79
|
headers: { 'Content-Type': 'application/json' },
|
|
84
80
|
body: JSON.stringify({
|
|
85
81
|
channel_api_key: this.apiKey,
|
|
86
|
-
channel_api_secret: this.apiSecret,
|
|
87
82
|
}),
|
|
88
83
|
});
|
|
89
84
|
}
|
package/dist/config.js
CHANGED
|
@@ -15,7 +15,7 @@ export function resolveAccount(cfg, accountId) {
|
|
|
15
15
|
return {
|
|
16
16
|
enabled: account?.enabled ?? true,
|
|
17
17
|
apiKey: account?.apiKey ?? '',
|
|
18
|
-
apiSecret: account?.apiSecret
|
|
18
|
+
apiSecret: account?.apiSecret,
|
|
19
19
|
apiBase: (account?.apiBase ?? 'https://eclawbot.com').replace(/\/$/, ''),
|
|
20
20
|
entityId: account?.entityId ?? 0,
|
|
21
21
|
botName: account?.botName,
|
package/dist/onboarding.js
CHANGED
|
@@ -7,12 +7,12 @@ export const eclawOnboardingAdapter = {
|
|
|
7
7
|
const ids = listAccountIds(cfg);
|
|
8
8
|
const configured = ids.some((id) => {
|
|
9
9
|
const acc = resolveAccount(cfg, id);
|
|
10
|
-
return Boolean(acc.apiKey
|
|
10
|
+
return Boolean(acc.apiKey);
|
|
11
11
|
});
|
|
12
12
|
return {
|
|
13
13
|
channel: 'eclaw',
|
|
14
14
|
configured,
|
|
15
|
-
statusLines: [`E-Claw: ${configured ? 'configured
|
|
15
|
+
statusLines: [`E-Claw: ${configured ? 'configured' : 'not configured'}`],
|
|
16
16
|
selectionHint: configured ? 'configured' : 'E-Claw (AI Live Wallpaper Chat)',
|
|
17
17
|
quickstartScore: configured ? 1 : 3,
|
|
18
18
|
};
|
|
@@ -22,21 +22,16 @@ export const eclawOnboardingAdapter = {
|
|
|
22
22
|
const accountId = DEFAULT_ACCOUNT_ID;
|
|
23
23
|
const resolved = resolveAccount(cfg, accountId);
|
|
24
24
|
await prompter.note([
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
|
|
25
|
+
'1. Log in to https://eclawbot.com',
|
|
26
|
+
'2. Go to Portal → Settings → Channel API',
|
|
27
|
+
'3. Create an API Key',
|
|
28
|
+
'4. Enter the credentials below',
|
|
29
|
+
].join('\n'), 'E-Claw Setup');
|
|
29
30
|
const apiKey = await prompter.text({
|
|
30
31
|
message: 'Channel API Key',
|
|
31
32
|
placeholder: 'eck_...',
|
|
32
33
|
initialValue: resolved.apiKey || '',
|
|
33
|
-
validate: (v) => (String(v ?? '').trim() ? undefined : '
|
|
34
|
-
});
|
|
35
|
-
const apiSecret = await prompter.text({
|
|
36
|
-
message: 'Channel API Secret',
|
|
37
|
-
placeholder: 'ecs_...',
|
|
38
|
-
initialValue: resolved.apiSecret || '',
|
|
39
|
-
validate: (v) => (String(v ?? '').trim() ? undefined : '必填'),
|
|
34
|
+
validate: (v) => (String(v ?? '').trim() ? undefined : 'Required'),
|
|
40
35
|
});
|
|
41
36
|
const entityIdStr = await prompter.text({
|
|
42
37
|
message: 'Entity ID (0–3)',
|
|
@@ -44,11 +39,11 @@ export const eclawOnboardingAdapter = {
|
|
|
44
39
|
initialValue: String(resolved.entityId ?? 0),
|
|
45
40
|
validate: (v) => {
|
|
46
41
|
const n = Number(v);
|
|
47
|
-
return Number.isInteger(n) && n >= 0 && n <= 3 ? undefined : '
|
|
42
|
+
return Number.isInteger(n) && n >= 0 && n <= 3 ? undefined : 'Must be 0–3';
|
|
48
43
|
},
|
|
49
44
|
});
|
|
50
45
|
const botName = await prompter.text({
|
|
51
|
-
message: 'Bot
|
|
46
|
+
message: 'Bot display name (optional)',
|
|
52
47
|
placeholder: 'My Bot',
|
|
53
48
|
initialValue: resolved.botName ?? '',
|
|
54
49
|
});
|
|
@@ -62,7 +57,6 @@ export const eclawOnboardingAdapter = {
|
|
|
62
57
|
...(cfg.channels?.eclaw?.accounts ?? {}), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
63
58
|
[accountId]: {
|
|
64
59
|
apiKey: String(apiKey).trim(),
|
|
65
|
-
apiSecret: String(apiSecret).trim(),
|
|
66
60
|
apiBase: resolved.apiBase || 'https://eclawbot.com',
|
|
67
61
|
entityId: Number(entityIdStr),
|
|
68
62
|
botName: String(botName).trim() || undefined,
|
package/dist/types.d.ts
CHANGED