MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / parseProjectMessageHeader

Function parseProjectMessageHeader

src/utils/project-message-header.ts:36–52  ·  view source on GitHub ↗
(
  text: string,
  sender: unknown,
)

Source from the content-addressed store, hash-verified

34 * own messages that merely start with a bracket.
35 */
36export 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}

Calls

no outgoing calls

Tested by

no test coverage detected