Skip to content

Commit 2e94a97

Browse files
committed
feat(agentic): overridable streaming/idle labels on ReasoningBlock (CL-8482)
1 parent d1b6342 commit 2e94a97

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎src/ui/reasoning-block.test.tsx‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ describe("ReasoningBlock", () => {
7070
idle.unmount();
7171
});
7272

73+
test("summary wording is overridable", () => {
74+
const streaming = mount({ text: "Going.", streaming: true, streamingLabel: "Working…" });
75+
expect(streaming.summary()?.textContent).toBe("Working…");
76+
streaming.unmount();
77+
78+
const idle = mount({ text: "Done.", idleLabel: "Reasoning" });
79+
expect(idle.summary()?.textContent).toBe("Reasoning");
80+
idle.unmount();
81+
});
82+
7383
test("streaming-to-idle on the same instance updates the summary and busy state", () => {
7484
const handle = mount({ text: "Reasoning.", streaming: true });
7585
expect(handle.summary()?.textContent).toBe("Thinking…");

‎src/ui/reasoning-block.tsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ export type ReasoningBlockProps = {
88
readonly text: string;
99
/** Still streaming. Changes the summary wording and marks the body busy. */
1010
readonly streaming?: boolean;
11+
/** Summary while streaming. Defaults to "Thinking…". */
12+
readonly streamingLabel?: string;
13+
/** Summary once idle when no `durationLabel` is supplied. Defaults to "Thinking". */
14+
readonly idleLabel?: string;
1115
/** e.g. "Thought for 4s". Becomes the summary once reasoning has stopped streaming. */
1216
readonly durationLabel?: string;
1317
readonly defaultOpen?: boolean;
@@ -37,6 +41,8 @@ export type ReasoningBlockProps = {
3741
export function ReasoningBlock({
3842
text,
3943
streaming = false,
44+
streamingLabel = "Thinking…",
45+
idleLabel = "Thinking",
4046
durationLabel,
4147
defaultOpen = false,
4248
open: openProp,
@@ -52,7 +58,7 @@ export function ReasoningBlock({
5258

5359
if (text.trim().length === 0) return null;
5460

55-
const summary = streaming ? "Thinking…" : (durationLabel ?? "Thinking");
61+
const summary = streaming ? streamingLabel : (durationLabel ?? idleLabel);
5662

5763
return (
5864
<details

0 commit comments

Comments
 (0)