@coolclaw/coolclaw 1.0.10 → 1.0.12
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.
|
@@ -1308,6 +1308,14 @@ async function submitBackendFallbackWithLog(params) {
|
|
|
1308
1308
|
function isGameActionSubmitUncertainError(message) {
|
|
1309
1309
|
return /request timed out|wss client stopped|websocket.*clos|socket hang up|econnreset|write epipe/i.test(message);
|
|
1310
1310
|
}
|
|
1311
|
+
function isNoReplyText(text) {
|
|
1312
|
+
const trimmed = text.trim();
|
|
1313
|
+
if (!trimmed) return false;
|
|
1314
|
+
const noReplyTokens = /* @__PURE__ */ new Set(["NO_REPLY", "[NO_REPLY]", "<NO_REPLY>"]);
|
|
1315
|
+
const lines = trimmed.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
1316
|
+
const lastLine = lines.at(-1)?.toUpperCase();
|
|
1317
|
+
return lastLine ? noReplyTokens.has(lastLine) : false;
|
|
1318
|
+
}
|
|
1311
1319
|
var runtimeClients = /* @__PURE__ */ new Map();
|
|
1312
1320
|
function setRuntimeClient(accountKey, client) {
|
|
1313
1321
|
runtimeClients.set(accountKey, client);
|
|
@@ -1550,6 +1558,7 @@ var coolclawChannelPlugin = createChatChannelPlugin({
|
|
|
1550
1558
|
Surface: "coolclaw",
|
|
1551
1559
|
Channel: "coolclaw",
|
|
1552
1560
|
Peer: peer,
|
|
1561
|
+
WasMentioned: envelope.shouldReply,
|
|
1553
1562
|
Mentioned: envelope.shouldReply
|
|
1554
1563
|
});
|
|
1555
1564
|
const sessionKey = ctxPayload.SessionKey ?? route.sessionKey;
|
|
@@ -1575,6 +1584,8 @@ var coolclawChannelPlugin = createChatChannelPlugin({
|
|
|
1575
1584
|
dispatcherOptions: {
|
|
1576
1585
|
deliver: async (payload) => {
|
|
1577
1586
|
if (!payload.text) return;
|
|
1587
|
+
const replyText = String(payload.text);
|
|
1588
|
+
if (!isGameEvent && isNoReplyText(replyText)) return;
|
|
1578
1589
|
if (isGameEvent && gameMeta) {
|
|
1579
1590
|
if (gameSubmitted) return;
|
|
1580
1591
|
gameBuffer.push(String(payload.text));
|
|
@@ -1623,7 +1634,7 @@ var coolclawChannelPlugin = createChatChannelPlugin({
|
|
|
1623
1634
|
} else {
|
|
1624
1635
|
replyTarget = normalizeCoolclawTarget(envelope.conversationId);
|
|
1625
1636
|
}
|
|
1626
|
-
await sendText({ client: wsClient, target: replyTarget, text:
|
|
1637
|
+
await sendText({ client: wsClient, target: replyTarget, text: replyText });
|
|
1627
1638
|
} catch (err) {
|
|
1628
1639
|
ctx.log?.error(`Failed to deliver reply: ${err instanceof Error ? err.message : String(err)}`);
|
|
1629
1640
|
}
|
|
@@ -1870,13 +1881,14 @@ function buildBodyForAgent(envelope) {
|
|
|
1870
1881
|
}
|
|
1871
1882
|
if (envelope.shouldReply) {
|
|
1872
1883
|
lines.push(`${lines.filter((line) => /^\d+\. /.test(line)).length + 1}. \u4F60\u5DF2\u88AB\u660E\u786E @\uFF0C\u8BF7\u9488\u5BF9\u6D88\u606F\u5185\u5BB9\u8FDB\u884C\u56DE\u590D\u3002`);
|
|
1884
|
+
} else {
|
|
1885
|
+
lines.push(`${lines.filter((line) => /^\d+\. /.test(line)).length + 1}. \u4F60\u6CA1\u6709\u88AB\u660E\u786E @\uFF0C\u8BF7\u5148\u628A\u8FD9\u6761\u6D88\u606F\u4F5C\u4E3A\u7FA4\u804A\u4E0A\u4E0B\u6587\u9605\u8BFB\u3002`);
|
|
1886
|
+
lines.push(`${lines.filter((line) => /^\d+\. /.test(line)).length + 1}. \u5982\u679C\u4F60\u5224\u65AD\u4E0D\u9700\u8981\u516C\u5F00\u56DE\u590D\uFF0C\u8BF7\u53EA\u8F93\u51FA NO_REPLY\uFF1B\u4E0D\u8981\u89E3\u91CA\u539F\u56E0\u3002`);
|
|
1887
|
+
lines.push(`${lines.filter((line) => /^\d+\. /.test(line)).length + 1}. \u53EA\u6709\u5728\u6D88\u606F\u4E0E\u4F60\u5F3A\u76F8\u5173\u4E14\u786E\u5B9E\u9700\u8981\u4F60\u53C2\u4E0E\u65F6\uFF0C\u624D\u8F93\u51FA\u8981\u53D1\u9001\u5230\u7FA4\u91CC\u7684\u516C\u5F00\u56DE\u590D\u5185\u5BB9\u3002`);
|
|
1873
1888
|
}
|
|
1874
1889
|
for (const hint of agentMentionHelpLines) {
|
|
1875
1890
|
lines.push(`${lines.filter((line) => /^\d+\. /.test(line)).length + 1}. ${hint}`);
|
|
1876
1891
|
}
|
|
1877
|
-
if (!envelope.shouldReply && hintLines.length === 0) {
|
|
1878
|
-
lines.push(`${lines.filter((line) => /^\d+\. /.test(line)).length + 1}. \u4F60\u6CA1\u6709\u88AB\u660E\u786E @\uFF0C\u901A\u5E38\u53EA\u9700\u8BB0\u5F55\u4E0A\u4E0B\u6587\uFF0C\u4E0D\u5FC5\u4E3B\u52A8\u56DE\u590D\uFF1B\u53EA\u6709\u5728\u6D88\u606F\u4E0E\u4F60\u5F3A\u76F8\u5173\u65F6\u624D\u8C28\u614E\u53C2\u4E0E\u3002`);
|
|
1879
|
-
}
|
|
1880
1892
|
return lines.join("\n");
|
|
1881
1893
|
}
|
|
1882
1894
|
function buildPrivateBodyForAgent(envelope) {
|
package/dist/cli-metadata.js
CHANGED
package/dist/index.js
CHANGED
package/dist/setup-entry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coolclaw/coolclaw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "OpenClaw native channel plugin for Riddle/CoolClaw chat.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"runtimeSetupEntry": "./dist/setup-entry.js",
|
|
73
73
|
"install": {
|
|
74
74
|
"npmSpec": "@coolclaw/coolclaw",
|
|
75
|
-
"expectedIntegrity": "sha512-
|
|
75
|
+
"expectedIntegrity": "sha512-kOwwkHioI3uu2tM+SKqezQ0zIv9QT7bxENQ55x/592ybrNAwTGbzPSlkaH7KSAep5JcUvaBwYE5wzm+ghS92OQ==",
|
|
76
76
|
"defaultChoice": "npm",
|
|
77
77
|
"minHostVersion": ">=2026.3.22"
|
|
78
78
|
},
|