@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.
Files changed (2) hide show
  1. package/dist/index.js +21 -13
  2. 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/config-runtime";
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
- const { commandAuthorized } = await resolveSenderCommandAuthorization({
6513
- cfg: params.cfg,
6514
- rawBody: params.rawBody,
6515
- isGroup: params.isGroup,
6516
- dmPolicy: params.dmPolicy,
6517
- configuredAllowFrom: params.allowFromForCommands,
6518
- senderId: normalizedSenderId,
6519
- isSenderAllowed: (senderId, allowFrom) => isWeChatSenderAllowed(senderId, normalizeWeChatAllowFrom(allowFrom)),
6520
- readAllowFromStore: async () => normalizeWeChatAllowFrom(await params.deps.readAllowFromStore()),
6521
- shouldComputeCommandAuthorized: params.deps.shouldComputeCommandAuthorized,
6522
- resolveCommandAuthorizedFromAuthorizers: params.deps.resolveCommandAuthorizedFromAuthorizers
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kyan-du/agent-wechat-openclaw",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",