@velanir/openclaw-participation-gate 0.1.2 → 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/README.md +1 -1
- package/dist/index.js +21 -8
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The plugin is designed for the `requireMention: false` use case: the coworker ca
|
|
|
10
10
|
- OpenClaw plugin id: `velanir-participation-gate`
|
|
11
11
|
- Runtime hooks: `before_dispatch`, `message_sent`, `reply_payload_sending`
|
|
12
12
|
- Default mode: `shadow`
|
|
13
|
-
- Target OpenClaw plugin API: `>=2026.
|
|
13
|
+
- Target OpenClaw plugin API: `>=2026.6.6`
|
|
14
14
|
|
|
15
15
|
The platform monorepo owns the source package in `packages/openclaw-plugins/participation-gate`. Customer machines install the built package into their OpenClaw runtime.
|
|
16
16
|
|
package/dist/index.js
CHANGED
|
@@ -2236,21 +2236,34 @@ function mergeRecentMessages(params) {
|
|
|
2236
2236
|
}
|
|
2237
2237
|
const merged = [];
|
|
2238
2238
|
const seen = /* @__PURE__ */ new Set();
|
|
2239
|
+
const messageKey = (message2) => [
|
|
2240
|
+
message2.role ?? "user",
|
|
2241
|
+
message2.senderId ?? "",
|
|
2242
|
+
message2.senderName ?? "",
|
|
2243
|
+
message2.timestamp ?? "",
|
|
2244
|
+
message2.content
|
|
2245
|
+
].join("\0");
|
|
2239
2246
|
for (const message2 of [...params.localHistory, ...params.inboundHistory]) {
|
|
2240
|
-
const key =
|
|
2241
|
-
message2.role ?? "user",
|
|
2242
|
-
message2.senderId ?? "",
|
|
2243
|
-
message2.senderName ?? "",
|
|
2244
|
-
message2.timestamp ?? "",
|
|
2245
|
-
message2.content
|
|
2246
|
-
].join("\0");
|
|
2247
|
+
const key = messageKey(message2);
|
|
2247
2248
|
if (seen.has(key)) {
|
|
2248
2249
|
continue;
|
|
2249
2250
|
}
|
|
2250
2251
|
seen.add(key);
|
|
2251
2252
|
merged.push(message2);
|
|
2252
2253
|
}
|
|
2253
|
-
|
|
2254
|
+
const selectedKeys = new Set(merged.slice(-params.maxMessages).map(messageKey));
|
|
2255
|
+
const localAssistantKeys = params.localHistory.filter((message2) => message2.role === "assistant").map(messageKey).filter((key, index, keys) => keys.indexOf(key) === index).slice(-params.maxMessages);
|
|
2256
|
+
for (const assistantKey of localAssistantKeys) {
|
|
2257
|
+
if (selectedKeys.has(assistantKey)) {
|
|
2258
|
+
continue;
|
|
2259
|
+
}
|
|
2260
|
+
const keyToDrop = merged.map(messageKey).find((key) => selectedKeys.has(key) && !localAssistantKeys.includes(key));
|
|
2261
|
+
if (keyToDrop) {
|
|
2262
|
+
selectedKeys.delete(keyToDrop);
|
|
2263
|
+
}
|
|
2264
|
+
selectedKeys.add(assistantKey);
|
|
2265
|
+
}
|
|
2266
|
+
return merged.filter((message2) => selectedKeys.has(messageKey(message2)));
|
|
2254
2267
|
}
|
|
2255
2268
|
function buildClassifierInput(params) {
|
|
2256
2269
|
const inboundHistory = eventRecentMessages(params.event, params.maxMessages);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velanir/openclaw-participation-gate",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "OpenClaw plugin that gates group/channel participation for Velanir digital coworkers.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"test": "pnpm --filter=@oct8/oct8-secrets build && vitest run"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"openclaw": ">=2026.
|
|
37
|
+
"openclaw": ">=2026.6.6"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
40
|
"openclaw": {
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"./dist/index.js"
|
|
58
58
|
],
|
|
59
59
|
"compat": {
|
|
60
|
-
"pluginApi": ">=2026.
|
|
61
|
-
"minGatewayVersion": "2026.
|
|
60
|
+
"pluginApi": ">=2026.6.6",
|
|
61
|
+
"minGatewayVersion": "2026.6.6"
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|