mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-14 02:31:24 +00:00
refactor: centralize inbound mention policy
This commit is contained in:
@@ -82,7 +82,7 @@ const RUNTIME_API_EXPORT_GUARDS: Record<string, readonly string[]> = {
|
||||
'export { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";',
|
||||
'export { GoogleChatConfigSchema, type GoogleChatAccountConfig, type GoogleChatConfig } from "openclaw/plugin-sdk/googlechat-runtime-shared";',
|
||||
'export { extractToolSend } from "openclaw/plugin-sdk/tool-send";',
|
||||
'export { resolveMentionGatingWithBypass } from "openclaw/plugin-sdk/channel-inbound";',
|
||||
'export { resolveInboundMentionDecision } from "openclaw/plugin-sdk/channel-inbound";',
|
||||
'export { resolveInboundRouteEnvelopeBuilderWithRuntime } from "openclaw/plugin-sdk/inbound-envelope";',
|
||||
'export { resolveWebhookPath } from "openclaw/plugin-sdk/webhook-path";',
|
||||
'export { registerWebhookTargetWithPluginRoute, resolveWebhookTargetWithAuthOrReject, withResolvedWebhookRequestPipeline } from "openclaw/plugin-sdk/webhook-targets";',
|
||||
|
||||
@@ -290,6 +290,13 @@ describe("plugin-sdk subpath exports", () => {
|
||||
]) {
|
||||
expectSourceMentions(subpath, ["chunkTextForOutbound"]);
|
||||
}
|
||||
for (const subpath of ["googlechat", "msteams", "nextcloud-talk", "zalouser"]) {
|
||||
expectSourceMentions(subpath, [
|
||||
"resolveInboundMentionDecision",
|
||||
"resolveMentionGating",
|
||||
"resolveMentionGatingWithBypass",
|
||||
]);
|
||||
}
|
||||
expectSourceMentions("approval-auth-runtime", [
|
||||
"createResolvedApproverActionAuthAdapter",
|
||||
"resolveApprovalApprovers",
|
||||
@@ -453,6 +460,7 @@ describe("plugin-sdk subpath exports", () => {
|
||||
"recordInboundSession",
|
||||
"recordInboundSessionMetaSafe",
|
||||
"resolveInboundSessionEnvelopeContext",
|
||||
"resolveInboundMentionDecision",
|
||||
"resolveMentionGating",
|
||||
"resolveMentionGatingWithBypass",
|
||||
"resolveOutboundSendDep",
|
||||
@@ -536,9 +544,11 @@ describe("plugin-sdk subpath exports", () => {
|
||||
"formatInboundEnvelope",
|
||||
"formatInboundFromLabel",
|
||||
"formatLocationText",
|
||||
"implicitMentionKindWhen",
|
||||
"logInboundDrop",
|
||||
"matchesMentionPatterns",
|
||||
"matchesMentionWithExplicit",
|
||||
"resolveInboundMentionDecision",
|
||||
"normalizeMentionText",
|
||||
"resolveInboundDebounceMs",
|
||||
"resolveEnvelopeFormatOptions",
|
||||
|
||||
@@ -35,6 +35,10 @@ import { dispatchReplyWithBufferedBlockDispatcher } from "../../auto-reply/reply
|
||||
import { createReplyDispatcherWithTyping } from "../../auto-reply/reply/reply-dispatcher.js";
|
||||
import { removeAckReactionAfterReply, shouldAckReaction } from "../../channels/ack-reactions.js";
|
||||
import { resolveCommandAuthorizedFromAuthorizers } from "../../channels/command-gating.js";
|
||||
import {
|
||||
implicitMentionKindWhen,
|
||||
resolveInboundMentionDecision,
|
||||
} from "../../channels/mention-gating.js";
|
||||
import {
|
||||
setChannelConversationBindingIdleTimeoutBySessionKey,
|
||||
setChannelConversationBindingMaxAgeBySessionKey,
|
||||
@@ -128,6 +132,8 @@ export function createRuntimeChannel(): PluginRuntime["channel"] {
|
||||
buildMentionRegexes,
|
||||
matchesMentionPatterns,
|
||||
matchesMentionWithExplicit,
|
||||
implicitMentionKindWhen,
|
||||
resolveInboundMentionDecision,
|
||||
},
|
||||
reactions: {
|
||||
shouldAckReaction,
|
||||
|
||||
@@ -83,6 +83,8 @@ export type PluginRuntimeChannel = {
|
||||
buildMentionRegexes: typeof import("../../auto-reply/reply/mentions.js").buildMentionRegexes;
|
||||
matchesMentionPatterns: typeof import("../../auto-reply/reply/mentions.js").matchesMentionPatterns;
|
||||
matchesMentionWithExplicit: typeof import("../../auto-reply/reply/mentions.js").matchesMentionWithExplicit;
|
||||
implicitMentionKindWhen: typeof import("../../channels/mention-gating.js").implicitMentionKindWhen;
|
||||
resolveInboundMentionDecision: typeof import("../../channels/mention-gating.js").resolveInboundMentionDecision;
|
||||
};
|
||||
reactions: {
|
||||
shouldAckReaction: typeof import("../../channels/ack-reactions.js").shouldAckReaction;
|
||||
|
||||
Reference in New Issue
Block a user