@alfe.ai/openclaw-chat 0.9.7 → 0.9.9
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 +8 -33
- package/dist/plugin2.js +4 -29
- package/package.json +5 -4
package/dist/plugin2.cjs
CHANGED
|
@@ -7,6 +7,7 @@ let node_url = require("node:url");
|
|
|
7
7
|
let node_os = require("node:os");
|
|
8
8
|
let _alfe_ai_chat = require("@alfe.ai/chat");
|
|
9
9
|
let _alfe_ai_agent_api_client = require("@alfe.ai/agent-api-client");
|
|
10
|
+
let _alfe_ai_openclaw_plugin_kit = require("@alfe.ai/openclaw-plugin-kit");
|
|
10
11
|
let node_crypto = require("node:crypto");
|
|
11
12
|
let _alfe_ai_config = require("@alfe.ai/config");
|
|
12
13
|
//#region src/outbound-media.ts
|
|
@@ -1505,33 +1506,6 @@ function disarmA2AEndSignal() {
|
|
|
1505
1506
|
function isA2AEndSignalled() {
|
|
1506
1507
|
return conversationEndRequested;
|
|
1507
1508
|
}
|
|
1508
|
-
function ok(result) {
|
|
1509
|
-
return { content: [{
|
|
1510
|
-
type: "text",
|
|
1511
|
-
text: JSON.stringify(result)
|
|
1512
|
-
}] };
|
|
1513
|
-
}
|
|
1514
|
-
function errResult(message) {
|
|
1515
|
-
return { content: [{
|
|
1516
|
-
type: "text",
|
|
1517
|
-
text: JSON.stringify({ error: message })
|
|
1518
|
-
}] };
|
|
1519
|
-
}
|
|
1520
|
-
function defineTool(def) {
|
|
1521
|
-
return {
|
|
1522
|
-
name: def.name,
|
|
1523
|
-
description: def.description,
|
|
1524
|
-
label: def.name,
|
|
1525
|
-
parameters: def.parameters,
|
|
1526
|
-
execute: async (_toolCallId, params) => {
|
|
1527
|
-
try {
|
|
1528
|
-
return ok(await def.handler(params));
|
|
1529
|
-
} catch (e) {
|
|
1530
|
-
return errResult(e.message);
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
};
|
|
1534
|
-
}
|
|
1535
1509
|
function buildA2ATools(getChatClient, log, present) {
|
|
1536
1510
|
const requireClient = () => {
|
|
1537
1511
|
const client = getChatClient();
|
|
@@ -1539,7 +1513,7 @@ function buildA2ATools(getChatClient, log, present) {
|
|
|
1539
1513
|
return client;
|
|
1540
1514
|
};
|
|
1541
1515
|
const tools = [
|
|
1542
|
-
defineTool({
|
|
1516
|
+
(0, _alfe_ai_openclaw_plugin_kit.defineTool)({
|
|
1543
1517
|
name: "list_agents",
|
|
1544
1518
|
description: "List other agents in your organization that you can communicate with.",
|
|
1545
1519
|
parameters: {
|
|
@@ -1552,7 +1526,7 @@ function buildA2ATools(getChatClient, log, present) {
|
|
|
1552
1526
|
return await requireClient().sendRequest("a2a.list-agents", {});
|
|
1553
1527
|
}
|
|
1554
1528
|
}),
|
|
1555
|
-
defineTool({
|
|
1529
|
+
(0, _alfe_ai_openclaw_plugin_kit.defineTool)({
|
|
1556
1530
|
name: "message_agent",
|
|
1557
1531
|
description: "Send a message to another agent. Starts a new conversation thread, or continues an existing one. The conversation will bounce back and forth automatically until one agent calls end_conversation() or says [RESOLVED].",
|
|
1558
1532
|
parameters: {
|
|
@@ -1592,7 +1566,7 @@ function buildA2ATools(getChatClient, log, present) {
|
|
|
1592
1566
|
});
|
|
1593
1567
|
}
|
|
1594
1568
|
}),
|
|
1595
|
-
defineTool({
|
|
1569
|
+
(0, _alfe_ai_openclaw_plugin_kit.defineTool)({
|
|
1596
1570
|
name: "end_conversation",
|
|
1597
1571
|
description: "End the current agent-to-agent conversation. Call this when the discussion is resolved and no further exchanges are needed.",
|
|
1598
1572
|
parameters: {
|
|
@@ -1614,7 +1588,7 @@ function buildA2ATools(getChatClient, log, present) {
|
|
|
1614
1588
|
}
|
|
1615
1589
|
})
|
|
1616
1590
|
];
|
|
1617
|
-
if (present) tools.push(defineTool({
|
|
1591
|
+
if (present) tools.push((0, _alfe_ai_openclaw_plugin_kit.defineTool)({
|
|
1618
1592
|
name: "chat_present_components",
|
|
1619
1593
|
description: "Attach interactive UI components to a chat message so the user can act with a tap instead of typing. PREFER components whenever you offer the user a discrete set of choices — a quick_reply or select reads far better than \"reply 1, 2, or 3\". Use:\n • quick_reply — one-tap canned replies for a short set of options.\n • select — a single choice from a longer list (dropdown).\n • multi_select — let the user pick MANY options, then submit.\n • confirm — an approval / yes-no decision (primary + secondary button).\n • link_button — an actionable LINK (open a dashboard, a browser-takeover deep link). URL must be https on an Alfe-owned host.\n • copy_button — let the user copy a value (token, id, snippet) to their clipboard.\nChoosing/submitting an interactive component sends the chosen value back AS THE USER'S NEXT MESSAGE, so the conversation continues normally — you will see it as ordinary user input. Don't button-spam: components are for real interactions, not decoration, and each message allows at most 10. Components degrade to plain text on clients that don't render them, so keep the essentials in `text` too.\nExamples:\n Approval: { to:\"conv:abc\", text:\"Deploy to production?\", components:[ { type:\"confirm\", id:\"c1\", confirmLabel:\"Deploy\", confirmValue:\"yes, deploy\", cancelLabel:\"Cancel\", cancelValue:\"no, hold off\" } ] }\n Pick one: { to:\"user:u_123\", text:\"Which environment?\", components:[ { type:\"select\", id:\"s1\", placeholder:\"Choose an environment\", options:[ { label:\"Dev\", value:\"dev\" }, { label:\"Staging\", value:\"staging\" }, { label:\"Prod\", value:\"prod\" } ] } ] }\n Link: { to:\"conv:abc\", text:\"I need you to finish the login step.\", components:[ { type:\"link_button\", id:\"b1\", label:\"Open browser session\", url:\"https://app.alfe.ai/agents/x?tab=browser\", target:\"new-tab\", style:\"primary\" } ] }",
|
|
1620
1594
|
parameters: {
|
|
@@ -2233,6 +2207,7 @@ async function resolveOpenClawSdk(log) {
|
|
|
2233
2207
|
} catch {}
|
|
2234
2208
|
log.warn(`OpenClaw SDK not resolvable — chat dispatch will not work. argv1=${process.argv[1] ?? "<none>"} execPath=${process.execPath} PATH=${pathEnv ? "set" : "EMPTY"} anchorsTried=[${anchors.join(", ")}]`);
|
|
2235
2209
|
}
|
|
2210
|
+
const CHAT_ACTIVATION_KEY = (0, _alfe_ai_openclaw_plugin_kit.getActivationKey)("chat");
|
|
2236
2211
|
let pluginRuntime = null;
|
|
2237
2212
|
let chatClient = null;
|
|
2238
2213
|
let connectingPromise = null;
|
|
@@ -3056,7 +3031,6 @@ const plugin = {
|
|
|
3056
3031
|
connectingPromise = thisConnect;
|
|
3057
3032
|
};
|
|
3058
3033
|
const stopChatService = async () => {
|
|
3059
|
-
globalThis.__alfeChatPluginActivated = false;
|
|
3060
3034
|
if (connectingPromise) {
|
|
3061
3035
|
await connectingPromise.catch((err) => {
|
|
3062
3036
|
log.debug(`Connection attempt failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -3070,6 +3044,7 @@ const plugin = {
|
|
|
3070
3044
|
}
|
|
3071
3045
|
pluginRuntime = null;
|
|
3072
3046
|
dispatchInbound = null;
|
|
3047
|
+
(0, _alfe_ai_openclaw_plugin_kit.resetActivation)(CHAT_ACTIVATION_KEY);
|
|
3073
3048
|
log.info("Chat plugin deactivated");
|
|
3074
3049
|
};
|
|
3075
3050
|
const gw = globalThis;
|
|
@@ -3147,7 +3122,6 @@ const plugin = {
|
|
|
3147
3122
|
log.info("Chat plugin registered");
|
|
3148
3123
|
},
|
|
3149
3124
|
async deactivate(api) {
|
|
3150
|
-
globalThis.__alfeChatPluginActivated = false;
|
|
3151
3125
|
const log = api.logger;
|
|
3152
3126
|
log.info("Chat plugin deactivating...");
|
|
3153
3127
|
if (connectingPromise) {
|
|
@@ -3163,6 +3137,7 @@ const plugin = {
|
|
|
3163
3137
|
}
|
|
3164
3138
|
pluginRuntime = null;
|
|
3165
3139
|
dispatchInbound = null;
|
|
3140
|
+
(0, _alfe_ai_openclaw_plugin_kit.resetActivation)(CHAT_ACTIVATION_KEY);
|
|
3166
3141
|
log.info("Chat plugin deactivated");
|
|
3167
3142
|
}
|
|
3168
3143
|
};
|
package/dist/plugin2.js
CHANGED
|
@@ -7,6 +7,7 @@ import { pathToFileURL } from "node:url";
|
|
|
7
7
|
import { homedir } from "node:os";
|
|
8
8
|
import { ChatServiceClient, resolveAlfeChat } from "@alfe.ai/chat";
|
|
9
9
|
import { AgentApiClient, installToolErrorCapture } from "@alfe.ai/agent-api-client";
|
|
10
|
+
import { defineTool, getActivationKey, resetActivation } from "@alfe.ai/openclaw-plugin-kit";
|
|
10
11
|
import { randomUUID } from "node:crypto";
|
|
11
12
|
import { resolveConfig } from "@alfe.ai/config";
|
|
12
13
|
//#region src/outbound-media.ts
|
|
@@ -1505,33 +1506,6 @@ function disarmA2AEndSignal() {
|
|
|
1505
1506
|
function isA2AEndSignalled() {
|
|
1506
1507
|
return conversationEndRequested;
|
|
1507
1508
|
}
|
|
1508
|
-
function ok(result) {
|
|
1509
|
-
return { content: [{
|
|
1510
|
-
type: "text",
|
|
1511
|
-
text: JSON.stringify(result)
|
|
1512
|
-
}] };
|
|
1513
|
-
}
|
|
1514
|
-
function errResult(message) {
|
|
1515
|
-
return { content: [{
|
|
1516
|
-
type: "text",
|
|
1517
|
-
text: JSON.stringify({ error: message })
|
|
1518
|
-
}] };
|
|
1519
|
-
}
|
|
1520
|
-
function defineTool(def) {
|
|
1521
|
-
return {
|
|
1522
|
-
name: def.name,
|
|
1523
|
-
description: def.description,
|
|
1524
|
-
label: def.name,
|
|
1525
|
-
parameters: def.parameters,
|
|
1526
|
-
execute: async (_toolCallId, params) => {
|
|
1527
|
-
try {
|
|
1528
|
-
return ok(await def.handler(params));
|
|
1529
|
-
} catch (e) {
|
|
1530
|
-
return errResult(e.message);
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
};
|
|
1534
|
-
}
|
|
1535
1509
|
function buildA2ATools(getChatClient, log, present) {
|
|
1536
1510
|
const requireClient = () => {
|
|
1537
1511
|
const client = getChatClient();
|
|
@@ -2233,6 +2207,7 @@ async function resolveOpenClawSdk(log) {
|
|
|
2233
2207
|
} catch {}
|
|
2234
2208
|
log.warn(`OpenClaw SDK not resolvable — chat dispatch will not work. argv1=${process.argv[1] ?? "<none>"} execPath=${process.execPath} PATH=${pathEnv ? "set" : "EMPTY"} anchorsTried=[${anchors.join(", ")}]`);
|
|
2235
2209
|
}
|
|
2210
|
+
const CHAT_ACTIVATION_KEY = getActivationKey("chat");
|
|
2236
2211
|
let pluginRuntime = null;
|
|
2237
2212
|
let chatClient = null;
|
|
2238
2213
|
let connectingPromise = null;
|
|
@@ -3056,7 +3031,6 @@ const plugin = {
|
|
|
3056
3031
|
connectingPromise = thisConnect;
|
|
3057
3032
|
};
|
|
3058
3033
|
const stopChatService = async () => {
|
|
3059
|
-
globalThis.__alfeChatPluginActivated = false;
|
|
3060
3034
|
if (connectingPromise) {
|
|
3061
3035
|
await connectingPromise.catch((err) => {
|
|
3062
3036
|
log.debug(`Connection attempt failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -3070,6 +3044,7 @@ const plugin = {
|
|
|
3070
3044
|
}
|
|
3071
3045
|
pluginRuntime = null;
|
|
3072
3046
|
dispatchInbound = null;
|
|
3047
|
+
resetActivation(CHAT_ACTIVATION_KEY);
|
|
3073
3048
|
log.info("Chat plugin deactivated");
|
|
3074
3049
|
};
|
|
3075
3050
|
const gw = globalThis;
|
|
@@ -3147,7 +3122,6 @@ const plugin = {
|
|
|
3147
3122
|
log.info("Chat plugin registered");
|
|
3148
3123
|
},
|
|
3149
3124
|
async deactivate(api) {
|
|
3150
|
-
globalThis.__alfeChatPluginActivated = false;
|
|
3151
3125
|
const log = api.logger;
|
|
3152
3126
|
log.info("Chat plugin deactivating...");
|
|
3153
3127
|
if (connectingPromise) {
|
|
@@ -3163,6 +3137,7 @@ const plugin = {
|
|
|
3163
3137
|
}
|
|
3164
3138
|
pluginRuntime = null;
|
|
3165
3139
|
dispatchInbound = null;
|
|
3140
|
+
resetActivation(CHAT_ACTIVATION_KEY);
|
|
3166
3141
|
log.info("Chat plugin deactivated");
|
|
3167
3142
|
}
|
|
3168
3143
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfe.ai/openclaw-chat",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
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,9 +27,10 @@
|
|
|
27
27
|
"openclaw.plugin.json"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@alfe.ai/agent-api-client": "^0.
|
|
31
|
-
"@alfe.ai/chat": "^0.0.
|
|
32
|
-
"@alfe.ai/config": "^0.
|
|
30
|
+
"@alfe.ai/agent-api-client": "^0.14.0",
|
|
31
|
+
"@alfe.ai/chat": "^0.0.17",
|
|
32
|
+
"@alfe.ai/config": "^0.4.0",
|
|
33
|
+
"@alfe.ai/openclaw-plugin-kit": "0.1.0"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
36
|
"openclaw": ">=2026.3.0"
|