( text: string, sender: unknown, )
| 34 | * own messages that merely start with a bracket. |
| 35 | */ |
| 36 | export function parseProjectMessageHeader( |
| 37 | text: string, |
| 38 | sender: unknown, |
| 39 | ): ProjectMessageHeader | null { |
| 40 | if (typeof sender !== "string" || !sender.startsWith("conversation:")) { |
| 41 | return null; |
| 42 | } |
| 43 | const match = HEADER.exec(text); |
| 44 | if (!match) return null; |
| 45 | const id = match[3] ? match[3].replace(/-/g, "").toLowerCase() : null; |
| 46 | return { |
| 47 | kind: KINDS[match[1]] ?? "sent_by", |
| 48 | title: (match[2] ?? match[4] ?? "").trim(), |
| 49 | conversationId: id?.length === 32 ? id : null, |
| 50 | body: text.slice(match[0].length), |
| 51 | }; |
| 52 | } |
no outgoing calls
no test coverage detected