@kyan-du/agent-wechat-openclaw 0.15.1 → 0.15.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/index.js +21 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6333,8 +6333,7 @@ import {
|
|
|
6333
6333
|
import {
|
|
6334
6334
|
resolveAllowlistProviderRuntimeGroupPolicy,
|
|
6335
6335
|
resolveDefaultGroupPolicy
|
|
6336
|
-
} from "openclaw/plugin-sdk/
|
|
6337
|
-
import { resolveSenderCommandAuthorization } from "openclaw/plugin-sdk/command-auth";
|
|
6336
|
+
} from "openclaw/plugin-sdk/runtime-group-policy";
|
|
6338
6337
|
var INVISIBLE_TEXT_RE = /[\u200b-\u200f\u202a-\u202e\u2060-\u206f]/g;
|
|
6339
6338
|
var WECHAT_MENTION_START_RE = /^[@@]/u;
|
|
6340
6339
|
function unique(values) {
|
|
@@ -6509,17 +6508,23 @@ function resolveWeChatInboundAccessDecision(params) {
|
|
|
6509
6508
|
}
|
|
6510
6509
|
async function resolveWeChatCommandAuthorization(params) {
|
|
6511
6510
|
const normalizedSenderId = normalizeWeChatId(params.senderId ?? "");
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6511
|
+
if (!params.deps.shouldComputeCommandAuthorized(params.rawBody, params.cfg)) {
|
|
6512
|
+
return void 0;
|
|
6513
|
+
}
|
|
6514
|
+
const isSenderAllowed = (allowFrom) => isWeChatSenderAllowed(normalizedSenderId, normalizeWeChatAllowFrom(allowFrom));
|
|
6515
|
+
const configuredAllowFrom = normalizeAllowEntries(params.allowFromForCommands);
|
|
6516
|
+
const storeAllowFrom = !params.isGroup && params.dmPolicy !== "allowlist" && params.dmPolicy !== "open" ? normalizeWeChatAllowFrom(await params.deps.readAllowFromStore().catch(() => [])) : [];
|
|
6517
|
+
const effectiveAllowFrom = normalizeAllowEntries([...configuredAllowFrom, ...storeAllowFrom]);
|
|
6518
|
+
const effectiveGroupAllowFrom = configuredAllowFrom;
|
|
6519
|
+
const commandAuthorized = params.deps.resolveCommandAuthorizedFromAuthorizers({
|
|
6520
|
+
useAccessGroups: params.cfg.commands?.useAccessGroups !== false,
|
|
6521
|
+
authorizers: [
|
|
6522
|
+
{ configured: effectiveAllowFrom.length > 0, allowed: isSenderAllowed(effectiveAllowFrom) },
|
|
6523
|
+
{
|
|
6524
|
+
configured: effectiveGroupAllowFrom.length > 0,
|
|
6525
|
+
allowed: isSenderAllowed(effectiveGroupAllowFrom)
|
|
6526
|
+
}
|
|
6527
|
+
]
|
|
6523
6528
|
});
|
|
6524
6529
|
return commandAuthorized;
|
|
6525
6530
|
}
|
|
@@ -6531,6 +6536,9 @@ function resolveWeChatMentionGate(params) {
|
|
|
6531
6536
|
const shouldSkip = params.requireMention && params.canDetectMention && !effectiveWasMentioned;
|
|
6532
6537
|
return { effectiveWasMentioned, shouldSkip, shouldBypassMention };
|
|
6533
6538
|
}
|
|
6539
|
+
function normalizeAllowEntries(entries) {
|
|
6540
|
+
return (entries ?? []).map((entry) => String(entry).trim()).filter(Boolean);
|
|
6541
|
+
}
|
|
6534
6542
|
|
|
6535
6543
|
// src/catchup.ts
|
|
6536
6544
|
var DEFAULT_STALE_AFTER_MS = 3 * 60 * 60 * 1e3;
|