fix(web): normalize structured thought rows

This commit is contained in:
Miguel Palhas
2026-09-06 22:21:19 +01:00
parent 0b1c9e15cf
commit 059316cbac
2 changed files with 13 additions and 7 deletions
+8 -3
View File
@@ -40,10 +40,15 @@ describe("buildTranscriptRow: user/agent/thought", () => {
expect(ps[0].innerHTML).toContain("<code>three</code>");
});
it("renders a thought row as plain text", () => {
const el = buildTranscriptRow(row("agent_thought", { content: { type: "text", text: "hmm" } }));
it("trims ACP framing whitespace and renders thought-row inline markdown", () => {
const el = buildTranscriptRow(
row("agent_thought", {
content: { type: "text", text: "\n\n**Planning comply tool commentary update**\n" },
}),
);
expect(el.className).toContain("st-row-thought");
expect(el.textContent).toBe("hmm");
expect(el.textContent).toBe("Planning comply tool commentary update");
expect(el.querySelector("strong")?.textContent).toBe("Planning comply tool commentary update");
});
it("falls back to a labelled placeholder for non-text content, never crashing", () => {