@clawling/clawchat-plugin-openclaw 2026.8.5-2 → 2026.8.6-1
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/src/inbound.js +7 -2
- package/dist/src/protocol-types.js +8 -0
- package/package.json +1 -1
- package/src/inbound.ts +7 -1
- package/src/protocol-types.ts +9 -0
package/dist/src/inbound.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EVENT, } from "./protocol-types.js";
|
|
1
|
+
import { EVENT, MENTION_ALL_USER_ID, } from "./protocol-types.js";
|
|
2
2
|
import { extractMediaFragments, fragmentsToText } from "./message-mapper.js";
|
|
3
3
|
import { hasRenderableText, isInboundMessagePayload } from "./protocol.js";
|
|
4
4
|
function normalizeSender(sender) {
|
|
@@ -73,11 +73,16 @@ function mentionedUserIds(mentions) {
|
|
|
73
73
|
/**
|
|
74
74
|
* Exported for direct unit testing. Direct chats always count as addressed;
|
|
75
75
|
* group chats require a mention unless config opts into all group messages.
|
|
76
|
+
*
|
|
77
|
+
* `MENTION_ALL_USER_ID` ("all") is the `@everyone` sentinel — it addresses
|
|
78
|
+
* every member of the room, this agent included, so it counts as a mention
|
|
79
|
+
* even though it never equals our own user id.
|
|
76
80
|
*/
|
|
77
81
|
export function detectMention(params) {
|
|
78
82
|
if (params.chatType === "direct")
|
|
79
83
|
return true;
|
|
80
|
-
|
|
84
|
+
const ids = mentionedUserIds(normalizeMentionUsers(params.mentions));
|
|
85
|
+
return ids.includes(params.userId) || ids.includes(MENTION_ALL_USER_ID);
|
|
81
86
|
}
|
|
82
87
|
export async function dispatchOpenclawClawlingInbound(params) {
|
|
83
88
|
const { envelope, account, log } = params;
|
|
@@ -22,6 +22,14 @@ export const EVENT = {
|
|
|
22
22
|
PING: "ping",
|
|
23
23
|
PONG: "pong",
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* The `user_id` an `@everyone` mention carries on the wire — a reserved
|
|
27
|
+
* sentinel, not a real user id. The server never expands it into one mention
|
|
28
|
+
* per member, so every reader must decide for itself that it includes them.
|
|
29
|
+
* It can appear both as a `mention` fragment and as a `context.mentions`
|
|
30
|
+
* element. See `docs/client-integration.md` §10.2.
|
|
31
|
+
*/
|
|
32
|
+
export const MENTION_ALL_USER_ID = "all";
|
|
25
33
|
export class AuthError extends Error {
|
|
26
34
|
name = "AuthError";
|
|
27
35
|
}
|
package/package.json
CHANGED
package/src/inbound.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EVENT,
|
|
3
|
+
MENTION_ALL_USER_ID,
|
|
3
4
|
type ChatType,
|
|
4
5
|
type Envelope,
|
|
5
6
|
} from "./protocol-types.ts";
|
|
@@ -180,6 +181,10 @@ function mentionedUserIds(mentions: MentionedUser[]): string[] {
|
|
|
180
181
|
/**
|
|
181
182
|
* Exported for direct unit testing. Direct chats always count as addressed;
|
|
182
183
|
* group chats require a mention unless config opts into all group messages.
|
|
184
|
+
*
|
|
185
|
+
* `MENTION_ALL_USER_ID` ("all") is the `@everyone` sentinel — it addresses
|
|
186
|
+
* every member of the room, this agent included, so it counts as a mention
|
|
187
|
+
* even though it never equals our own user id.
|
|
183
188
|
*/
|
|
184
189
|
export function detectMention(params: {
|
|
185
190
|
mentions: unknown[];
|
|
@@ -187,7 +192,8 @@ export function detectMention(params: {
|
|
|
187
192
|
userId: string;
|
|
188
193
|
}): boolean {
|
|
189
194
|
if (params.chatType === "direct") return true;
|
|
190
|
-
|
|
195
|
+
const ids = mentionedUserIds(normalizeMentionUsers(params.mentions));
|
|
196
|
+
return ids.includes(params.userId) || ids.includes(MENTION_ALL_USER_ID);
|
|
191
197
|
}
|
|
192
198
|
|
|
193
199
|
export async function dispatchOpenclawClawlingInbound(
|
package/src/protocol-types.ts
CHANGED
|
@@ -23,6 +23,15 @@ export const EVENT = {
|
|
|
23
23
|
PONG: "pong",
|
|
24
24
|
} as const;
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* The `user_id` an `@everyone` mention carries on the wire — a reserved
|
|
28
|
+
* sentinel, not a real user id. The server never expands it into one mention
|
|
29
|
+
* per member, so every reader must decide for itself that it includes them.
|
|
30
|
+
* It can appear both as a `mention` fragment and as a `context.mentions`
|
|
31
|
+
* element. See `docs/client-integration.md` §10.2.
|
|
32
|
+
*/
|
|
33
|
+
export const MENTION_ALL_USER_ID = "all";
|
|
34
|
+
|
|
26
35
|
export type KnownEventName = typeof EVENT[keyof typeof EVENT];
|
|
27
36
|
export type EventName = KnownEventName | string;
|
|
28
37
|
export type ChatType = "direct" | "group";
|