refactor(agents): share text block extraction helper

This commit is contained in:
Peter Steinberger
2026-02-18 18:01:09 +00:00
parent 2d55cc446a
commit 85ebdf88b0
5 changed files with 42 additions and 41 deletions

View File

@@ -0,0 +1,16 @@
export function collectTextContentBlocks(content: unknown): string[] {
if (!Array.isArray(content)) {
return [];
}
const parts: string[] = [];
for (const block of content) {
if (!block || typeof block !== "object") {
continue;
}
const rec = block as { type?: unknown; text?: unknown };
if (rec.type === "text" && typeof rec.text === "string") {
parts.push(rec.text);
}
}
return parts;
}