mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-23 15:11:42 +00:00
perf: short-circuit exact reply suppression targets
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { isMessagingToolDuplicate } from "../../agents/pi-embedded-helpers.js";
|
||||
import type { MessagingToolSend } from "../../agents/pi-embedded-runner.js";
|
||||
import { getChannelPlugin, normalizeChannelId } from "../../channels/plugins/index.js";
|
||||
import { getChannelPlugin } from "../../channels/plugins/index.js";
|
||||
import { normalizeAnyChannelId } from "../../channels/registry.js";
|
||||
import { normalizeTargetForProvider } from "../../infra/outbound/target-normalization.js";
|
||||
import { normalizeOptionalAccountId } from "../../routing/account-id.js";
|
||||
import {
|
||||
@@ -70,7 +71,7 @@ function normalizeProviderForComparison(value?: string): string | undefined {
|
||||
return undefined;
|
||||
}
|
||||
const lowered = normalizeLowercaseStringOrEmpty(trimmed);
|
||||
const normalizedChannel = normalizeChannelId(trimmed);
|
||||
const normalizedChannel = normalizeAnyChannelId(trimmed);
|
||||
if (normalizedChannel) {
|
||||
return normalizedChannel;
|
||||
}
|
||||
@@ -126,10 +127,7 @@ export function shouldSuppressMessagingToolReplies(params: {
|
||||
if (!provider) {
|
||||
return false;
|
||||
}
|
||||
const originTarget = normalizeTargetForProvider(provider, params.originatingTo);
|
||||
if (!originTarget) {
|
||||
return false;
|
||||
}
|
||||
const originRawTarget = normalizeOptionalString(params.originatingTo);
|
||||
const originAccount = normalizeOptionalAccountId(params.accountId);
|
||||
const sentTargets = params.messagingToolSentTargets ?? [];
|
||||
if (sentTargets.length === 0) {
|
||||
@@ -143,14 +141,22 @@ export function shouldSuppressMessagingToolReplies(params: {
|
||||
if (targetProvider !== provider) {
|
||||
return false;
|
||||
}
|
||||
const targetKey = normalizeTargetForProvider(targetProvider, target.to);
|
||||
if (!targetKey) {
|
||||
return false;
|
||||
}
|
||||
const targetAccount = normalizeOptionalAccountId(target.accountId);
|
||||
if (originAccount && targetAccount && originAccount !== targetAccount) {
|
||||
return false;
|
||||
}
|
||||
const targetRaw = normalizeOptionalString(target.to);
|
||||
if (originRawTarget && targetRaw === originRawTarget && !target.threadId) {
|
||||
return true;
|
||||
}
|
||||
const originTarget = normalizeTargetForProvider(provider, originRawTarget);
|
||||
if (!originTarget) {
|
||||
return false;
|
||||
}
|
||||
const targetKey = normalizeTargetForProvider(targetProvider, targetRaw);
|
||||
if (!targetKey) {
|
||||
return false;
|
||||
}
|
||||
return targetsMatchForSuppression({
|
||||
provider,
|
||||
originTarget,
|
||||
|
||||
Reference in New Issue
Block a user