Show steering activity with a summary

This commit is contained in:
murashit 2026-06-06 22:48:14 +09:00
parent 1430990309
commit f70cae3df9
3 changed files with 44 additions and 3 deletions

View file

@ -3,7 +3,7 @@ import { isCompletedTurnOutcomeMessage } from "./turn-outcome-message";
import { pathRelativeToRoot } from "./paths";
import { executionState } from "./state";
const STEERING_ACTIVITY_LABEL = "user steered";
const STEERING_ACTIVITY_LABEL = "steer";
const STEERING_ACTIVITY_KIND = "userSteered";
export function displayBlocksForItems(
@ -78,7 +78,7 @@ function steeringActivityItem(item: DisplayItem, turnId: string): DisplayItem {
id: `steer-activity-${item.id}`,
kind: "tool",
role: "tool",
text: "",
text: item.text,
turnId,
...(item.itemId ? { itemId: item.itemId } : {}),
activityKind: STEERING_ACTIVITY_KIND,

View file

@ -1107,7 +1107,11 @@ describe("display block grouping keeps work logs subordinate to conversation mes
expect(blocks.map((block) => (block.type === "item" ? block.item.id : block.id))).toEqual(["u1", "u2", "turn-t1-activity", "a1"]);
expect(blocks[2]).toMatchObject({
summary: "Work details: steer, 2 commands",
items: [{ id: "c1" }, { id: "steer-activity-u2", text: "", activityKind: "userSteered", toolLabel: "user steered" }, { id: "c2" }],
items: [
{ id: "c1" },
{ id: "steer-activity-u2", text: "also check tests", activityKind: "userSteered", toolLabel: "steer" },
{ id: "c2" },
],
});
});

View file

@ -146,6 +146,43 @@ describe("work log renderer decisions", () => {
expect(element.textContent).toBe("user steered");
});
it("renders steering activity as a compact two-line tool summary", () => {
const block = messageStreamBlocks({
activeThreadId: "thread",
turnLifecycle: idleTurnLifecycle(),
historyCursor: null,
loadingHistory: false,
displayItems: [
{ id: "u1", kind: "message", messageKind: "user", role: "user", text: "do it", turnId: "turn" },
{
id: "u2",
kind: "message",
messageKind: "user",
role: "user",
text: "also check tests and keep the summary compact",
turnId: "turn",
},
{
id: "a1",
kind: "message",
role: "assistant",
text: "done",
messageKind: "assistantResponse",
messageState: "completed",
turnId: "turn",
},
],
openDetails: new Set(["turn:turn:activity"]),
loadOlderTurns: vi.fn(),
renderMarkdown: (parent, text) => parent.createDiv({ text }),
}).find((item) => item.key === "activity:turn-turn-activity");
const element = renderMessageBlockElement(expectPresent(block));
expect(element.querySelector(".codex-panel__tool-result-header")?.textContent).toBe("steer");
expect(element.querySelector(".codex-panel__tool-summary")?.textContent).toBe("also check tests and keep the summary compact");
});
it("renders path summary tools relative to the workspace root", () => {
const block = messageStreamBlocks({
activeThreadId: "thread",