import { resolveAgentConfig } from "../../agents/agent-scope.js"; import type { ChannelId } from "../../channels/plugins/channel-id.types.js"; import { getLoadedChannelPluginById } from "../../channels/plugins/registry-loaded.js"; import type { ChannelPlugin } from "../../channels/plugins/types.plugin.js"; import { normalizeAnyChannelId } from "../../channels/registry.js"; import type { OpenClawConfig } from "../../config/types.openclaw.js"; import { createSubsystemLogger } from "../../logging/subsystem.js"; import { compileConfigRegexes, type ConfigRegexRejectReason } from "../../security/config-regex.js"; import {
normalizeLowercaseStringOrEmpty,
normalizeOptionalLowercaseString,
normalizeOptionalString,
} from "../../shared/string-coerce.js"; import { escapeRegExp } from "../../utils.js"; import type { MsgContext } from "../templating.js"; import type { ExplicitMentionSignal } from "./mentions.types.js";
export type {
BuildMentionRegexes,
ExplicitMentionSignal,
MatchesMentionPatterns,
MatchesMentionWithExplicit,
} from "./mentions.types.js";
function deriveMentionPatterns(identity?: { name?: string; emoji?: string }) { const patterns: string[] = []; const name = normalizeOptionalString(identity?.name); if (name) { const parts = name.split(/\s+/).filter(Boolean).map(escapeRegExp); const re = parts.length ? parts.join(String.raw`\s+`) : escapeRegExp(name);
patterns.push(String.raw`\b@?${re}\b`);
} const emoji = normalizeOptionalString(identity?.emoji); if (emoji) {
patterns.push(escapeRegExp(emoji));
} return patterns;
}
// Check transcript if text is empty and transcript is provided const transcriptCleaned = params.transcript ? normalizeMentionText(params.transcript) : ""; const textToCheck = cleaned || transcriptCleaned;
export function stripStructuralPrefixes(text: string): string { if (!text) { return"";
} // Ignore wrapper labels, timestamps, and sender prefixes so directive-only // detection still works in group batches that include history/context. const afterMarker = text.includes(CURRENT_MESSAGE_MARKER)
? text.slice(text.indexOf(CURRENT_MESSAGE_MARKER) + CURRENT_MESSAGE_MARKER.length).trimStart()
: text;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.