@alfe.ai/openclaw-chat 0.1.1 → 0.1.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/plugin2.cjs +9 -1
- package/dist/plugin2.js +9 -1
- package/package.json +2 -2
package/dist/plugin2.cjs
CHANGED
|
@@ -44,6 +44,7 @@ async function sendViaChat(deps, ctx, mediaUrl) {
|
|
|
44
44
|
conversationId,
|
|
45
45
|
text: ctx.text,
|
|
46
46
|
sessionKey: conversationId,
|
|
47
|
+
messageId,
|
|
47
48
|
...mediaUrl ? { mediaUrls: [mediaUrl] } : {}
|
|
48
49
|
});
|
|
49
50
|
return {
|
|
@@ -716,7 +717,7 @@ async function handleAgentRequest(request, log) {
|
|
|
716
717
|
chatClient?.sendResponse(request.id, false, { message: "OpenClaw SDK not available — cannot dispatch" });
|
|
717
718
|
return;
|
|
718
719
|
}
|
|
719
|
-
const { message, sessionKey: legacySessionKey, userId, conversationId, conversationType, tenantId, clientType, displayName, identityId, attachments: rawAttachments, a2a } = request.params;
|
|
720
|
+
const { message, sessionKey: legacySessionKey, userId, conversationId, conversationType, tenantId, clientType, displayName, identityId, senderPermissions, attachments: rawAttachments, a2a, chatMessageId } = request.params;
|
|
720
721
|
const isA2A = !!a2a;
|
|
721
722
|
if (!message && !rawAttachments?.length) {
|
|
722
723
|
chatClient?.sendResponse(request.id, false, { message: "Missing message" });
|
|
@@ -744,6 +745,11 @@ async function handleAgentRequest(request, log) {
|
|
|
744
745
|
try {
|
|
745
746
|
const downloadedFiles = rawAttachments?.length ? await downloadAttachments(rawAttachments, log) : [];
|
|
746
747
|
const bodyForAgent = downloadedFiles.length ? `${message || ""}\n\n[Attached files:\n${downloadedFiles.map((f) => `- ${f.filename}: ${f.localPath}`).join("\n")}]` : void 0;
|
|
748
|
+
if (identityId) fetch("http://127.0.0.1:18193/__alfe/set-identity", {
|
|
749
|
+
method: "POST",
|
|
750
|
+
headers: { "Content-Type": "application/json" },
|
|
751
|
+
body: JSON.stringify({ identityId })
|
|
752
|
+
}).catch(() => {});
|
|
747
753
|
const channelMode = isA2A ? "a2a" : extractChannelMode(conversationId ?? "", clientType ?? "chat");
|
|
748
754
|
const channelLabel = channelMode === "sms" ? "SMS" : channelMode === "whatsapp" ? "WhatsApp" : channelMode === "a2a" ? "Agent" : "Alfe";
|
|
749
755
|
const shortConvId = conversationId?.slice(-8) ?? "";
|
|
@@ -779,6 +785,7 @@ async function handleAgentRequest(request, log) {
|
|
|
779
785
|
...displayName ? { SenderName: displayName } : {},
|
|
780
786
|
...identityId ? { IdentityId: identityId } : {},
|
|
781
787
|
...userId ? { UserId: userId } : {},
|
|
788
|
+
...senderPermissions?.length ? { SenderPermissions: senderPermissions } : {},
|
|
782
789
|
ChannelMode: channelMode,
|
|
783
790
|
...isA2A ? {
|
|
784
791
|
CallerType: "agent",
|
|
@@ -806,6 +813,7 @@ async function handleAgentRequest(request, log) {
|
|
|
806
813
|
conversationId: conversationId ?? legacySessionKey,
|
|
807
814
|
text: responseText,
|
|
808
815
|
sessionKey: resolvedOpenClawKey ?? legacySessionKey,
|
|
816
|
+
messageId: chatMessageId ?? request.id,
|
|
809
817
|
...mediaUrls.length ? { mediaUrls } : {}
|
|
810
818
|
});
|
|
811
819
|
},
|
package/dist/plugin2.js
CHANGED
|
@@ -44,6 +44,7 @@ async function sendViaChat(deps, ctx, mediaUrl) {
|
|
|
44
44
|
conversationId,
|
|
45
45
|
text: ctx.text,
|
|
46
46
|
sessionKey: conversationId,
|
|
47
|
+
messageId,
|
|
47
48
|
...mediaUrl ? { mediaUrls: [mediaUrl] } : {}
|
|
48
49
|
});
|
|
49
50
|
return {
|
|
@@ -716,7 +717,7 @@ async function handleAgentRequest(request, log) {
|
|
|
716
717
|
chatClient?.sendResponse(request.id, false, { message: "OpenClaw SDK not available — cannot dispatch" });
|
|
717
718
|
return;
|
|
718
719
|
}
|
|
719
|
-
const { message, sessionKey: legacySessionKey, userId, conversationId, conversationType, tenantId, clientType, displayName, identityId, attachments: rawAttachments, a2a } = request.params;
|
|
720
|
+
const { message, sessionKey: legacySessionKey, userId, conversationId, conversationType, tenantId, clientType, displayName, identityId, senderPermissions, attachments: rawAttachments, a2a, chatMessageId } = request.params;
|
|
720
721
|
const isA2A = !!a2a;
|
|
721
722
|
if (!message && !rawAttachments?.length) {
|
|
722
723
|
chatClient?.sendResponse(request.id, false, { message: "Missing message" });
|
|
@@ -744,6 +745,11 @@ async function handleAgentRequest(request, log) {
|
|
|
744
745
|
try {
|
|
745
746
|
const downloadedFiles = rawAttachments?.length ? await downloadAttachments(rawAttachments, log) : [];
|
|
746
747
|
const bodyForAgent = downloadedFiles.length ? `${message || ""}\n\n[Attached files:\n${downloadedFiles.map((f) => `- ${f.filename}: ${f.localPath}`).join("\n")}]` : void 0;
|
|
748
|
+
if (identityId) fetch("http://127.0.0.1:18193/__alfe/set-identity", {
|
|
749
|
+
method: "POST",
|
|
750
|
+
headers: { "Content-Type": "application/json" },
|
|
751
|
+
body: JSON.stringify({ identityId })
|
|
752
|
+
}).catch(() => {});
|
|
747
753
|
const channelMode = isA2A ? "a2a" : extractChannelMode(conversationId ?? "", clientType ?? "chat");
|
|
748
754
|
const channelLabel = channelMode === "sms" ? "SMS" : channelMode === "whatsapp" ? "WhatsApp" : channelMode === "a2a" ? "Agent" : "Alfe";
|
|
749
755
|
const shortConvId = conversationId?.slice(-8) ?? "";
|
|
@@ -779,6 +785,7 @@ async function handleAgentRequest(request, log) {
|
|
|
779
785
|
...displayName ? { SenderName: displayName } : {},
|
|
780
786
|
...identityId ? { IdentityId: identityId } : {},
|
|
781
787
|
...userId ? { UserId: userId } : {},
|
|
788
|
+
...senderPermissions?.length ? { SenderPermissions: senderPermissions } : {},
|
|
782
789
|
ChannelMode: channelMode,
|
|
783
790
|
...isA2A ? {
|
|
784
791
|
CallerType: "agent",
|
|
@@ -806,6 +813,7 @@ async function handleAgentRequest(request, log) {
|
|
|
806
813
|
conversationId: conversationId ?? legacySessionKey,
|
|
807
814
|
text: responseText,
|
|
808
815
|
sessionKey: resolvedOpenClawKey ?? legacySessionKey,
|
|
816
|
+
messageId: chatMessageId ?? request.id,
|
|
809
817
|
...mediaUrls.length ? { mediaUrls } : {}
|
|
810
818
|
});
|
|
811
819
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfe.ai/openclaw-chat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
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.1.
|
|
30
|
+
"@alfe.ai/agent-api-client": "^0.1.3",
|
|
31
31
|
"@alfe.ai/chat": "^0.0.8",
|
|
32
32
|
"@alfe.ai/config": "^0.0.8"
|
|
33
33
|
},
|