Phase 9: track skill blocks on message_end for user messages — SPEC §6.2 #2.
Scan finalized user message text for expanded skill XML blocks and upsert tracked skills using registered metadata when available. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,6 +21,27 @@ function normalizePathForCompare(filePath: string): string {
|
||||
return normalize(filePath);
|
||||
}
|
||||
|
||||
/** Text from user message content (string or text blocks). */
|
||||
export function userMessageText(content: unknown): string {
|
||||
if (typeof content === "string") {
|
||||
return content;
|
||||
}
|
||||
if (!Array.isArray(content)) {
|
||||
return "";
|
||||
}
|
||||
const parts: string[] = [];
|
||||
for (const part of content) {
|
||||
if (!part || typeof part !== "object") {
|
||||
continue;
|
||||
}
|
||||
const block = part as { type?: string; text?: string };
|
||||
if (block.type === "text" && typeof block.text === "string") {
|
||||
parts.push(block.text);
|
||||
}
|
||||
}
|
||||
return parts.join("\n");
|
||||
}
|
||||
|
||||
/** Returns skill name when text is a slash skill command, else null. */
|
||||
export function detectSlashSkill(text: string): string | null {
|
||||
const match = SLASH_SKILL_RE.exec(text);
|
||||
|
||||
Reference in New Issue
Block a user