mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
fix(qa): include mention helpers in lab runtime
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user