(text: string)
| 20529 | } |
| 20530 | |
| 20531 | function parseConversationPluginInvocation(text: string): ParsedConversationPluginInvocation | null { |
| 20532 | const raw = String(text ?? '').trim(); |
| 20533 | if (!raw) { |
| 20534 | return null; |
| 20535 | } |
| 20536 | const mentionMatch = raw.match(/^@([a-z0-9][a-z0-9_-]{0,31})\s+([\s\S]+)$/u); |
| 20537 | if (mentionMatch) { |
| 20538 | return { |
| 20539 | token: mentionMatch[1], |
| 20540 | taskText: mentionMatch[2].trim(), |
| 20541 | syntax: 'at_alias', |
| 20542 | }; |
| 20543 | } |
| 20544 | const zhMatch = raw.match(/^用\s*([a-z0-9][a-z0-9_-]{0,31})(?:\s+|[,::,]\s*)([\s\S]+)$/u); |
| 20545 | if (zhMatch) { |
| 20546 | return { |
| 20547 | token: zhMatch[1], |
| 20548 | taskText: zhMatch[2].trim(), |
| 20549 | syntax: 'zh_alias', |
| 20550 | }; |
| 20551 | } |
| 20552 | return null; |
| 20553 | } |
| 20554 | |
| 20555 | function normalizeNullableString(value: unknown): string | null { |
| 20556 | const normalized = typeof value === 'string' ? value.trim() : ''; |
no outgoing calls
no test coverage detected