@alfe.ai/openclaw-chat 0.0.32 → 0.0.34
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/plugin.d.cts +0 -18
- package/dist/plugin.d.ts +0 -18
- package/dist/plugin2.cjs +9 -22
- package/dist/plugin2.js +9 -22
- package/package.json +2 -2
package/dist/plugin.d.cts
CHANGED
|
@@ -9,31 +9,21 @@
|
|
|
9
9
|
interface AlfeChannelAccountConfig {
|
|
10
10
|
/** Whether this account is enabled. */
|
|
11
11
|
enabled?: boolean;
|
|
12
|
-
/** Allowed sender identifiers (user IDs, email addresses). */
|
|
13
|
-
allowFrom?: string | string[];
|
|
14
12
|
/** Default delivery target. */
|
|
15
13
|
defaultTo?: string;
|
|
16
|
-
/** DM policy (open, allowlist, etc.). */
|
|
17
|
-
dmPolicy?: string;
|
|
18
14
|
}
|
|
19
15
|
interface AlfeChannelConfig {
|
|
20
16
|
/** Whether the Alfe channel is enabled. */
|
|
21
17
|
enabled?: boolean;
|
|
22
|
-
/** Allowed sender identifiers. */
|
|
23
|
-
allowFrom?: string | string[];
|
|
24
18
|
/** Default delivery target for outbound messages. */
|
|
25
19
|
defaultTo?: string;
|
|
26
|
-
/** DM policy. */
|
|
27
|
-
dmPolicy?: string;
|
|
28
20
|
/** Named accounts (multi-account support). */
|
|
29
21
|
accounts?: Record<string, AlfeChannelAccountConfig>;
|
|
30
22
|
}
|
|
31
23
|
interface AlfeResolvedAccount {
|
|
32
24
|
accountId: string;
|
|
33
25
|
enabled: boolean;
|
|
34
|
-
allowFrom: string[];
|
|
35
26
|
defaultTo?: string;
|
|
36
|
-
dmPolicy?: string;
|
|
37
27
|
}
|
|
38
28
|
interface AlfePluginConfig {
|
|
39
29
|
/** Agent ID this plugin is associated with. */
|
|
@@ -118,15 +108,7 @@ declare function createAlfeChannelPlugin(): {
|
|
|
118
108
|
accountId: string;
|
|
119
109
|
enabled: boolean;
|
|
120
110
|
configured: boolean;
|
|
121
|
-
dmPolicy: string | undefined;
|
|
122
111
|
};
|
|
123
|
-
/**
|
|
124
|
-
* Resolve allow-from list for an account.
|
|
125
|
-
*/
|
|
126
|
-
resolveAllowFrom(params: {
|
|
127
|
-
cfg: OpenClawConfig;
|
|
128
|
-
accountId?: string | null;
|
|
129
|
-
}): string[];
|
|
130
112
|
/**
|
|
131
113
|
* Resolve default outbound target.
|
|
132
114
|
*/
|
package/dist/plugin.d.ts
CHANGED
|
@@ -9,31 +9,21 @@
|
|
|
9
9
|
interface AlfeChannelAccountConfig {
|
|
10
10
|
/** Whether this account is enabled. */
|
|
11
11
|
enabled?: boolean;
|
|
12
|
-
/** Allowed sender identifiers (user IDs, email addresses). */
|
|
13
|
-
allowFrom?: string | string[];
|
|
14
12
|
/** Default delivery target. */
|
|
15
13
|
defaultTo?: string;
|
|
16
|
-
/** DM policy (open, allowlist, etc.). */
|
|
17
|
-
dmPolicy?: string;
|
|
18
14
|
}
|
|
19
15
|
interface AlfeChannelConfig {
|
|
20
16
|
/** Whether the Alfe channel is enabled. */
|
|
21
17
|
enabled?: boolean;
|
|
22
|
-
/** Allowed sender identifiers. */
|
|
23
|
-
allowFrom?: string | string[];
|
|
24
18
|
/** Default delivery target for outbound messages. */
|
|
25
19
|
defaultTo?: string;
|
|
26
|
-
/** DM policy. */
|
|
27
|
-
dmPolicy?: string;
|
|
28
20
|
/** Named accounts (multi-account support). */
|
|
29
21
|
accounts?: Record<string, AlfeChannelAccountConfig>;
|
|
30
22
|
}
|
|
31
23
|
interface AlfeResolvedAccount {
|
|
32
24
|
accountId: string;
|
|
33
25
|
enabled: boolean;
|
|
34
|
-
allowFrom: string[];
|
|
35
26
|
defaultTo?: string;
|
|
36
|
-
dmPolicy?: string;
|
|
37
27
|
}
|
|
38
28
|
interface AlfePluginConfig {
|
|
39
29
|
/** Agent ID this plugin is associated with. */
|
|
@@ -118,15 +108,7 @@ declare function createAlfeChannelPlugin(): {
|
|
|
118
108
|
accountId: string;
|
|
119
109
|
enabled: boolean;
|
|
120
110
|
configured: boolean;
|
|
121
|
-
dmPolicy: string | undefined;
|
|
122
111
|
};
|
|
123
|
-
/**
|
|
124
|
-
* Resolve allow-from list for an account.
|
|
125
|
-
*/
|
|
126
|
-
resolveAllowFrom(params: {
|
|
127
|
-
cfg: OpenClawConfig;
|
|
128
|
-
accountId?: string | null;
|
|
129
|
-
}): string[];
|
|
130
112
|
/**
|
|
131
113
|
* Resolve default outbound target.
|
|
132
114
|
*/
|
package/dist/plugin2.cjs
CHANGED
|
@@ -12,11 +12,6 @@ const DEFAULT_ACCOUNT_ID = "default";
|
|
|
12
12
|
function getChannelSection(cfg) {
|
|
13
13
|
return cfg.channels?.alfe ?? {};
|
|
14
14
|
}
|
|
15
|
-
function normalizeAllowFrom(raw) {
|
|
16
|
-
if (!raw) return [];
|
|
17
|
-
if (typeof raw === "string") return [raw];
|
|
18
|
-
return raw;
|
|
19
|
-
}
|
|
20
15
|
/**
|
|
21
16
|
* Creates the Alfe ChannelPlugin object for registration with OpenClaw.
|
|
22
17
|
*
|
|
@@ -57,7 +52,7 @@ function createAlfeChannelPlugin() {
|
|
|
57
52
|
listAccountIds(cfg) {
|
|
58
53
|
const section = getChannelSection(cfg);
|
|
59
54
|
const ids = [];
|
|
60
|
-
if (section.enabled !== false &&
|
|
55
|
+
if (section.enabled !== false && section.defaultTo) ids.push(DEFAULT_ACCOUNT_ID);
|
|
61
56
|
if (section.accounts) {
|
|
62
57
|
for (const id of Object.keys(section.accounts)) if (!ids.includes(id)) ids.push(id);
|
|
63
58
|
}
|
|
@@ -71,16 +66,12 @@ function createAlfeChannelPlugin() {
|
|
|
71
66
|
if (accountSection) return {
|
|
72
67
|
accountId: id,
|
|
73
68
|
enabled: accountSection.enabled !== false,
|
|
74
|
-
|
|
75
|
-
defaultTo: accountSection.defaultTo,
|
|
76
|
-
dmPolicy: accountSection.dmPolicy
|
|
69
|
+
defaultTo: accountSection.defaultTo
|
|
77
70
|
};
|
|
78
71
|
return {
|
|
79
72
|
accountId: id,
|
|
80
73
|
enabled: section.enabled !== false,
|
|
81
|
-
|
|
82
|
-
defaultTo: section.defaultTo,
|
|
83
|
-
dmPolicy: section.dmPolicy
|
|
74
|
+
defaultTo: section.defaultTo
|
|
84
75
|
};
|
|
85
76
|
},
|
|
86
77
|
defaultAccountId() {
|
|
@@ -96,15 +87,9 @@ function createAlfeChannelPlugin() {
|
|
|
96
87
|
return {
|
|
97
88
|
accountId: account.accountId,
|
|
98
89
|
enabled: account.enabled,
|
|
99
|
-
configured: true
|
|
100
|
-
dmPolicy: account.dmPolicy
|
|
90
|
+
configured: true
|
|
101
91
|
};
|
|
102
92
|
},
|
|
103
|
-
resolveAllowFrom(params) {
|
|
104
|
-
const section = getChannelSection(params.cfg);
|
|
105
|
-
const id = params.accountId ?? DEFAULT_ACCOUNT_ID;
|
|
106
|
-
return normalizeAllowFrom((section.accounts?.[id])?.allowFrom ?? section.allowFrom);
|
|
107
|
-
},
|
|
108
93
|
resolveDefaultTo(params) {
|
|
109
94
|
const section = getChannelSection(params.cfg);
|
|
110
95
|
const id = params.accountId ?? DEFAULT_ACCOUNT_ID;
|
|
@@ -633,13 +618,13 @@ async function handleAgentRequest(request, log) {
|
|
|
633
618
|
chatClient?.sendResponse(request.id, false, { message: "OpenClaw SDK not available — cannot dispatch" });
|
|
634
619
|
return;
|
|
635
620
|
}
|
|
636
|
-
const { message, sessionKey: legacySessionKey, userId, conversationId, conversationType, tenantId, clientType, displayName, attachments: rawAttachments, a2a } = request.params;
|
|
621
|
+
const { message, sessionKey: legacySessionKey, userId, conversationId, conversationType, tenantId, clientType, displayName, identityId, attachments: rawAttachments, a2a } = request.params;
|
|
637
622
|
const isA2A = !!a2a;
|
|
638
623
|
if (!message && !rawAttachments?.length) {
|
|
639
624
|
chatClient?.sendResponse(request.id, false, { message: "Missing message" });
|
|
640
625
|
return;
|
|
641
626
|
}
|
|
642
|
-
const senderId =
|
|
627
|
+
const senderId = userId ?? "anon";
|
|
643
628
|
const cfg = runtime.config.loadConfig();
|
|
644
629
|
const sessionId = conversationId ?? legacySessionKey;
|
|
645
630
|
if (!await getSession(sessionId)) await createSession(sessionId, "", "alfe", tenantId, userId);
|
|
@@ -689,7 +674,7 @@ async function handleAgentRequest(request, log) {
|
|
|
689
674
|
id: conversationId ? `${senderId}:conv:${conversationId}` : senderId
|
|
690
675
|
},
|
|
691
676
|
senderId,
|
|
692
|
-
senderAddress:
|
|
677
|
+
senderAddress: senderId,
|
|
693
678
|
recipientAddress: "agent",
|
|
694
679
|
conversationLabel,
|
|
695
680
|
rawBody: message || "",
|
|
@@ -701,6 +686,8 @@ async function handleAgentRequest(request, log) {
|
|
|
701
686
|
...clientType ? { ClientType: clientType } : {},
|
|
702
687
|
...conversationId ? { ConversationId: conversationId } : {},
|
|
703
688
|
...displayName ? { SenderName: displayName } : {},
|
|
689
|
+
...identityId ? { IdentityId: identityId } : {},
|
|
690
|
+
...userId ? { UserId: userId } : {},
|
|
704
691
|
ChannelMode: channelMode,
|
|
705
692
|
...isA2A ? {
|
|
706
693
|
CallerType: "agent",
|
package/dist/plugin2.js
CHANGED
|
@@ -12,11 +12,6 @@ const DEFAULT_ACCOUNT_ID = "default";
|
|
|
12
12
|
function getChannelSection(cfg) {
|
|
13
13
|
return cfg.channels?.alfe ?? {};
|
|
14
14
|
}
|
|
15
|
-
function normalizeAllowFrom(raw) {
|
|
16
|
-
if (!raw) return [];
|
|
17
|
-
if (typeof raw === "string") return [raw];
|
|
18
|
-
return raw;
|
|
19
|
-
}
|
|
20
15
|
/**
|
|
21
16
|
* Creates the Alfe ChannelPlugin object for registration with OpenClaw.
|
|
22
17
|
*
|
|
@@ -57,7 +52,7 @@ function createAlfeChannelPlugin() {
|
|
|
57
52
|
listAccountIds(cfg) {
|
|
58
53
|
const section = getChannelSection(cfg);
|
|
59
54
|
const ids = [];
|
|
60
|
-
if (section.enabled !== false &&
|
|
55
|
+
if (section.enabled !== false && section.defaultTo) ids.push(DEFAULT_ACCOUNT_ID);
|
|
61
56
|
if (section.accounts) {
|
|
62
57
|
for (const id of Object.keys(section.accounts)) if (!ids.includes(id)) ids.push(id);
|
|
63
58
|
}
|
|
@@ -71,16 +66,12 @@ function createAlfeChannelPlugin() {
|
|
|
71
66
|
if (accountSection) return {
|
|
72
67
|
accountId: id,
|
|
73
68
|
enabled: accountSection.enabled !== false,
|
|
74
|
-
|
|
75
|
-
defaultTo: accountSection.defaultTo,
|
|
76
|
-
dmPolicy: accountSection.dmPolicy
|
|
69
|
+
defaultTo: accountSection.defaultTo
|
|
77
70
|
};
|
|
78
71
|
return {
|
|
79
72
|
accountId: id,
|
|
80
73
|
enabled: section.enabled !== false,
|
|
81
|
-
|
|
82
|
-
defaultTo: section.defaultTo,
|
|
83
|
-
dmPolicy: section.dmPolicy
|
|
74
|
+
defaultTo: section.defaultTo
|
|
84
75
|
};
|
|
85
76
|
},
|
|
86
77
|
defaultAccountId() {
|
|
@@ -96,15 +87,9 @@ function createAlfeChannelPlugin() {
|
|
|
96
87
|
return {
|
|
97
88
|
accountId: account.accountId,
|
|
98
89
|
enabled: account.enabled,
|
|
99
|
-
configured: true
|
|
100
|
-
dmPolicy: account.dmPolicy
|
|
90
|
+
configured: true
|
|
101
91
|
};
|
|
102
92
|
},
|
|
103
|
-
resolveAllowFrom(params) {
|
|
104
|
-
const section = getChannelSection(params.cfg);
|
|
105
|
-
const id = params.accountId ?? DEFAULT_ACCOUNT_ID;
|
|
106
|
-
return normalizeAllowFrom((section.accounts?.[id])?.allowFrom ?? section.allowFrom);
|
|
107
|
-
},
|
|
108
93
|
resolveDefaultTo(params) {
|
|
109
94
|
const section = getChannelSection(params.cfg);
|
|
110
95
|
const id = params.accountId ?? DEFAULT_ACCOUNT_ID;
|
|
@@ -633,13 +618,13 @@ async function handleAgentRequest(request, log) {
|
|
|
633
618
|
chatClient?.sendResponse(request.id, false, { message: "OpenClaw SDK not available — cannot dispatch" });
|
|
634
619
|
return;
|
|
635
620
|
}
|
|
636
|
-
const { message, sessionKey: legacySessionKey, userId, conversationId, conversationType, tenantId, clientType, displayName, attachments: rawAttachments, a2a } = request.params;
|
|
621
|
+
const { message, sessionKey: legacySessionKey, userId, conversationId, conversationType, tenantId, clientType, displayName, identityId, attachments: rawAttachments, a2a } = request.params;
|
|
637
622
|
const isA2A = !!a2a;
|
|
638
623
|
if (!message && !rawAttachments?.length) {
|
|
639
624
|
chatClient?.sendResponse(request.id, false, { message: "Missing message" });
|
|
640
625
|
return;
|
|
641
626
|
}
|
|
642
|
-
const senderId =
|
|
627
|
+
const senderId = userId ?? "anon";
|
|
643
628
|
const cfg = runtime.config.loadConfig();
|
|
644
629
|
const sessionId = conversationId ?? legacySessionKey;
|
|
645
630
|
if (!await getSession(sessionId)) await createSession(sessionId, "", "alfe", tenantId, userId);
|
|
@@ -689,7 +674,7 @@ async function handleAgentRequest(request, log) {
|
|
|
689
674
|
id: conversationId ? `${senderId}:conv:${conversationId}` : senderId
|
|
690
675
|
},
|
|
691
676
|
senderId,
|
|
692
|
-
senderAddress:
|
|
677
|
+
senderAddress: senderId,
|
|
693
678
|
recipientAddress: "agent",
|
|
694
679
|
conversationLabel,
|
|
695
680
|
rawBody: message || "",
|
|
@@ -701,6 +686,8 @@ async function handleAgentRequest(request, log) {
|
|
|
701
686
|
...clientType ? { ClientType: clientType } : {},
|
|
702
687
|
...conversationId ? { ConversationId: conversationId } : {},
|
|
703
688
|
...displayName ? { SenderName: displayName } : {},
|
|
689
|
+
...identityId ? { IdentityId: identityId } : {},
|
|
690
|
+
...userId ? { UserId: userId } : {},
|
|
704
691
|
ChannelMode: channelMode,
|
|
705
692
|
...isA2A ? {
|
|
706
693
|
CallerType: "agent",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfe.ai/openclaw-chat",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"description": "OpenClaw chat plugin for Alfe — web widget and mobile app channels",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/plugin.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"openclaw.plugin.json"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@alfe.ai/agent-api-client": "^0.0
|
|
30
|
+
"@alfe.ai/agent-api-client": "^0.1.0",
|
|
31
31
|
"@alfe.ai/chat": "^0.0.8",
|
|
32
32
|
"@alfe.ai/config": "^0.0.8"
|
|
33
33
|
},
|