@alfe.ai/openclaw-chat 0.2.1 → 0.2.2
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 +13 -10
- package/dist/plugin2.js +13 -10
- package/package.json +3 -3
package/dist/plugin2.cjs
CHANGED
|
@@ -434,7 +434,12 @@ function defineTool(def) {
|
|
|
434
434
|
}
|
|
435
435
|
};
|
|
436
436
|
}
|
|
437
|
-
function buildA2ATools(
|
|
437
|
+
function buildA2ATools(getChatClient, log) {
|
|
438
|
+
const requireClient = () => {
|
|
439
|
+
const client = getChatClient();
|
|
440
|
+
if (!client) throw new Error("chat service not connected yet — try again in a moment");
|
|
441
|
+
return client;
|
|
442
|
+
};
|
|
438
443
|
return [
|
|
439
444
|
defineTool({
|
|
440
445
|
name: "list_agents",
|
|
@@ -446,7 +451,7 @@ function buildA2ATools(chatClient, log) {
|
|
|
446
451
|
},
|
|
447
452
|
handler: async () => {
|
|
448
453
|
log.info("list_agents tool called");
|
|
449
|
-
return await
|
|
454
|
+
return await requireClient().sendRequest("a2a.list-agents", {});
|
|
450
455
|
}
|
|
451
456
|
}),
|
|
452
457
|
defineTool({
|
|
@@ -481,7 +486,7 @@ function buildA2ATools(chatClient, log) {
|
|
|
481
486
|
const maxDepth = params.max_depth ?? 10;
|
|
482
487
|
if (!agentId || !message) throw new Error("agent_id and message are required");
|
|
483
488
|
log.info(`message_agent tool: sending to ${agentId}`);
|
|
484
|
-
return await
|
|
489
|
+
return await requireClient().sendRequest("a2a.send", {
|
|
485
490
|
targetAgentId: agentId,
|
|
486
491
|
message,
|
|
487
492
|
threadId,
|
|
@@ -1066,6 +1071,11 @@ const plugin = {
|
|
|
1066
1071
|
});
|
|
1067
1072
|
api.registerChannel(alfeChannel);
|
|
1068
1073
|
log.info(`Registered channel: ${alfeChannel.id}`);
|
|
1074
|
+
if (typeof api.registerTool === "function") {
|
|
1075
|
+
const a2aTools = buildA2ATools(() => chatClient, log);
|
|
1076
|
+
for (const tool of a2aTools) api.registerTool(tool);
|
|
1077
|
+
log.info(`Registered ${String(a2aTools.length)} agent-to-agent tools`);
|
|
1078
|
+
}
|
|
1069
1079
|
const pluginConfig = (((api.config ?? {}).plugins?.entries)?.["@alfe.ai/openclaw-chat"] ?? {}).config ?? {};
|
|
1070
1080
|
const startChatService = () => {
|
|
1071
1081
|
if (globalThis.__alfeChatPluginActivated === true) {
|
|
@@ -1112,13 +1122,6 @@ const plugin = {
|
|
|
1112
1122
|
log.error(`Failed to initialize chat service: ${err instanceof Error ? err.message : String(err)}`);
|
|
1113
1123
|
}
|
|
1114
1124
|
});
|
|
1115
|
-
if (typeof api.registerTool === "function") connectingPromise.then(() => {
|
|
1116
|
-
if (chatClient && typeof api.registerTool === "function") {
|
|
1117
|
-
const a2aTools = buildA2ATools(chatClient, log);
|
|
1118
|
-
for (const tool of a2aTools) api.registerTool(tool);
|
|
1119
|
-
log.info(`Registered ${String(a2aTools.length)} agent-to-agent tools`);
|
|
1120
|
-
}
|
|
1121
|
-
}).catch(() => {});
|
|
1122
1125
|
};
|
|
1123
1126
|
const stopChatService = async () => {
|
|
1124
1127
|
globalThis.__alfeChatPluginActivated = false;
|
package/dist/plugin2.js
CHANGED
|
@@ -434,7 +434,12 @@ function defineTool(def) {
|
|
|
434
434
|
}
|
|
435
435
|
};
|
|
436
436
|
}
|
|
437
|
-
function buildA2ATools(
|
|
437
|
+
function buildA2ATools(getChatClient, log) {
|
|
438
|
+
const requireClient = () => {
|
|
439
|
+
const client = getChatClient();
|
|
440
|
+
if (!client) throw new Error("chat service not connected yet — try again in a moment");
|
|
441
|
+
return client;
|
|
442
|
+
};
|
|
438
443
|
return [
|
|
439
444
|
defineTool({
|
|
440
445
|
name: "list_agents",
|
|
@@ -446,7 +451,7 @@ function buildA2ATools(chatClient, log) {
|
|
|
446
451
|
},
|
|
447
452
|
handler: async () => {
|
|
448
453
|
log.info("list_agents tool called");
|
|
449
|
-
return await
|
|
454
|
+
return await requireClient().sendRequest("a2a.list-agents", {});
|
|
450
455
|
}
|
|
451
456
|
}),
|
|
452
457
|
defineTool({
|
|
@@ -481,7 +486,7 @@ function buildA2ATools(chatClient, log) {
|
|
|
481
486
|
const maxDepth = params.max_depth ?? 10;
|
|
482
487
|
if (!agentId || !message) throw new Error("agent_id and message are required");
|
|
483
488
|
log.info(`message_agent tool: sending to ${agentId}`);
|
|
484
|
-
return await
|
|
489
|
+
return await requireClient().sendRequest("a2a.send", {
|
|
485
490
|
targetAgentId: agentId,
|
|
486
491
|
message,
|
|
487
492
|
threadId,
|
|
@@ -1066,6 +1071,11 @@ const plugin = {
|
|
|
1066
1071
|
});
|
|
1067
1072
|
api.registerChannel(alfeChannel);
|
|
1068
1073
|
log.info(`Registered channel: ${alfeChannel.id}`);
|
|
1074
|
+
if (typeof api.registerTool === "function") {
|
|
1075
|
+
const a2aTools = buildA2ATools(() => chatClient, log);
|
|
1076
|
+
for (const tool of a2aTools) api.registerTool(tool);
|
|
1077
|
+
log.info(`Registered ${String(a2aTools.length)} agent-to-agent tools`);
|
|
1078
|
+
}
|
|
1069
1079
|
const pluginConfig = (((api.config ?? {}).plugins?.entries)?.["@alfe.ai/openclaw-chat"] ?? {}).config ?? {};
|
|
1070
1080
|
const startChatService = () => {
|
|
1071
1081
|
if (globalThis.__alfeChatPluginActivated === true) {
|
|
@@ -1112,13 +1122,6 @@ const plugin = {
|
|
|
1112
1122
|
log.error(`Failed to initialize chat service: ${err instanceof Error ? err.message : String(err)}`);
|
|
1113
1123
|
}
|
|
1114
1124
|
});
|
|
1115
|
-
if (typeof api.registerTool === "function") connectingPromise.then(() => {
|
|
1116
|
-
if (chatClient && typeof api.registerTool === "function") {
|
|
1117
|
-
const a2aTools = buildA2ATools(chatClient, log);
|
|
1118
|
-
for (const tool of a2aTools) api.registerTool(tool);
|
|
1119
|
-
log.info(`Registered ${String(a2aTools.length)} agent-to-agent tools`);
|
|
1120
|
-
}
|
|
1121
|
-
}).catch(() => {});
|
|
1122
1125
|
};
|
|
1123
1126
|
const stopChatService = async () => {
|
|
1124
1127
|
globalThis.__alfeChatPluginActivated = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfe.ai/openclaw-chat",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "OpenClaw chat plugin for Alfe — web widget and mobile app channels",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/plugin.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@alfe.ai/agent-api-client": "^0.2.2",
|
|
31
|
-
"@alfe.ai/
|
|
32
|
-
"@alfe.ai/
|
|
31
|
+
"@alfe.ai/config": "^0.0.9",
|
|
32
|
+
"@alfe.ai/chat": "^0.0.10"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"openclaw": ">=2026.3.0"
|