fix(qa): add mention helpers to lab harness · openclaw/openclaw@5642653
steipete
·
2026-04-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,6 +5,10 @@ type SessionRecord = {
|
5 | 5 | body: string; |
6 | 6 | }; |
7 | 7 | |
| 8 | +function escapeRegExp(value: string): string { |
| 9 | +return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |
| 10 | +} |
| 11 | + |
8 | 12 | export function createQaRunnerRuntime(): PluginRuntime { |
9 | 13 | const sessions = new Map<string, SessionRecord>(); |
10 | 14 | return { |
@@ -48,6 +52,15 @@ export function createQaRunnerRuntime(): PluginRuntime {
|
48 | 52 | }); |
49 | 53 | }, |
50 | 54 | }, |
| 55 | +mentions: { |
| 56 | +buildMentionRegexes(_cfg: unknown, agentId?: string) { |
| 57 | +const normalized = agentId?.trim(); |
| 58 | +return normalized ? [new RegExp(`\\b@?${escapeRegExp(normalized)}\\b`, "i")] : []; |
| 59 | +}, |
| 60 | +matchesMentionPatterns(text: string, mentionRegexes: RegExp[]) { |
| 61 | +return mentionRegexes.some((regex) => regex.test(text)); |
| 62 | +}, |
| 63 | +}, |
51 | 64 | reply: { |
52 | 65 | resolveEnvelopeFormatOptions() { |
53 | 66 | return {}; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。