Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

feat(transcript): flatten edit rows and restore group hierarchy

v_wyxgwangc11f8ab6af0e
diff --git a/apps/desktop/src/components/ReviewChangeCard.tsx b/apps/desktop/src/components/ReviewChangeCard.tsx
index b0745adce..1276cd1c4 100644
--- a/apps/desktop/src/components/ReviewChangeCard.tsx
+++ b/apps/desktop/src/components/ReviewChangeCard.tsx
@@ -2,13 +2,15 @@ import { useChatSessionCapability } from "../hooks/use-chat-session-capability";
import { memo, useId, useState } from "react";
import { useTranslation } from "react-i18next";
import type {
+ ReviewChange,
ReviewChangeStatus,
UiMessage,
} from "@pi-desktop/shared";
import { reviewChangeFromMessage } from "../lib/workspace-review";
import { useAppStore } from "../stores/app-store";
+import { useCopy } from "./Markdown";
import { cx } from "./ui";
-import { IconCheck, IconChevronRight, IconSnapshot } from "./icons";
+import { IconCheck, IconChevronRight, IconCopy, IconSnapshot } from "./icons";
/* Git-status letters carry the status without relying on color alone; the
localized word stays in the row's accessible name. */
@@ -18,15 +20,31 @@ const STATUS_MARKS: Record<ReviewChangeStatus, string> = {
deleted: "D",
};
+function reviewDiffText(change: ReviewChange): string {
+ return change.hunks
+ .map((hunk) =>
+ [
+ hunk.header,
+ ...hunk.lines.map((line) =>
+ `${line.type === "add" ? "+" : line.type === "del" ? "-" : " "}${line.text}`,
+ ),
+ ].join("\n"),
+ )
+ .join("\n");
+}
+
function DiffBody({ message, compact }: { message: UiMessage; compact: boolean }) {
const { t } = useTranslation();
const change = reviewChangeFromMessage(message);
const localToolsAllowed = useChatSessionCapability("canUseLocalTools");
const rollback = useAppStore((state) => state.rollbackWorkspaceChange);
+ const { copied, copy } = useCopy();
const [rollingBack, setRollingBack] = useState(false);
if (!change) return null;
+ const diffText = reviewDiffText(change);
+
const runRollback = async () => {
if (!localToolsAllowed || !change.reversible || change.state === "rolledBack" || rollingBack) return;
setRollingBack(true);
@@ -87,6 +105,16 @@ function DiffBody({ message, compact }: { message: UiMessage; compact: boolean }
{t("panel.review.rollbackUnavailable")}
</span>
)}
+ <button
+ type="button"
+ className={cx("review-change-copy", copied && "copied")}
+ onClick={() => copy(diffText)}
+ disabled={!diffText}
+ title={t("chat.copy")}
+ >
+ {copied ? <IconCheck size={13} /> : <IconCopy size={13} />}
+ {copied ? t("chat.copied") : t("chat.copy")}
+ </button>
</div>
</div>
);
@@ -95,9 +123,12 @@ function DiffBody({ message, compact }: { message: UiMessage; compact: boolean }
export const ReviewChangeCard = memo(function ReviewChangeCard({
message,
compact = false,
+ asToolRow = false,
}: {
message: UiMessage;
compact?: boolean;
+ /** The card is the tool-level row: one file header and its diff body. */
+ asToolRow?: boolean;
}) {
const { t } = useTranslation();
const change = reviewChangeFromMessage(message);
@@ -122,9 +153,15 @@ export const ReviewChangeCard = memo(function ReviewChangeCard({
return (
<section
- className={cx("review-change-card", compact && "is-compact", open && "open")}
+ className={cx(
+ "review-change-card",
+ compact && "is-compact",
+ asToolRow && "is-tool-row",
+ open && "open",
+ )}
data-state={change.state}
data-status={change.status}
+ data-message-id={asToolRow ? message.id : undefined}
>
<button
type="button"
diff --git a/apps/desktop/src/components/workpanel/SubagentTranscriptTab.tsx b/apps/desktop/src/components/workpanel/SubagentTranscriptTab.tsx
index 174126956..1ae8d06e9 100644
--- a/apps/desktop/src/components/workpanel/SubagentTranscriptTab.tsx
+++ b/apps/desktop/src/components/workpanel/SubagentTranscriptTab.tsx
@@ -12,6 +12,7 @@ import { Textarea, TooltipButton } from "../ui";
import { DisclosureAnchorContext } from "../../lib/disclosure-anchor-context";
import { TranscriptDisclosureProvider } from "../../features/chat/transcript/disclosure";
import { buildSubagentTranscript } from "../../lib/subagent-transcript";
+import { reviewChangeFromMessage } from "../../lib/workspace-review";
import {
AssistantErrorMessage,
ThinkingRow,
@@ -152,10 +153,15 @@ function SubagentTranscriptSurface({ delegationId }: { delegationId: string }) {
</div>
{turn.rows.map((row) =>
row.kind === "tool" ? (
- <Fragment key={row.message.id}>
- <ToolRow message={row.message} />
- <ReviewChangeCard message={row.message} />
- </Fragment>
+ reviewChangeFromMessage(row.message) ? (
+ <ReviewChangeCard
+ key={row.message.id}
+ message={row.message}
+ asToolRow
+ />
+ ) : (
+ <ToolRow key={row.message.id} message={row.message} />
+ )
) : row.kind === "thinking" ? (
<ThinkingRow
key={`thinking-${row.message.id}`}
diff --git a/apps/desktop/src/features/chat/transcript/ActivityItems.tsx b/apps/desktop/src/features/chat/transcript/ActivityItems.tsx
index 72c9aa8e7..163f559f1 100644
--- a/apps/desktop/src/features/chat/transcript/ActivityItems.tsx
+++ b/apps/desktop/src/features/chat/transcript/ActivityItems.tsx
@@ -1,6 +1,7 @@
-import { Fragment, memo } from "react";
+import { memo } from "react";
import type { AssistantActivityItem } from "../../../lib/assistant-turns";
import { isDelegationActivityItem, type DelegationActivityItem, type SubagentOutcome, type SubagentTiming } from "../../../lib/subagent-topology";
+import { reviewChangeFromMessage } from "../../../lib/workspace-review";
import { ReviewChangeCard } from "../../../components/ReviewChangeCard";
import { ThinkingRow } from "./shared";
import { HostedSearchRow } from "./HostedSearchRow";
@@ -55,14 +56,25 @@ const ActivityItemBlock = memo(function ActivityItemBlock({
/>;
}
// A tool or hosted-search row always starts collapsed: only the user opens
- // a payload, never the row's position in the turn.
- if (item.kind === "tool") return (
- <Fragment key={item.message.id}>
- <ToolRow imagesInTurn message={item.message}
- onUserInteraction={onUserInteraction} {...(item.delegate ? { delegate: item.delegate } : {})} />
- <ReviewChangeCard message={item.message} />
- </Fragment>
- );
+ // a payload, never the row's position in the turn. A review-backed edit is
+ // already a complete tool-level row (file header + diff body), so rendering
+ // the generic tool row above it would repeat the file header.
+ if (item.kind === "tool") {
+ if (reviewChangeFromMessage(item.message)) {
+ return <ReviewChangeCard
+ key={item.message.id}
+ message={item.message}
+ asToolRow
+ />;
+ }
+ return <ToolRow
+ key={item.message.id}
+ imagesInTurn
+ message={item.message}
+ onUserInteraction={onUserInteraction}
+ {...(item.delegate ? { delegate: item.delegate } : {})}
+ />;
+ }
if (item.kind === "hostedSearch") return <HostedSearchRow
key={`hosted-search-${item.message.id}-${item.round.id}`}
messageId={item.message.id}
diff --git a/apps/desktop/src/features/chat/transcript/AssistantTurn.tsx b/apps/desktop/src/features/chat/transcript/AssistantTurn.tsx
index e12b8e119..c6d9bfe45 100644
--- a/apps/desktop/src/features/chat/transcript/AssistantTurn.tsx
+++ b/apps/desktop/src/features/chat/transcript/AssistantTurn.tsx
@@ -26,6 +26,7 @@ import {
import { sessionAllows } from "../../../lib/remote-session-safety";
import { resolveShowThinking } from "../../../lib/thinking-visibility";
import { resolveTranscriptDisplayMode } from "../../../lib/transcript-display-mode";
+import { reviewChangeFromMessage } from "../../../lib/workspace-review";
import { cachedVisibleProcessSteps } from "../../../lib/transcript-activity-summary";
import { useSlotSessionId } from "../../../plugins/renderer-slots/use-slots";
import { useAppStore } from "../../../stores/app-store";
@@ -248,10 +249,17 @@ const StandaloneRunRow = memo(function StandaloneRunRow({
}: {
segment: TurnProcessRunSegment;
}) {
+ // A review-backed edit is one tool-level row. It cannot become a run row
+ // today, but keeping the branch here prevents a future alias from rendering
+ // both the file header and the generic tool header.
+ const reviewed = reviewChangeFromMessage(segment.item.message) !== null;
return (
<div className="turn-run-row" data-run-row="true">
- <ToolRow imagesInTurn message={segment.item.message} />
- <ReviewChangeCard message={segment.item.message} />
+ {reviewed ? (
+ <ReviewChangeCard message={segment.item.message} asToolRow />
+ ) : (
+ <ToolRow imagesInTurn message={segment.item.message} />
+ )}
</div>
);
});
diff --git a/apps/desktop/src/features/chat/transcript/ToolRow.tsx b/apps/desktop/src/features/chat/transcript/ToolRow.tsx
index c764f9e5c..963106e8a 100644
--- a/apps/desktop/src/features/chat/transcript/ToolRow.tsx
+++ b/apps/desktop/src/features/chat/transcript/ToolRow.tsx
@@ -2,10 +2,10 @@ import { useChatSessionCapability } from "../../../hooks/use-chat-session-capabi
import { SubagentStopButton } from "./SubagentStopButton";
import { PlanHistoryCard } from "./PlanHistoryCard";
import { planSubmission } from "../../../lib/plan-history";
+import { reviewChangeFromMessage } from "../../../lib/workspace-review";
import { GeneratedImages } from "./GeneratedImages";
import "../../../styles/generated-images.css";
import {
- Fragment,
memo,
useCallback,
useEffect,
@@ -712,10 +712,15 @@ function SubagentRunFollow({
<div ref={contentRef}>
{items.map((item) =>
item.kind === "tool" ? (
- <Fragment key={item.message.id}>
- <ToolRow message={item.message} />
- <ReviewChangeCard message={item.message} />
- </Fragment>
+ reviewChangeFromMessage(item.message) ? (
+ <ReviewChangeCard
+ key={item.message.id}
+ message={item.message}
+ asToolRow
+ />
+ ) : (
+ <ToolRow key={item.message.id} message={item.message} />
+ )
) : item.kind === "thinking" ? (
<ThinkingRow
key={`thinking-${item.message.id}`}
diff --git a/apps/desktop/src/styles/messages.css b/apps/desktop/src/styles/messages.css
index 577795791..9dc23f946 100644
--- a/apps/desktop/src/styles/messages.css
+++ b/apps/desktop/src/styles/messages.css
@@ -807,6 +807,38 @@
margin: 0;
}
+/* In the transcript the review card is the tool row itself: it claims the full
+ band, drops the transcript inset, and puts the diff body directly beneath the
+ only header. Header order follows the file-ledger row: mark, path, counts,
+ caret. The panel keeps its existing caret-first order. */
+.review-change-card.is-tool-row {
+ width: 100%;
+ margin: 3px 0;
+}
+
+.review-change-card.is-tool-row .review-change-card-mark {
+ order: 0;
+}
+
+.review-change-card.is-tool-row .review-change-card-path {
+ order: 1;
+}
+
+.review-change-card.is-tool-row .review-change-card-counts {
+ order: 2;
+}
+
+.review-change-card.is-tool-row .review-change-card-caret {
+ order: 3;
+ /* This is now the row's only disclosure affordance, so it keeps the
+ tool-row caret's resting visibility instead of the old card's hidden one. */
+ opacity: 0.65;
+}
+
+.review-change-card.is-tool-row .review-change-card-body {
+ margin-left: 0;
+}
+
.review-change-card-header {
display: flex;
width: 100%;
@@ -935,7 +967,8 @@
padding-inline: 4px;
}
-.review-change-rollback {
+.review-change-rollback,
+.review-change-copy {
display: inline-flex;
align-items: center;
gap: 5px;
@@ -949,7 +982,8 @@
color var(--motion-duration-fast) var(--motion-ease-out);
}
-.review-change-rollback:hover:not(:disabled) {
+.review-change-rollback:hover:not(:disabled),
+.review-change-copy:hover:not(:disabled) {
background: var(--ds-bg-hover);
color: var(--ds-text-primary);
}
@@ -959,6 +993,15 @@
opacity: 0.65;
}
+.review-change-copy:disabled {
+ cursor: default;
+ opacity: 0.65;
+}
+
+.review-change-copy.copied {
+ color: var(--ds-success);
+}
+
.review-change-state {
display: inline-flex;
align-items: center;
@@ -2887,10 +2930,10 @@
outline-offset: -2px;
}
-/* These bodies carry no content indent, so each rail keeps its own gutter lane
- and stops at the header fill. The turn's control is the outer lane and the
- nested group's is the inner lane: expanding a group never puts two hit
- targets on the same pixels. Tool-row detail rails keep their tighter inset. */
+/* The turn body carries no content indent, so its rail keeps the outer lane.
+ A grouped body indents its child rows by 12px, and its rail sits in that
+ gutter; expanding a group never puts two hit targets on the same pixels.
+ Tool-row detail rails keep their tighter inset. */
.turn-process-body > .disclosure-collapse-rail {
left: -32px;
width: 14px;
@@ -2898,7 +2941,7 @@
}
.process-activity-body > .disclosure-collapse-rail {
- left: -18px;
+ left: -12px;
width: 14px;
min-width: 14px;
}
@@ -3429,10 +3472,10 @@
.turn-process-body {
position: relative;
- /* The turn's process and the levels it reveals share one left edge: a nested
- group header or a run row starts exactly where the turn header does, so the
- transcript reads as one column instead of an indenting staircase. Levels
- stay distinguishable by type size and colour, not by indentation. */
+ /* The turn's process and its group headers share one left edge. A nested
+ group restores the released v0.20.1 hierarchy below that header: its body
+ indents child rows by 12px and keeps the group's collapse rail in the
+ gutter, so the transcript never becomes an indenting staircase. */
padding-left: 0;
}
@@ -3453,8 +3496,8 @@
}
/* The turn's own title is the strongest level; a nested group is smaller and
- quieter, while leaf run rows keep tool-row secondary text. Indentation is
- not carrying this hierarchy. */
+ quieter, while leaf run rows keep tool-row secondary text. Its body adds the
+ released 12px indent below the group header. */
.process-activity-group > .tool-activity-header {
color: var(--ds-text-muted);
font-size: var(--text-sm);
@@ -3471,9 +3514,9 @@
.process-activity-group.grouped > .process-activity-body {
margin-block: 3px 6px;
- /* Same left edge as the turn header above it. The smaller type is what marks
- this as the nested level. */
- padding-inline-start: 0;
+ /* Child tool rows sit one 12px step inside the group header; the group's
+ collapse rail lives in that gutter. No further nesting level is added. */
+ padding-inline-start: 12px;
}
/* The nested process levels share the base header row: no level-specific
diff --git a/apps/desktop/test/chat-review-entry.test.mjs b/apps/desktop/test/chat-review-entry.test.mjs
index 4c62b00a7..0c325b322 100644
--- a/apps/desktop/test/chat-review-entry.test.mjs
+++ b/apps/desktop/test/chat-review-entry.test.mjs
@@ -1,11 +1,14 @@
import {
readStoreSource,
readStoreModule,
+ readTranscriptModule,
readTranscriptSource,
} from "./helpers/source-contracts.mjs";
import { readAppSource } from "./helpers/source-contracts.mjs";
+import { slotSsr } from "./helpers/slot-ssr.mjs";
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
+import { createElement } from "react";
import test from "node:test";
import {
reviewChangeFromMessage,
@@ -14,6 +17,7 @@ import {
} from "../src/lib/workspace-review.ts";
const transcriptSource = await readTranscriptSource();
+const activityItemsSource = await readTranscriptModule("ActivityItems.tsx");
const cardSource = await readFile(
new URL("../src/components/ReviewChangeCard.tsx", import.meta.url),
"utf8",
@@ -159,12 +163,29 @@ test("failed and scratch tool rows cannot manufacture review evidence", () => {
);
});
-test("chat renders one message-owned card immediately after its tool row", () => {
+test("a review-backed edit renders only the two-level review row", () => {
assert.equal(transcriptSource.includes("<WorkspaceChangesEntry />"), false);
assert.equal(transcriptSource.includes("review-changes-entry"), false);
+ // ActivityItems chooses exactly one row: the review card carries the file
+ // header for a recorded change, otherwise the generic tool row renders.
assert.match(
+ activityItemsSource,
+ /if \(reviewChangeFromMessage\(item\.message\)\) \{\s*return <ReviewChangeCard[\s\S]*?asToolRow\s*\/>;\s*\}/,
+ );
+ assert.match(activityItemsSource, /<ToolRow\s+key=\{item\.message\.id\}/);
+ assert.doesNotMatch(
+ activityItemsSource,
+ /<ReviewChangeCard message=\{item\.message\} \/>/,
+ );
+ // The standalone-run and delegate surfaces make the same choice, so no
+ // review-backed edit can render both the tool header and the file header.
+ assert.match(
+ transcriptSource,
+ /reviewChangeFromMessage\(segment\.item\.message\)[\s\S]*?asToolRow/,
+ );
+ assert.doesNotMatch(
transcriptSource,
- /<ToolRow message=\{item\.message\} \/>[\s\S]*<ReviewChangeCard message=\{item\.message\} \/>/,
+ /<ToolRow message=\{item\.message\} \/>[\s\S]*?<ReviewChangeCard message=\{item\.message\} \/>/,
);
assert.doesNotMatch(transcriptSource, /workspaceDiff|findWorkspaceChange/);
assert.match(cardSource, /aria-expanded=\{open\}/);
@@ -182,6 +203,28 @@ test("chat renders one message-owned card immediately after its tool row", () =>
assert.doesNotMatch(storeSource, /workspaceReviewSessions/);
});
+test("a review-backed edit renders one file header and no tool header", async (t) => {
+ const ssr = await slotSsr(t);
+ const { ActivityItems } = await ssr.load(
+ "/src/features/chat/transcript/ActivityItems.tsx",
+ );
+ const html = ssr.render(
+ createElement(ActivityItems, {
+ items: [{ kind: "tool", message: message() }],
+ isActive: false,
+ live: false,
+ delegateItems: [],
+ delegationStatuses: new Map(),
+ delegationTimings: new Map(),
+ onUserInteraction: () => {},
+ }),
+ { sessionId: null },
+ );
+ assert.equal(html.match(/review-change-card-header/g)?.length, 1);
+ assert.match(html, /class="review-change-card is-tool-row/);
+ assert.doesNotMatch(html, /tool-row-header/);
+});
+
test("rollback outcomes reach the toast instead of a second card row", () => {
// The store already reports both outcomes; the card only owns the action.
assert.match(
diff --git a/apps/desktop/test/transcript-style.test.mjs b/apps/desktop/test/transcript-style.test.mjs
index 595503058..3ddc58c30 100644
--- a/apps/desktop/test/transcript-style.test.mjs
+++ b/apps/desktop/test/transcript-style.test.mjs
@@ -129,11 +129,41 @@ test("tool details do not add a second visual indent", () => {
});
-test("the turn process and the levels it reveals share one left edge", () => {
+test("a review-backed edit is one tool-level row", () => {
+ // The card is the tool row in the transcript: full band, no 24px inset, and
+ // its diff body starts directly beneath the only header.
+ const toolRow = stylesSource.match(
+ /\.review-change-card\.is-tool-row \{([^}]*)\}/,
+ )?.[1];
+ assert.ok(toolRow);
+ assert.match(toolRow, /width:\s*100%;/);
+ assert.doesNotMatch(toolRow, /margin:[^;]*24px/);
+ const body = stylesSource.match(
+ /\.review-change-card\.is-tool-row \.review-change-card-body \{([^}]*)\}/,
+ )?.[1];
+ assert.ok(body);
+ assert.match(body, /margin-left:\s*0;/);
+ // Header order matches the file ledger: mark, path, counts, caret. The panel
+ // keeps its DOM order because these rules only apply to the tool-row variant.
+ const order = { mark: 0, path: 1, counts: 2, caret: 3 };
+ for (const [part, position] of Object.entries(order)) {
+ const rule = stylesSource.match(
+ new RegExp(`\\.review-change-card\\.is-tool-row \\.review-change-card-${part} \\{([^}]*)\\}`),
+ )?.[1];
+ assert.ok(rule, `expected an is-tool-row ${part} rule`);
+ assert.match(rule, new RegExp(`order:\\s*${position};`));
+ }
+ // Copy shares the rollback action rhythm in the diff body.
+ assert.match(
+ stylesSource,
+ /\.review-change-rollback,\s*\n\.review-change-copy \{/,
+ );
+});
+
+test("the turn process header and nested group headers share one left edge", () => {
// A nested group header sits on the same vertical line as the turn header that
- // reveals it. Indentation used to carry that hierarchy; it is now carried by
- // type size and colour, so a stray padding here would silently bring the
- // staircase back.
+ // reveals it. Its body restores the released v0.20.1 step: child rows move in
+ // by 12px so the group reads as one level below its own header.
const turnBody = stylesSource.match(/\.turn-process-body \{([^}]*)\}/)?.[1];
assert.ok(turnBody);
assert.match(turnBody, /padding-left:\s*0;/);
@@ -141,7 +171,7 @@ test("the turn process and the levels it reveals share one left edge", () => {
/\.process-activity-group\.grouped > \.process-activity-body \{([^}]*)\}/,
)?.[1];
assert.ok(groupedBody);
- assert.match(groupedBody, /padding-inline-start:\s*0;/);
+ assert.match(groupedBody, /padding-inline-start:\s*12px;/);
// Both disclosure headers use the tool-row inline geometry: content at the
// prose edge, fill four pixels into the gutter.
const activityHeader = stylesSource.match(/\n\.tool-activity-header \{([^}]*)\}/)?.[1];
@@ -166,7 +196,7 @@ test("nested process levels keep a subtle type and colour hierarchy", () => {
assert.match(runName, /font-size:\s*var\(--text-sm\);/);
});
-test("collapse rails keep separate zero-padding gutter lanes", () => {
+test("collapse rails keep separate gutter lanes", () => {
const turnRail = stylesSource.match(
/\.turn-process-body > \.disclosure-collapse-rail \{([^}]*)\}/,
)?.[1];
@@ -177,8 +207,19 @@ test("collapse rails keep separate zero-padding gutter lanes", () => {
/\.process-activity-body > \.disclosure-collapse-rail \{([^}]*)\}/,
)?.[1];
assert.ok(groupRail);
- assert.match(groupRail, /left:\s*-18px;/);
+ // The rail sits in the 12px gutter beside the indented child rows.
+ assert.match(groupRail, /left:\s*-12px;/);
assert.match(groupRail, /width:\s*14px;/);
+ // It stays invisible at rest; only hover or focus paints the 2px bar.
+ const railBase = stylesSource.match(
+ /\.disclosure-collapse-rail::before \{([^}]*)\}/,
+ )?.[1];
+ assert.ok(railBase);
+ assert.match(railBase, /background:\s*transparent;/);
+ assert.match(
+ stylesSource,
+ /\.disclosure-collapse-rail:hover::before,\s*\n\.disclosure-collapse-rail:focus-visible::before \{[\s\S]*?background:\s*var\(--ds-text-muted\);/,
+ );
const messageRow = stylesSource.match(/\.message-row \{([^}]*)\}/)?.[1];
assert.ok(messageRow);
assert.match(messageRow, /overflow-clip-margin:\s*34px;/);
diff --git a/docs/adr/0043-message-owned-review-snapshots-and-rollback.md b/docs/adr/0043-message-owned-review-snapshots-and-rollback.md
index 66b00d7bf..733f477d9 100644
--- a/docs/adr/0043-message-owned-review-snapshots-and-rollback.md
+++ b/docs/adr/0043-message-owned-review-snapshots-and-rollback.md
@@ -2,6 +2,7 @@
- Status: Accepted
- Date: 2026-08-02
+- Amended: 2026-10-22
- Related: [03-tools-and-permissions](../spec/03-runtime/03-tools-and-permissions.md) ·
[04-data-storage](../spec/03-runtime/04-data-storage.md) ·
[06-host-rpc-protocol](../spec/03-runtime/06-host-rpc-protocol.md) ·
@@ -31,10 +32,12 @@ that produced it rather than to a mutable repository snapshot.
record contains the snapshot id, message/tool id, relative path, operation,
added/modified/deleted status, addition/deletion counts, expandable hunks,
active/rolled-back state, and whether rollback is reversible.
-2. The renderer derives `InlineReviewCard` and the Review panel's chronological
+2. The renderer derives `ReviewChangeCard` and the Review panel's chronological
history from persisted tool messages only. It never refreshes or matches a
- current Git diff. A card stays immediately after its owning tool row and
- remains visible after commit, workspace switching, and restart.
+ current Git diff. In the transcript a review-backed `Write`/`Edit` renders as
+ one tool-level row: the file header and its diff body, with no second generic
+ tool header above it. It remains visible after commit, workspace switching,
+ and restart.
3. `review.rollback({sessionId, snapshotId})` is a host-owned operation. Before
writing, host-core verifies that the current file hash equals the post-tool
hash recorded in the snapshot. A mismatch returns `conflict` and leaves the
diff --git a/docs/adr/turn-process-and-thinking-display.md b/docs/adr/turn-process-and-thinking-display.md
index 01a8a399f..9619c84bd 100644
--- a/docs/adr/turn-process-and-thinking-display.md
+++ b/docs/adr/turn-process-and-thinking-display.md
@@ -83,9 +83,12 @@ name themselves; a live reasoning step reads `Thinking`, and momentary stages
read as plain running. Durations are dropped when the transcript recorded no
timing rather than shown as zero, and issue counts sit beside the label.
-The disclosure and the levels it reveals share one left edge. Hierarchy is
-carried by type size and colour, not by indentation, so a nested group header and
-a run row start exactly where the turn header does.
+The disclosure and its group headers share one left edge. A nested activity
+group keeps the released v0.20.1 hierarchy below that header: its body indents
+child rows by 12px, with the group's collapse rail in that gutter — invisible at
+rest, a 2px bar on hover or focus, collapsing the group when clicked. The outer
+turn fold adds no extra hierarchy, and a review-backed Write/Edit stays a single
+tool-level row whose only header is the file header above its diff body.
The thinking preference is a boolean `showThinking`. With it on, `flat` and
`command-first` expand every Thinking row by default and let the user collapse
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index 8827d9a6e..c0cabe228 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -790,7 +790,7 @@ reading surface of the workstation.
| MessageBubble (user/assistant) |
| ToolCallCard |
| TurnOutcomeCard (one Continue) |
-| InlineReviewCard · M App.tsx +8 −2 |
+| ReviewChangeCard · M App.tsx +8 −2 |
| PermissionCard |
| ... |
+--------------------------------------+
@@ -913,9 +913,11 @@ stages a reader can sit in front of (compaction, recovery) name themselves; a
live reasoning step reads `Thinking`, and momentary stages read as plain running.
Elapsed time is omitted when the
transcript recorded no timing rather than shown as zero, and issue counts sit
-beside the label. The disclosure and the levels it reveals share one left edge;
-hierarchy is carried by type size and colour, not by indentation, so a nested
-group header and a run row start exactly where the turn header does.
+beside the label. The disclosure and its group headers share one left edge; a
+nested activity group keeps the released v0.20.1 hierarchy below that header,
+indenting its child rows by 12px and keeping the group's collapse rail in that
+gutter. The rail stays invisible at rest, shows a 2px bar on hover or focus, and
+collapses the group when clicked. The outer turn fold adds no extra hierarchy.
Except for the display mode's Thinking default, no item payload opens itself: a
tool, hosted-search or plan call stays a header row until the user opens its
@@ -955,22 +957,24 @@ pending action cards remain reachable outside a hidden process. See
| Empty | Restrained hero + optional onboarding checklist in a scrollable content region, with a bottom-reserved home composer and no starter-card or contextual quick-action layer (D111/D204/D206). An open project underlines the project name, including before its first session exists; the control opens a searchable switcher of the sidebar's open projects, with clone-git-project and open-project actions. |
| Streaming | Auto-scroll follows while pinned; new tokens append |
| Active progress | Immediately after send, before the first assistant or tool event, a compact localized `Working…` status with elapsed time appears inline. Its model and subagent elapsed labels use the carried-unit format in §9.1. When the runtime names a quiet interval, that same row identifies starting, waiting for the model, preparing the next request, compacting context, recovering an empty response, retrying, or waiting for delegated work (with each running subagent's latest coarse action). It remains visible through thinking, tool execution, completed-tool gaps, and partial answers until the turn ends. Runtime phases take precedence over the Planning/Goal or Working fallback. Pending permissions, questions, and plan/goal approvals suppress the row; history reading never shows live status; no large generic progress card is rendered. The row lives in the reserved tail lane, so it appears and clears mid-turn without changing the transcript's content height. A retrying row remains compact at rest; hovering or focusing it reveals an error-styled tooltip with the localized error summary, stable code/HTTP status, and bounded provider message. The tooltip mixes the error tint over `--ds-bg-elevated-opaque` so transcript text does not show through. |
-| Turn outcome | After a failed turn, a session-scoped recovery card summarizes the interruption and tool evidence. Completed turns use the existing transcript and message-scoped InlineReviewCard without an extra success card; failed turns can continue through one localized prompt without losing the transcript. |
+| Turn outcome | After a failed turn, a session-scoped recovery card summarizes the interruption and tool evidence. Completed turns use the existing transcript and message-scoped review rows without an extra success card; failed turns can continue through one localized prompt without losing the transcript. |
| Session switch | A first-opened session paints at its latest record; a revisited pane paints at its own retained position. Bounded first commit and full-history expansion show the same position: no post-paint height correction may shift the visible rows, in either direction |
| Turn start (send / retry / regenerate) | Re-pins and positions the latest content before paint, even if the user had scrolled up; the later persisted user-message event does not flash the transcript at its top, and the composer collapse / indicator layout clamps during the send never release follow mode |
| Idle (after stream) | Auto-scroll unlocked; user can scroll freely |
-| Message-scoped review snapshot | Each successful workspace Write/Edit tool row is followed by one compact InlineReviewCard carrying that message's added/modified/deleted status and explicit addition/deletion totals. It renders as a single flat list row on the tool-row rhythm — disclosure caret, Git-style status letter (`A`/`M`/`D`), path, addition/deletion counts — with no card border, status rail, icon plate, or status pill; hover fill is the only row chrome, and a rolled-back change is struck through. Its hunks sit behind an expandable disclosure: every review card (inline and in the Review tab) is collapsed by default, and the user expands it on demand. The card remains after a Git commit, never becomes a bottom/global entry, and offers hash-guarded rollback without leaking into another session's transcript. |
+| Message-scoped review snapshot | Each successful workspace Write/Edit renders as one tool-level review row (`ReviewChangeCard`) carrying that message's added/modified/deleted status and explicit addition/deletion totals. The row itself is the file header — Git-style status letter (`A`/`M`/`D`), path, addition/deletion counts, disclosure caret — with no separate generic tool row above it, so the file header appears exactly once. It keeps the tool-row rhythm with no card border, status rail, icon plate, or status pill; hover fill is the only row chrome, and a rolled-back change is struck through. Its hunks sit in the diff body directly beneath that header behind the row's expandable disclosure: every review row (inline and in the Review tab) is collapsed by default, and the user expands it on demand. The diff body's action row keeps hash-guarded rollback and adds Copy for the hunks. The card remains after a Git commit, never becomes a bottom/global entry, and does not leak into another session's transcript. |
### 4.5 Accessibility
- `role="log"` for transcript container
- `aria-live="polite"` on transcript for new message announcements
- Scroll-to-bottom button appears when user scrolls up during stream
-- InlineReviewCard uses a native button with `aria-expanded` and
- `aria-controls`. Its localized accessible name includes the path, status,
- addition count, and deletion count — and the rolled-back state, which the row
- otherwise shows only as a strikethrough; the visible text and color are not
- the only status signal (the row carries a Git-style status letter).
+- The review row (`ReviewChangeCard`) uses a native button with
+ `aria-expanded` and `aria-controls` for its diff body; the group's left rail
+ stays a separate control that collapses the surrounding activity group. Its
+ localized accessible name includes the path, status, addition count, and
+ deletion count — and the rolled-back state, which the row otherwise shows only
+ as a strikethrough; the visible text and color are not the only status signal
+ (the row carries a Git-style status letter).
- Empty-home task entry starts in the always-visible bottom composer. There is
no starter-card or contextual quick-action layer between the hero and
composer.
@@ -1221,7 +1225,7 @@ entirely inside the plugin's isolated page:
Background artifacts may update that retained context but never reveal it,
resize the window, or change visible selection/focus. The transcript does
not create a global Review changes launcher: each successful workspace
- Write/Edit row owns only its adjacent InlineReviewCard, and another session
+ Write/Edit renders only its own tool-level review row, and another session
cannot render that card in its transcript. Repeated resources deduplicate
within the originating session.
- Review truth: host-core adds one bounded `details.review` record to each
diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.md
index 78bca6941..413560afa 100644
--- a/docs/spec/04-ux/09-interaction-patterns.md
+++ b/docs/spec/04-ux/09-interaction-patterns.md
@@ -584,11 +584,12 @@ may be retained while exactly one workspace supplies the visible shell context.
their retained context and never open, activate, resize, focus, or change the
visible panel.
- Each successful workspace Write/Edit tool result carries one durable review
- snapshot. Its compact InlineReviewCard is rendered in the same activity
- disclosure, immediately after its tool row; it is never moved to the
- transcript bottom and never shared with another session. Its status badge
- covers added, modified, and deleted changes, while counts and expandable
- hunks come from that message's result, not a current Git diff.
+ snapshot. Its compact review row is rendered in the same activity disclosure
+ as the tool row itself: one file header followed by its diff body, with no
+ second generic tool row. It is never moved to the transcript bottom and never
+ shared with another session. Its status mark covers added, modified, and
+ deleted changes, while counts and expandable hunks come from that message's
+ result, not a current Git diff.
- The transcript cards and Review consume the active session's persisted
message history. A commit, workspace focus change, or external Git state
change cannot remove or rewrite an old card. Review is a chronological
@@ -942,8 +943,9 @@ may be retained while exactly one workspace supplies the visible shell context.
precedence, names compaction and recovery while those stages are live, reads
`Thinking` while the live step is reasoning, omits the duration when the
transcript recorded none, and never echoes the current command or query. A
- nested group header and a run row share its left edge; hierarchy is carried by
- type size and colour rather than indentation.
+ nested group header shares its left edge; the group body then indents child
+ rows by 12px with the hover/focus collapse rail in that gutter, while a run
+ row lifted out of a group keeps the turn's left edge.
- No item payload opens itself, except the display mode's Thinking default: a
tool, hosted-search or plan call stays a header row until the user opens it,
including the literal final item of the last activity group. Group defaults are
diff --git a/docs/zh-CN/adr/turn-process-and-thinking-display.md b/docs/zh-CN/adr/turn-process-and-thinking-display.md
index a033c2aba..90efd34e8 100644
--- a/docs/zh-CN/adr/turn-process-and-thinking-display.md
+++ b/docs/zh-CN/adr/turn-process-and-thinking-display.md
@@ -59,8 +59,10 @@ v0.20.0 发布的布局。三种模式都只渲染一个外层披露。
命名;当前步骤为推理时显示 `Thinking`,瞬时阶段则显示为普通执行中。转录未记录时间时不显示
时长,而不是显示为零;问题计数与标签并列显示。
-披露与它展开的层级共用同一条左边缘。层级由字号与颜色表达,而不是缩进,因此嵌套的组标题与
-命令行起始位置与回合标题完全一致。
+披露与其组标题共用同一条左边缘。嵌套活动组沿用已发布的 v0.20.1 层级:组正文将子行缩进
+12px,组的折叠栏位于该沟槽中——静息时不可见,悬停或聚焦时显示 2px 竖条,点击即收起该组。
+外部回合折叠不会额外增加层级;由审核快照支撑的 Write/Edit 始终只有一层工具行,唯一标题
+就是文件标题,其下紧接 diff 正文。
思考偏好是一个布尔值 `showThinking`。开启时,`flat` 与 `command-first` 中的每个思考行
默认展开,用户可将其收起;展开时显示完整推理 Markdown,收起时只显示 Thinking 指示器,
diff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.md
index b23fd19d6..1f66f179e 100644
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@ -581,7 +581,7 @@ expanded/collapsed 侧边栏仍为 20px/18px 且启动画面为 64 像素。
| 消息气泡 (user/assistant) |
| 工具调用卡 |
| 回合结果卡(单一“继续”操作) |
-| InlineReviewCard · 修改 App.tsx +8 −2 |
+| ReviewChangeCard · 修改 App.tsx +8 −2 |
| 许可卡 |
| ... |
+--------------------------------------+
@@ -629,21 +629,21 @@ expanded/collapsed 侧边栏仍为 20px/18px 且启动画面为 64 像素。
| 空 | 可滚动内容区域中的受约束的英雄+可选的入门清单,带有底部保留的主页输入框,没有入门卡或上下文快速操作层(D111/D204/D206)。打开的项目会给项目名加下划线,即使该项目还没有任何会话;点击可打开侧边栏已打开项目的可搜索切换菜单,并带有克隆 Git 项目与打开项目操作。 |
| 流媒体 | 固定时自动滚动;追加新标记 |
| 积极进展 | 发送后,在第一个助手或工具事件之前,会内联显示一个紧凑的本地化 `Working…` 状态以及经过的时间。思考、工具执行、工具完成后的空档和部分回答都不会隐藏该行。具体运行时阶段优先于规划/目标或工作中提示;等待权限、提问或计划/目标批准时隐藏状态,历史阅读窗口不显示实时状态;不会渲染大型通用进度卡。重试行在静止时保持紧凑;悬停或聚焦会弹出错误色 tooltip,底板为 `--ds-bg-elevated-opaque`,避免透出记录正文。 |
-| 回合结果 | 回合失败后,会话范围的恢复卡会总结中断和工具证据。已完成的轮次使用现有的记录和消息范围的 InlineReviewCard,无需额外的成功卡;失败的回合可以重试而不会丢失转录本。 |
+| 回合结果 | 回合失败后,会话范围的恢复卡会总结中断和工具证据。已完成的轮次使用现有的记录和消息范围的审核行,无需额外的成功卡;失败的回合可以重试而不会丢失转录本。 |
| 会话切换 | 首次打开的会话在它最新的记录处绘制;重新访问的面板在它自己保留的位置处绘制。有界的首次提交与全量历史展开显示同一个位置:绘制之后的高度校正不得在任何方向上移动可见行 |
| 启动(发送/重试/重新生成) | 即使用户向上滚动,在绘制之前重新固定和定位最新内容;后来保留的用户消息事件不会在其顶部闪烁记录,并且发送期间的输入框折叠/指示器布局夹紧永远不会释放跟随模式 |
| 空闲(流后) | 自动滚动解锁;用户可以自由滚动 |
-| 消息范围的审核快照 | 每个成功的工作区 Write/Edit 工具行后面都有一个紧凑的 InlineReviewCard,其中包含该消息的 added/modified/deleted 状态和显式 addition/deletion 总计。它的大块头位于可扩展的披露后面:默认情况下,每个评论卡(内联和“评论”选项卡中)都是折叠的,用户可以根据需要展开它。该卡在 Git 提交后保留,永远不会成为 bottom/global 条目,并提供哈希保护的回滚,而不会泄漏到另一个会话的记录中。 |
+| 消息范围的审核快照 | 每个成功的工作区 Write/Edit 渲染为一条工具级审核行(`ReviewChangeCard`),其中包含该消息的 added/modified/deleted 状态和显式 addition/deletion 总计。该行本身就是文件标题——Git 风格状态字母(`A`/`M`/`D`)、路径、增删计数、披露 caret——上方不再渲染通用工具行,因此文件标题只出现一次。它沿用工具行的节奏,没有卡片边框、状态竖线、图标底板或状态药丸;悬停填充是唯一的行装饰,已回滚的更改显示删除线。hunks 位于标题正下方的 diff 正文中,由该行自身的披露控制:默认情况下,每条审核行(转录内与“审核”选项卡)都收起,用户按需展开。diff 正文的操作行保留哈希保护的回滚,并新增复制 hunks 的 Copy。该卡在 Git 提交后保留,永远不会成为 bottom/global 条目,也不会泄漏到另一个会话的转录中。 |
### 4.5 辅助功能
- `role="log"` 用于转录容器
- 新消息公告文字记录中的 `aria-live="polite"`
- 当用户在流媒体期间向上滚动时,会出现滚动到底部按钮
-- InlineReviewCard 使用带有 `aria-expanded` 的本机按钮和
- `aria-controls`。其本地化可访问名称包括路径、状态、
- 添加计数、删除计数;可见的文字和颜色不是
- 仅状态信号。
+- 审核行(`ReviewChangeCard`)使用带有 `aria-expanded` 的本机按钮和
+ `aria-controls` 控制其 diff 正文;组左侧的折叠栏仍是独立控件,用于收起所属活动组。
+ 其本地化可访问名称包括路径、状态、添加计数、删除计数,以及仅以删除线显示的已回滚
+ 状态;可见的文字和颜色不是仅有的状态信号(该行还带有 Git 风格状态字母)。
- 清空主页任务条目在始终可见的底部编辑器中启动。有
英雄和英雄之间没有入门卡或上下文快速行动层
输入框。
@@ -830,7 +830,7 @@ vendor 进来的 `pi.file-manager` 视图在插件自己的隔离页面内完成
背景工件可能会更新保留的上下文,但永远不会揭示它,
调整窗口大小,或更改可见的 selection/focus。抄本确实
不创建全局审核更改启动器:每个成功的工作区
- Write/Edit 行仅拥有其相邻的 InlineReviewCard,而另一个会话
+ Write/Edit 仅渲染自己的工具级审核行,而另一个会话
无法在其记录中呈现该卡。重复资源去重
在原始会话内。
- 回顾事实:host-core 为每个 `details.review` 添加一条有界 `details.review` 记录
@@ -1088,9 +1088,9 @@ SESSIONS [msg+][↕]
运行中、已完成:已记录的失败优先于停止,停止优先于正常完成,运行中的回合显示为执行中。
执行期间,用户可能长时间停留的阶段(压缩上下文、恢复)会各自命名;当前步骤为推理时显示
`Thinking`,瞬时阶段显示为普通执行中。转录未记录时间时不显示时长,而不是显示为零;问题
-计数与标签并列显示。披露与它
-展开的层级共用同一条左边缘;层级由字号与颜色表达,而不是缩进,因此嵌套组标题与命令行
-起始位置与回合标题完全一致。
+计数与标签并列显示。披露与其组标题共用同一条左边缘;嵌套活动组沿用已发布的 v0.20.1
+层级:组正文将子行缩进 12px,组的折叠栏位于该沟槽中。折叠栏静息时不可见,悬停或聚焦时
+显示 2px 竖条,点击即收起该组。外部回合折叠不会额外增加层级。
除显示模式的思考默认值外,条目载荷都不会自动展开:工具调用、托管搜索或计划卡片行在用户
打开其披露之前始终只是标题行,包括 Bash 行——其详情在用户打开之前保持收起。活动组保留各自的自动展开默认值,
diff --git a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md b/docs/zh-CN/spec/04-ux/09-interaction-patterns.md
index e448c9726..6adca77b9 100644
--- a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md
+++ b/docs/zh-CN/spec/04-ux/09-interaction-patterns.md
@@ -430,11 +430,10 @@
永远不会抢走用户正在阅读的面板。失败和临时写入同样如此。后台会话
事件仅更新其保留的上下文,并且从不打开、激活、调整大小、聚焦,
或更改可见面板。
-- 每个成功的工作区 Write/Edit 工具结果都会进行一次持久审查
- 快照。其紧凑的 InlineReviewCard 在同一个 Activity 中呈现
- 披露,紧随其工具行之后;它永远不会移动到
- 转录底部并且从未与其他会话共享。它的状态徽章
- 涵盖添加、修改和删除的更改,同时计数和可扩展
+- 每个成功的工作区 Write/Edit 工具结果都会携带一份持久审查快照。
+ 其紧凑审核行就是同一 Activity 披露中的工具行本身:一个文件标题加其
+ diff 正文,不再有第二个通用工具行;它永远不会移动到转录底部,也从不
+ 与其他会话共享。其状态标记涵盖添加、修改和删除的更改,计数与可展开
hunk 来自该消息的结果,而不是当前的 Git diff。
- 成绩单卡和复习会消耗活动会话的持续时间
消息历史记录。提交、工作区焦点更改或外部 Git 状态
@@ -716,8 +715,9 @@
的组。
- 回合标题按失败、停止、执行中、已完成的优先级显示 `Failed`、`Stopped`、`Running` 或
`Finished`;执行期间压缩上下文与恢复会各自命名,当前步骤为推理时显示 `Thinking`;
- 转录未记录时长时不显示时长;标题绝不回显当前命令或查询。嵌套组标题与命令行共用它的
- 左边缘,层级由字号和颜色而不是缩进表达。
+ 转录未记录时长时不显示时长;标题绝不回显当前命令或查询。嵌套组标题与它共用左边缘;
+ 组正文随后将子行缩进 12px,悬停/聚焦折叠栏位于该沟槽中,而被提升到组外的命令行保持
+ 回合的左边缘。
- 除显示模式的思考默认值外,条目载荷都不会自动展开:工具调用、托管搜索或计划卡片行在
用户打开之前始终只是标题行,包括最后一个活动组的字面最后一项。组的默认展开不变,因此
最后一项为思考时绝不会向前回扫。`Show thinking` 开启时,思考行在「平铺显示」与