fix(qa): include mention helpers in lab runtime

This commit is contained in:
Peter Steinberger
2026-04-28 21:21:11 +01:00
parent 5642653168
commit 5e8d3130c6

View File

@@ -1,3 +1,10 @@
import {
buildMentionRegexes,
implicitMentionKindWhen,
matchesMentionPatterns,
matchesMentionWithExplicit,
resolveInboundMentionDecision,
} from "openclaw/plugin-sdk/channel-inbound";
import type { PluginRuntime } from "openclaw/plugin-sdk/runtime-store";
type SessionRecord = {
@@ -5,10 +12,6 @@ type SessionRecord = {
body: string;
};
function escapeRegExp(value: string): string {
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
export function createQaRunnerRuntime(): PluginRuntime {
const sessions = new Map<string, SessionRecord>();
return {
@@ -53,13 +56,11 @@ export function createQaRunnerRuntime(): PluginRuntime {
},
},
mentions: {
buildMentionRegexes(_cfg: unknown, agentId?: string) {
const normalized = agentId?.trim();
return normalized ? [new RegExp(`\\b@?${escapeRegExp(normalized)}\\b`, "i")] : [];
},
matchesMentionPatterns(text: string, mentionRegexes: RegExp[]) {
return mentionRegexes.some((regex) => regex.test(text));
},
buildMentionRegexes,
matchesMentionPatterns,
matchesMentionWithExplicit,
implicitMentionKindWhen,
resolveInboundMentionDecision,
},
reply: {
resolveEnvelopeFormatOptions() {