fix: harden mcp channel bridge smoke

This commit is contained in:
Peter Steinberger
2026-03-28 04:10:00 +00:00
parent 9b405f88d4
commit ec5877346c
11 changed files with 970 additions and 29 deletions

View File

@@ -10,6 +10,14 @@ describe("shared/chat-message-content", () => {
).toBe("hello");
});
it("returns plain string content", () => {
expect(
extractFirstTextBlock({
content: "hello from string content",
}),
).toBe("hello from string content");
});
it("preserves empty-string text in the first block", () => {
expect(
extractFirstTextBlock({

View File

@@ -3,6 +3,9 @@ export function extractFirstTextBlock(message: unknown): string | undefined {
return undefined;
}
const content = (message as { content?: unknown }).content;
if (typeof content === "string") {
return content;
}
if (!Array.isArray(content) || content.length === 0) {
return undefined;
}