feat: display toggles, smart session resume, fix stale transcript pane (#8)

This commit was merged in pull request #8.
This commit is contained in:
2026-10-03 21:22:04 +00:00
parent ffe2c6b7ed
commit ee96f1ee61
8 changed files with 304 additions and 73 deletions
+39
View File
@@ -139,6 +139,45 @@ describe("buildThreadMarkdown", () => {
expect(markdown).toContain("`web_fetch` — failed");
});
it("omits tools and reasoning when the preferences are off", () => {
const messages = [
message({
role: "assistant",
text: "a",
thinking: "let me think",
toolCalls: [{ name: "web_search", arguments: {}, result: "ok", isError: false }],
}),
];
const hidden = buildThreadMarkdown(messages, { showToolCalls: false, showReasoning: false });
expect(hidden).not.toContain("Tools used");
expect(hidden).not.toContain("web_search");
expect(hidden).not.toContain("Reasoning");
expect(hidden).not.toContain("let me think");
// The answer itself must survive either way.
expect(hidden).toContain("a");
});
it("shows one section without the other", () => {
const messages = [
message({
role: "assistant",
text: "a",
thinking: "let me think",
toolCalls: [{ name: "web_search", arguments: {}, result: "ok", isError: false }],
}),
];
const toolsOnly = buildThreadMarkdown(messages, { showToolCalls: true, showReasoning: false });
expect(toolsOnly).toContain("Tools used");
expect(toolsOnly).not.toContain("Reasoning");
const reasoningOnly = buildThreadMarkdown(messages, { showToolCalls: false, showReasoning: true });
expect(reasoningOnly).not.toContain("Tools used");
expect(reasoningOnly).toContain("Reasoning");
});
it("only shows a reasoning section when there is reasoning", () => {
expect(buildThreadMarkdown([message({ role: "assistant", text: "a" })])).not.toContain("Reasoning");
expect(buildThreadMarkdown([message({ role: "assistant", text: "a", thinking: "hmm" })])).toContain(