fix(qa): include mention helpers in lab runtime · openclaw/openclaw@5e8d313
steipete
·
2026-04-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { |
| 2 | +buildMentionRegexes, |
| 3 | +implicitMentionKindWhen, |
| 4 | +matchesMentionPatterns, |
| 5 | +matchesMentionWithExplicit, |
| 6 | +resolveInboundMentionDecision, |
| 7 | +} from "openclaw/plugin-sdk/channel-inbound"; |
1 | 8 | import type { PluginRuntime } from "openclaw/plugin-sdk/runtime-store"; |
2 | 9 | |
3 | 10 | type SessionRecord = { |
4 | 11 | sessionKey: string; |
5 | 12 | body: string; |
6 | 13 | }; |
7 | 14 | |
8 | | -function escapeRegExp(value: string): string { |
9 | | -return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |
10 | | -} |
11 | | - |
12 | 15 | export function createQaRunnerRuntime(): PluginRuntime { |
13 | 16 | const sessions = new Map<string, SessionRecord>(); |
14 | 17 | return { |
@@ -53,13 +56,11 @@ export function createQaRunnerRuntime(): PluginRuntime {
|
53 | 56 | }, |
54 | 57 | }, |
55 | 58 | 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 | | -}, |
| 59 | + buildMentionRegexes, |
| 60 | + matchesMentionPatterns, |
| 61 | + matchesMentionWithExplicit, |
| 62 | + implicitMentionKindWhen, |
| 63 | + resolveInboundMentionDecision, |
63 | 64 | }, |
64 | 65 | reply: { |
65 | 66 | resolveEnvelopeFormatOptions() { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。