Skip to content

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

feat(transcript): 支持思考过程多级折叠

deqiying1837c4ba7d9c
diff --git a/apps/desktop/src/components/SessionPane.tsx b/apps/desktop/src/components/SessionPane.tsx
index 246b82f8f..e70ad5f7f 100644
--- a/apps/desktop/src/components/SessionPane.tsx
+++ b/apps/desktop/src/components/SessionPane.tsx
@@ -4,6 +4,7 @@ import { useAppStore } from "../stores/app-store";
import { headPermission, sessionPermissions } from "../lib/pending-permissions";
import { headAsk } from "../lib/pending-asks";
import { useTranscriptView } from "../hooks/use-transcript-view";
+import { TranscriptDisclosureProvider } from "../features/chat/transcript/disclosure";
/**
* One retained conversation pane (ADR 0137).
@@ -41,9 +42,18 @@ export const SessionPane = memo(function SessionPane({
Boolean(headAsk(state.pendingAsks, sessionId)),
);
const planningState = useAppStore((state) => state.planningStates[sessionId]);
- const searchTarget = useMemo(() => transcript.focus && transcript.parentMessage
- ? { ...transcript.focus, messageId: transcript.parentMessage.id, query: "" }
- : transcript.focus, [transcript.focus, transcript.parentMessage]);
+ const searchTarget = useMemo(
+ () =>
+ transcript.focus && transcript.parentMessage
+ ? {
+ ...transcript.focus,
+ messageId: transcript.parentMessage.id,
+ query: "",
+ item: { kind: "tool" } as const,
+ }
+ : transcript.focus,
+ [transcript.focus, transcript.parentMessage],
+ );
return (
<div
@@ -56,24 +66,26 @@ export const SessionPane = memo(function SessionPane({
aria-hidden={visible ? undefined : true}
inert={visible ? undefined : true}
>
- <ChatTranscript
- sessionId={sessionId}
- messages={transcript.messages}
- hasMoreBefore={transcript.hasMoreBefore}
- onLoadOlder={() => loadTranscriptPage(sessionId, "before")}
- searchTarget={searchTarget}
- readingWindow={transcript.historical}
- hasMoreAfter={transcript.hasMoreAfter}
- onLoadNewer={() => loadTranscriptPage(sessionId, "after")}
- onReturnToLatest={() => returnToLatest(sessionId)}
- navigationLoading={transcript.loading}
- isRunning={isRunning}
- pendingPermission={transcript.historical ? undefined : pendingPermission}
- queuedPermissions={queuedPermissions}
- askPending={transcript.historical ? false : askPending}
- planningState={transcript.historical ? undefined : planningState}
- paneVisible={visible}
- />
+ <TranscriptDisclosureProvider>
+ <ChatTranscript
+ sessionId={sessionId}
+ messages={transcript.messages}
+ hasMoreBefore={transcript.hasMoreBefore}
+ onLoadOlder={() => loadTranscriptPage(sessionId, "before")}
+ searchTarget={searchTarget}
+ readingWindow={transcript.historical}
+ hasMoreAfter={transcript.hasMoreAfter}
+ onLoadNewer={() => loadTranscriptPage(sessionId, "after")}
+ onReturnToLatest={() => returnToLatest(sessionId)}
+ navigationLoading={transcript.loading}
+ isRunning={isRunning}
+ pendingPermission={transcript.historical ? undefined : pendingPermission}
+ queuedPermissions={queuedPermissions}
+ askPending={transcript.historical ? false : askPending}
+ planningState={transcript.historical ? undefined : planningState}
+ paneVisible={visible}
+ />
+ </TranscriptDisclosureProvider>
</div>
);
});
diff --git a/apps/desktop/src/components/workpanel/SubagentPanel.tsx b/apps/desktop/src/components/workpanel/SubagentPanel.tsx
index 8a13fdb71..8e69c5cee 100644
--- a/apps/desktop/src/components/workpanel/SubagentPanel.tsx
+++ b/apps/desktop/src/components/workpanel/SubagentPanel.tsx
@@ -22,6 +22,8 @@ import { useTranscriptView } from "../../hooks/use-transcript-view";
import { useTranscriptSearchFocus } from "../../hooks/use-transcript-search-focus";
import { IconArrowDown } from "../icons";
import { DisclosureAnchorContext } from "../../lib/disclosure-anchor-context";
+import { TranscriptSearchContext } from "../../lib/transcript-search-context";
+import { TranscriptDisclosureProvider } from "../../features/chat/transcript/disclosure";
import { TooltipButton } from "../ui";
import { SubagentDetail } from "../ChatTranscript";
@@ -33,24 +35,43 @@ type SelectedSubagent = {
function findSelectedSubagent(
messages: UiMessage[],
delegationId: string,
+ targetMessageId?: string,
): SelectedSubagent | null {
const { entries } = buildTranscriptEntries(messages);
+ let fallback: SelectedSubagent | null = null;
for (const entry of entries) {
if (entry.kind !== "assistant-turn") continue;
const turnActivityItems = entry.parts.flatMap((part) =>
part.kind === "activity" ? part.items : [],
);
- const item = turnActivityItems.find(
- (candidate): candidate is DelegationActivityItem =>
- isDelegationActivityItem(candidate) &&
- delegationIdForMessage(candidate.message) === delegationId,
- );
- if (item) return { item, turnActivityItems };
+ for (const candidate of turnActivityItems) {
+ if (!isDelegationActivityItem(candidate)) continue;
+ const selected = { item: candidate, turnActivityItems };
+ if (
+ targetMessageId &&
+ candidate.delegate?.items.some((row) => row.message.id === targetMessageId)
+ ) {
+ return selected;
+ }
+ if (delegationIdForMessage(candidate.message) === delegationId) {
+ // Resumed calls can reuse a delegation id; the latest card owns the
+ // merged run produced by buildTranscriptEntries.
+ fallback = selected;
+ }
+ }
}
- return null;
+ return fallback;
}
export function SubagentPanel({ selection }: { selection: SubagentPanelSelection }) {
+ return (
+ <TranscriptDisclosureProvider key={`${selection.sessionId}:${selection.delegationId}`}>
+ <SubagentPanelSurface selection={selection} />
+ </TranscriptDisclosureProvider>
+ );
+}
+
+function SubagentPanelSurface({ selection }: { selection: SubagentPanelSelection }) {
const { t } = useTranslation();
const activeSessionId = useAppStore((state) => state.activeSessionId);
const transcript = useTranscriptView(selection.sessionId);
@@ -60,8 +81,12 @@ export function SubagentPanel({ selection }: { selection: SubagentPanelSelection
(state) => state.runningSessions[selection.sessionId] ?? false,
);
const selected = useMemo(
- () => findSelectedSubagent(messages, selection.delegationId),
- [messages, selection.delegationId],
+ () => findSelectedSubagent(
+ messages,
+ selection.delegationId,
+ searchTarget?.messageId,
+ ),
+ [messages, searchTarget?.messageId, selection.delegationId],
);
const delegationStatuses = useMemo<ReadonlyMap<string, SubagentOutcome>>(
() =>
@@ -115,6 +140,7 @@ export function SubagentPanel({ selection }: { selection: SubagentPanelSelection
});
return (
+ <TranscriptSearchContext.Provider value={searchTarget}>
<DisclosureAnchorContext.Provider value={disclosureAnchorNotifier}>
<section
id="subagent-panel"
@@ -168,5 +194,6 @@ export function SubagentPanel({ selection }: { selection: SubagentPanelSelection
</span>
</section>
</DisclosureAnchorContext.Provider>
+ </TranscriptSearchContext.Provider>
);
}
diff --git a/apps/desktop/src/features/chat/transcript/ActivityGroup.tsx b/apps/desktop/src/features/chat/transcript/ActivityGroup.tsx
index dc77f76a2..7090d3a07 100644
--- a/apps/desktop/src/features/chat/transcript/ActivityGroup.tsx
+++ b/apps/desktop/src/features/chat/transcript/ActivityGroup.tsx
@@ -1,3 +1,6 @@
+import { visibleActivityItems } from "../../../lib/activity-summary";
+import { DisclosureScope, disclosureKey } from "./disclosure";
+import { ProcessActivityGroup } from "./ProcessActivityGroup";
import {
Fragment,
memo,
@@ -211,7 +214,7 @@ function activityGroupPropsEqual(
export const ActivityGroup = memo(function ActivityGroup({
items,
- embedded = false,
+ embedded: _embedded = false,
isActive,
endedAt,
isLast = false,
@@ -247,15 +250,18 @@ export const ActivityGroup = memo(function ActivityGroup({
const topologyLive = hasSubagentTopology && subagentSummary.running > 0;
const live = isActive || topologyLive;
const searchTarget = useContext(TranscriptSearchContext);
- const revealRequest = searchTarget && items.some((item) => item.message.id === searchTarget.messageId)
- ? searchTarget.requestId : undefined;
- const {
- open,
- toggle: toggleDisclosure,
- collapse: collapseDisclosure,
- claim: claimDisclosure,
- titleRef,
- } = useAutomaticDisclosure(live, revealRequest);
+ const revealRequest = searchTarget && items.some((item) =>
+ item.message.id === searchTarget.messageId ||
+ (item.kind === "tool" && item.delegate?.items.some((row) => row.message.id === searchTarget.messageId)),
+ ) ? searchTarget.requestId : undefined;
+ const visibleItems = visibleActivityItems(items, compact, isActive);
+ const first = items[0];
+ const disclosure = useAutomaticDisclosure(
+ hasSubagentTopology ? live : visibleItems.length <= 1 || (!compact && live),
+ revealRequest,
+ disclosureKey("activity", first?.message.id ?? "", first?.kind ?? "", first?.kind === "hostedSearch" ? first.round.id : ""),
+ );
+ const { open, toggle: toggleDisclosure, collapse: collapseDisclosure, claim: claimDisclosure, titleRef } = disclosure;
const [now, setNow] = useState(Date.now);
const [finishedAt, setFinishedAt] = useState<number | null>(null);
const wasActiveRef = useRef(live);
@@ -368,6 +374,7 @@ export const ActivityGroup = memo(function ActivityGroup({
return (
<HostedSearchRow
key={`hosted-search-${item.message.id}-${item.round.id}`}
+ messageId={item.message.id}
round={item.round}
streaming={isActive && item.message.status === "streaming"}
autoOpen={autoOpenLatest}
@@ -387,9 +394,12 @@ export const ActivityGroup = memo(function ActivityGroup({
});
};
- if (compact && onlyThinking && !thinkingNow) return null;
- if (embedded && !hasSubagentTopology) {
- return <div className="turn-process-activity">{renderActivityItems()}</div>;
+ if (!hasSubagentTopology) {
+ return (
+ <ProcessActivityGroup items={visibleItems} active={isActive} disclosure={disclosure}>
+ {renderActivityItems()}
+ </ProcessActivityGroup>
+ );
}
return (
@@ -443,6 +453,8 @@ export const ActivityGroup = memo(function ActivityGroup({
</div>
) : null}
<div
+ ref={disclosure.bodyRef}
+ {...disclosure.bodyEvents}
className="tool-activity-collapse"
aria-hidden={!open}
inert={!open}
@@ -450,10 +462,10 @@ export const ActivityGroup = memo(function ActivityGroup({
<div className="tool-activity-collapse-inner">
<div className="tool-activity-body" id={detailsId}>
<DisclosureCollapseRail
- label={t("chat.collapseDetails")}
+ label={t("chat.collapseActivityGroup")}
onCollapse={collapseDisclosure}
/>
- {renderActivityItems()}
+ <DisclosureScope disclosure={disclosure}>{renderActivityItems()}</DisclosureScope>
</div>
</div>
</div>
diff --git a/apps/desktop/src/features/chat/transcript/AssistantTurn.tsx b/apps/desktop/src/features/chat/transcript/AssistantTurn.tsx
index 23e77180e..bc34dccf4 100644
--- a/apps/desktop/src/features/chat/transcript/AssistantTurn.tsx
+++ b/apps/desktop/src/features/chat/transcript/AssistantTurn.tsx
@@ -1,3 +1,4 @@
+import { transcriptItemKey } from "../../../lib/transcript-search-context";
import {
memo,
useMemo,
@@ -328,7 +329,7 @@ export const AssistantTurn = memo(function AssistantTurn({
part.kind === "activity" ? (
<ActivityGroup
embedded
- key={`activity-${part.items[0].message.id}`}
+ key={`activity-${part.items[0].message.id}-${part.items[0].kind}${part.items[0].kind === "hostedSearch" ? `-${part.items[0].round.id}` : ""}`}
items={part.items}
endedAt={part.endedAt}
isActive={part === activePart}
@@ -345,6 +346,7 @@ export const AssistantTurn = memo(function AssistantTurn({
: ""
}`}
data-message-id={part.message.id}
+ data-transcript-item={transcriptItemKey(part.message.id, "message")}
key={part.message.id}
>
{part.message.content ? (
@@ -370,7 +372,7 @@ export const AssistantTurn = memo(function AssistantTurn({
<div className="message-col">
{groupProcess ? (
<>
- <TurnProcess processParts={process} turnParts={entry.parts} isActive={isActive}>
+ <TurnProcess turnId={entry.id} processParts={process} turnParts={entry.parts} isActive={isActive} delegationStatuses={turnDelegationStatuses}>
{process.map(renderPart)}
</TurnProcess>
{responses.map(renderPart)}
diff --git a/apps/desktop/src/features/chat/transcript/HostedSearchRow.tsx b/apps/desktop/src/features/chat/transcript/HostedSearchRow.tsx
index 6e0080774..347a94444 100644
--- a/apps/desktop/src/features/chat/transcript/HostedSearchRow.tsx
+++ b/apps/desktop/src/features/chat/transcript/HostedSearchRow.tsx
@@ -7,6 +7,8 @@ import {
IconGlobe,
} from "../../../components/icons";
import { DisclosureCollapseRail, useAutomaticDisclosure } from "./shared";
+import { disclosureKey } from "./disclosure";
+import { transcriptItemKey, useItemReveal } from "../../../lib/transcript-search-context";
/**
* One provider-hosted web search round, rendered on the same tool-row idiom
@@ -27,11 +29,13 @@ function sourceHost(url: string): string {
}
export const HostedSearchRow = memo(function HostedSearchRow({
+ messageId,
round,
streaming,
autoOpen = false,
onUserInteraction,
}: {
+ messageId: string;
round: HostedSearchRound;
streaming: boolean;
autoOpen?: boolean;
@@ -41,7 +45,8 @@ export const HostedSearchRow = memo(function HostedSearchRow({
const detailsId = useId();
const searching = streaming && round.status === "searching";
const failed = round.status === "failed";
- const disclosure = useAutomaticDisclosure(autoOpen && !failed);
+ const revealRequest = useItemReveal(messageId, "hostedSearch", round.id);
+ const disclosure = useAutomaticDisclosure(autoOpen && !failed, revealRequest, disclosureKey("hostedSearch", messageId, round.id));
const { open, toggle: toggleDisclosure, collapse: collapseDisclosure } = disclosure;
const titleRef = disclosure.titleRef;
const toggleRow = useCallback(() => {
@@ -80,7 +85,7 @@ export const HostedSearchRow = memo(function HostedSearchRow({
: t("chat.webSearch");
return (
- <div className={`tool-row hosted-search ${open ? "open" : ""}`}>
+ <div className={`tool-row hosted-search ${open ? "open" : ""}`} data-transcript-item={transcriptItemKey(messageId, "hostedSearch", round.id)}>
<button
ref={titleRef}
className="tool-row-header"
@@ -105,7 +110,7 @@ export const HostedSearchRow = memo(function HostedSearchRow({
) : null}
</button>
{open && expandable ? (
- <div className="tool-row-body" id={detailsId}>
+ <div className="tool-row-body" id={detailsId} ref={disclosure.bodyRef} {...disclosure.bodyEvents}>
<DisclosureCollapseRail
label={t("chat.collapseDetails")}
onCollapse={collapseRow}
@@ -142,6 +147,7 @@ export const HostedSearchRow = memo(function HostedSearchRow({
</div>
);
}, (previous, next) =>
+ previous.messageId === next.messageId &&
previous.round === next.round &&
previous.streaming === next.streaming &&
previous.autoOpen === next.autoOpen &&
diff --git a/apps/desktop/src/features/chat/transcript/MessageRow.tsx b/apps/desktop/src/features/chat/transcript/MessageRow.tsx
index 82fc0f9d6..3fc03821d 100644
--- a/apps/desktop/src/features/chat/transcript/MessageRow.tsx
+++ b/apps/desktop/src/features/chat/transcript/MessageRow.tsx
@@ -8,6 +8,7 @@ import { useTranslation } from "react-i18next";
import type { UiMessage } from "@pi-desktop/shared";
import { useOpenChatFileRef } from "../../../hooks/use-preview-target";
import { splitChatText } from "../../../lib/chat-links";
+import { transcriptItemKey } from "../../../lib/transcript-search-context";
import { useAppStore } from "../../../stores/app-store";
import { Markdown } from "../../../components/Markdown";
import {
@@ -123,6 +124,7 @@ export const MessageRow = memo(function MessageRow({
className={`message-row ${isSessionMessage ? "session-message" : isUser ? "user" : message.role}`}
data-minimap-id={message.id}
data-message-id={message.id}
+ data-transcript-item={transcriptItemKey(message.id, "message")}
data-row-role={isSessionMessage ? undefined : "user"}
onContextMenu={onContextMenu}
role="article"
diff --git a/apps/desktop/src/features/chat/transcript/ProcessActivityGroup.tsx b/apps/desktop/src/features/chat/transcript/ProcessActivityGroup.tsx
new file mode 100644
index 000000000..36615c302
--- /dev/null
+++ b/apps/desktop/src/features/chat/transcript/ProcessActivityGroup.tsx
@@ -0,0 +1,68 @@
+import { useId, type ReactNode } from "react";
+import { useTranslation } from "react-i18next";
+import type { AssistantActivityItem } from "../../../lib/assistant-turns";
+import { activitySummary } from "../../../lib/activity-summary";
+import { IconChevronRight, IconCircleAlert, IconSparkles } from "../../../components/icons";
+import { DisclosureCollapseRail } from "./shared";
+import { DisclosureScope, type useAutomaticDisclosure } from "./disclosure";
+
+/** Keep the body identity stable when a singleton grows into a group. */
+export function ProcessActivityGroup({
+ items,
+ active,
+ disclosure,
+ children,
+}: {
+ items: readonly AssistantActivityItem[];
+ active: boolean;
+ disclosure: ReturnType<typeof useAutomaticDisclosure>;
+ children: ReactNode;
+}) {
+ const { t } = useTranslation();
+ const detailsId = useId();
+ const grouped = items.length > 1;
+ const open = !grouped || disclosure.open;
+ const summary = activitySummary(items);
+ if (items.length === 0) return null;
+ return (
+ <div className={`process-activity-group${grouped ? " grouped" : " singleton"}${open ? " open" : ""}`}>
+ {grouped ? (
+ <button
+ type="button"
+ className="tool-activity-header"
+ ref={disclosure.titleRef}
+ aria-expanded={open}
+ aria-controls={detailsId}
+ onClick={disclosure.toggle}
+ >
+ <span className="tool-activity-icon" aria-hidden><IconSparkles size={14} /></span>
+ <span className={`tool-activity-label${active ? " running" : ""}`}>
+ {t(summary.label, { count: summary.count })}
+ </span>
+ {summary.thinking > 0 && summary.tools > 0 ? (
+ <span className="tool-activity-count">{t("chat.activityIncludesThinking")}</span>
+ ) : null}
+ {active ? <span className="tool-activity-count">{t("chat.running")}</span> : null}
+ {summary.issues > 0 ? (
+ <span className="turn-process-error">
+ <IconCircleAlert size={14} aria-hidden />
+ {t("chat.activityFailures", { count: summary.issues })}
+ </span>
+ ) : null}
+ <span className="tool-activity-caret" aria-hidden><IconChevronRight size={12} /></span>
+ </button>
+ ) : null}
+ <div
+ id={detailsId}
+ ref={disclosure.bodyRef}
+ className="process-activity-body"
+ hidden={!open}
+ inert={!open}
+ {...disclosure.bodyEvents}
+ >
+ {grouped ? <DisclosureCollapseRail label={t("chat.collapseActivityGroup")} onCollapse={disclosure.collapse} /> : null}
+ <DisclosureScope disclosure={disclosure} open={open}>{children}</DisclosureScope>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/desktop/src/features/chat/transcript/ToolRow.tsx b/apps/desktop/src/features/chat/transcript/ToolRow.tsx
index 2657777d5..91b595023 100644
--- a/apps/desktop/src/features/chat/transcript/ToolRow.tsx
+++ b/apps/desktop/src/features/chat/transcript/ToolRow.tsx
@@ -5,6 +5,7 @@ import {
useEffect,
useId,
useLayoutEffect,
+ useRef,
useState,
} from "react";
import { useTranslation } from "react-i18next";
@@ -12,6 +13,8 @@ import type { UiMessage } from "@pi-desktop/shared";
import { useOpenPreviewTarget } from "../../../hooks/use-preview-target";
import { useFollowScroll } from "../../../hooks/use-follow-scroll";
import { getToolPreviewTarget } from "../../../lib/chat-links";
+import { disclosureKey } from "./disclosure";
+import { transcriptItemKey, useItemReveal } from "../../../lib/transcript-search-context";
import {
formatToolDuration,
getToolAction,
@@ -157,8 +160,11 @@ export const ToolRow = memo(function ToolRow({
// Detailed mode opens the last tool of the last activity group. Compact keeps
// payloads collapsed so a live burst only updates the header. Failure and
// denial stay in the row head without expanding the payload automatically.
+ const revealRequest = useItemReveal(message.id, "tool");
const disclosure = useAutomaticDisclosure(
autoOpen && !failed && status !== "denied",
+ revealRequest,
+ disclosureKey("tool", message.id),
);
const { open, toggle: toggleDisclosure, collapse: collapseDisclosure } = disclosure;
const titleRef = disclosure.titleRef;
@@ -208,15 +214,25 @@ export const ToolRow = memo(function ToolRow({
// The delegate's last answer row is its report, so the body must not print
// the same text a second time.
const nestedReport = delegate?.items.some((item) => item.kind === "answer");
- // Streaming updates replace the message object each tick; only pay the
- // full payload walk once the row is actually expanded.
- const blocks =
- variant !== "topology" && open && hasDetails
- ? buildToolPresentation(message, {
- hideSummaryArg: true,
- ...(nestedReport ? { hideDelegateReport: true } : {}),
- })
- : null;
+ // Keep mounted output and its reading position while an ancestor is folded,
+ // but defer formatting hidden streaming updates until it becomes visible.
+ const presentation = useRef<{
+ message: UiMessage;
+ nestedReport: boolean | undefined;
+ blocks: ReturnType<typeof buildToolPresentation>;
+ } | null>(null);
+ if (variant !== "topology" && open && hasDetails && disclosure.parentVisible &&
+ (presentation.current?.message !== message || presentation.current?.nestedReport !== nestedReport)) {
+ presentation.current = {
+ message,
+ nestedReport,
+ blocks: buildToolPresentation(message, {
+ hideSummaryArg: true,
+ ...(nestedReport ? { hideDelegateReport: true } : {}),
+ }),
+ };
+ }
+ const blocks = variant !== "topology" && open && hasDetails ? presentation.current?.blocks : null;
const outcome =
variant === "topology" ? subagentOutcome(message, delegationStatuses) : null;
// A bare `running` Task row (no delegation result yet) is still being
@@ -322,6 +338,7 @@ export const ToolRow = memo(function ToolRow({
} status-${run === "failed" ? "error" : status || "success"}${outcome ? ` outcome-${outcome.replaceAll("_", "-")}` : ""}${creating ? " outcome-creating" : ""}`}
role={variant === "topology" ? "listitem" : "region"}
data-message-id={message.id}
+ data-transcript-item={transcriptItemKey(message.id, "tool")}
aria-label={`${t("chat.toolCall")}: ${rawName}${agentName ? `, ${agentName}` : ""}${modelLabel ? `, ${modelLabel}` : ""}${statusLabel ? `, ${statusLabel}` : ""}`}
>
{variant === "topology" ? (
@@ -498,9 +515,9 @@ export const ToolRow = memo(function ToolRow({
</span>
) : null}
{blocks && blocks.length > 0 ? (
- <div className="tool-row-body" id={detailsId}>
+ <div className="tool-row-body" id={detailsId} ref={disclosure.bodyRef} {...disclosure.bodyEvents}>
<DisclosureCollapseRail
- label={t("chat.collapseDetails")}
+ label={t("chat.collapseToolOutput")}
onCollapse={collapseRow}
/>
<ToolDetailBlocks blocks={blocks} plain={runHead} />
diff --git a/apps/desktop/src/features/chat/transcript/TurnProcess.tsx b/apps/desktop/src/features/chat/transcript/TurnProcess.tsx
index 360e5c0bb..7721d7a72 100644
--- a/apps/desktop/src/features/chat/transcript/TurnProcess.tsx
+++ b/apps/desktop/src/features/chat/transcript/TurnProcess.tsx
@@ -1,10 +1,11 @@
+import type { SubagentOutcome } from "../../../lib/subagent-topology";
import { useContext, useEffect, useId, useState, type ReactNode } from "react";
import { useTranslation } from "react-i18next";
import type { AssistantTurnPart } from "../../../lib/assistant-turns";
import { formatToolDuration } from "../../../lib/tool-display";
+import { activitySummary } from "../../../lib/activity-summary";
import { TranscriptSearchContext } from "../../../lib/transcript-search-context";
import {
- hasFailedProcessTool,
isTurnThinking,
processContainsMessage,
resolveThinkingDisplayMode,
@@ -18,33 +19,35 @@ import {
IconCircleAlert,
IconSparkles,
} from "../../../components/icons";
-import { DisclosureCollapseRail, useAutomaticDisclosure } from "./shared";
+import { DisclosureCollapseRail } from "./shared";
+import { DisclosureScope, disclosureKey, useAutomaticDisclosure } from "./disclosure";
export function TurnProcess({
+ turnId,
processParts,
turnParts,
+ delegationStatuses,
isActive,
children,
}: {
+ turnId: string;
processParts: readonly AssistantTurnPart[];
turnParts: readonly AssistantTurnPart[];
isActive: boolean;
+ delegationStatuses?: ReadonlyMap<string, SubagentOutcome>;
children: ReactNode;
}) {
const { t } = useTranslation();
- const mode = useAppStore((state) =>
- resolveThinkingDisplayMode(state.settings?.thinkingDisplayMode),
- );
+ const mode = useAppStore((state) => resolveThinkingDisplayMode(state.settings?.thinkingDisplayMode));
const search = useContext(TranscriptSearchContext);
- const revealRequest =
- search && processContainsMessage(processParts, search.messageId)
- ? search.requestId
- : undefined;
- const hasToolFailure = hasFailedProcessTool(processParts);
+ const revealRequest = search && processContainsMessage(processParts, search.messageId)
+ ? search.requestId : undefined;
+ const summary = activitySummary(processParts.flatMap((part) => part.kind === "activity" ? part.items : []), delegationStatuses);
const thinkingNow = isTurnThinking(turnParts, isActive);
const disclosure = useAutomaticDisclosure(
- shouldAutoOpenTurnProcess(mode, isActive, hasToolFailure),
+ shouldAutoOpenTurnProcess(mode, isActive, summary.issues > 0),
revealRequest,
+ disclosureKey("turn", turnId),
);
const detailsId = useId();
const [now, setNow] = useState(Date.now);
@@ -55,19 +58,12 @@ export function TurnProcess({
const timer = window.setInterval(() => setNow(Date.now()), 1000);
return () => window.clearInterval(timer);
}, [isActive]);
- const count = visibleProcessSteps(processParts, mode, isActive);
- if (count === 0) return null;
- const seconds =
- startedAt === undefined
- ? 0
- : Math.max(
- 0,
- Math.floor(((isActive ? now : (endedAt ?? startedAt)) - startedAt) / 1000),
- );
+ if (visibleProcessSteps(processParts, mode, isActive) === 0) return null;
+ const seconds = startedAt === undefined ? 0 : Math.max(
+ 0, Math.floor(((isActive ? now : (endedAt ?? startedAt)) - startedAt) / 1000),
+ );
return (
- <section
- className={`turn-process${disclosure.open ? " open" : ""}${isActive ? " active" : ""}`}
- >
+ <section className={`turn-process${disclosure.open ? " open" : ""}${isActive ? " active" : ""}`}>
<button
type="button"
ref={disclosure.titleRef}
@@ -76,43 +72,33 @@ export function TurnProcess({
aria-controls={detailsId}
onClick={disclosure.toggle}
>
- <span className="tool-activity-icon" aria-hidden>
- <IconSparkles size={14} />
- </span>
+ <span className="tool-activity-icon" aria-hidden><IconSparkles size={14} /></span>
<span className={`tool-activity-label${isActive ? " running" : ""}`}>
- {t(
- isActive
- ? thinkingNow
- ? "chat.thinkingFor"
- : "chat.processingFor"
- : "chat.processedFor",
- { time: formatToolDuration(seconds) },
- )}
+ {t(isActive ? thinkingNow ? "chat.thinkingFor" : "chat.processingFor" : "chat.processedFor", {
+ time: formatToolDuration(seconds),
+ })}
</span>
- {hasToolFailure ? (
- <span className="turn-process-error" title={t("chat.toolFailed")}>
- <IconCircleAlert size={14} aria-label={t("chat.toolFailed")} />
+ {summary.issues > 0 ? (
+ <span className="turn-process-error">
+ <IconCircleAlert size={14} aria-hidden />
+ {t("chat.activityFailures", { count: summary.issues })}
</span>
) : null}
- <span className="tool-activity-count">
- {t("chat.processingSteps", { count })}
- </span>
- <span className="tool-activity-caret" aria-hidden>
- <IconChevronRight size={12} />
- </span>
+ {summary.tools > 0 ? (
+ <span className="tool-activity-count">{t("chat.processTools", { count: summary.tools })}</span>
+ ) : null}
+ <span className="tool-activity-caret" aria-hidden><IconChevronRight size={12} /></span>
</button>
<div
+ ref={disclosure.bodyRef}
id={detailsId}
className="turn-process-body"
hidden={!disclosure.open}
inert={!disclosure.open}
- onClickCapture={disclosure.claim}
+ {...disclosure.bodyEvents}
>
- <DisclosureCollapseRail
- label={t("chat.collapseDetails")}
- onCollapse={disclosure.collapse}
- />
- {children}
+ <DisclosureCollapseRail label={t("chat.collapseProcess")} onCollapse={disclosure.collapse} />
+ <DisclosureScope disclosure={disclosure}>{children}</DisclosureScope>
</div>
</section>
);
diff --git a/apps/desktop/src/features/chat/transcript/disclosure.tsx b/apps/desktop/src/features/chat/transcript/disclosure.tsx
new file mode 100644
index 000000000..0fecc532e
--- /dev/null
+++ b/apps/desktop/src/features/chat/transcript/disclosure.tsx
@@ -0,0 +1,148 @@
+import {
+ createContext,
+ useCallback,
+ useContext,
+ useId,
+ useLayoutEffect,
+ useMemo,
+ useRef,
+ useState,
+ useSyncExternalStore,
+ type ReactNode,
+} from "react";
+import { useDisclosureAnchorNotifier } from "../../../lib/disclosure-anchor-context";
+
+type Choice = { open: boolean; revealRequest?: number };
+
+/** Only explicit choices are retained; untouched nodes derive their defaults. */
+class DisclosureChoices {
+ private choices = new Map<string, Choice>();
+ private listeners = new Map<string, Set<() => void>>();
+
+ get = (key: string) => this.choices.get(key);
+
+ set(key: string, choice: Choice) {
+ const previous = this.choices.get(key);
+ if (previous?.open === choice.open && previous.revealRequest === choice.revealRequest) return;
+ this.choices.set(key, choice);
+ this.listeners.get(key)?.forEach((listener) => listener());
+ }
+
+ subscribe(key: string, listener: () => void) {
+ const listeners = this.listeners.get(key) ?? new Set<() => void>();
+ listeners.add(listener);
+ this.listeners.set(key, listeners);
+ return () => {
+ listeners.delete(listener);
+ if (listeners.size === 0) this.listeners.delete(key);
+ };
+ }
+}
+
+const ChoicesContext = createContext<DisclosureChoices | null>(null);
+const ParentContext = createContext<{ claim: () => void; visible: boolean }>({
+ claim: () => {},
+ visible: true,
+});
+
+/** The retained session pane owns this map; no state is persisted to the host. */
+export function TranscriptDisclosureProvider({ children }: { children: ReactNode }) {
+ const [choices] = useState(() => new DisclosureChoices());
+ return <ChoicesContext.Provider value={choices}>{children}</ChoicesContext.Provider>;
+}
+
+export function disclosureKey(kind: string, ...ids: string[]) {
+ return JSON.stringify([kind, ...ids]);
+}
+
+function ownsReadingPosition(body: HTMLElement | null): boolean {
+ if (!body) return false;
+ if (body.contains(document.activeElement)) return true;
+ const selection = window.getSelection();
+ return Boolean(selection && !selection.isCollapsed && (
+ body.contains(selection.anchorNode) || body.contains(selection.focusNode)
+ ));
+}
+
+export function useAutomaticDisclosure(
+ automaticOpen: boolean,
+ revealRequest?: number,
+ identity?: string,
+) {
+ const sharedChoices = useContext(ChoicesContext);
+ const [localChoices] = useState(() => new DisclosureChoices());
+ const choices = sharedChoices ?? localChoices;
+ const fallbackId = useId();
+ const key = identity ?? fallbackId;
+ const parent = useContext(ParentContext);
+ const subscribe = useCallback((listener: () => void) => choices.subscribe(key, listener), [choices, key]);
+ const snapshot = useCallback(() => choices.get(key), [choices, key]);
+ const choice = useSyncExternalStore(subscribe, snapshot, snapshot);
+ const open = choice?.open ?? automaticOpen;
+ const titleRef = useRef<HTMLButtonElement | null>(null);
+ const bodyRef = useRef<HTMLDivElement | null>(null);
+ const notifyAnchor = useDisclosureAnchorNotifier();
+ const currentOpen = useRef(open);
+ currentOpen.current = open;
+
+ const claim = useCallback(() => {
+ if (!choices.get(key)) choices.set(key, { open: currentOpen.current });
+ parent.claim();
+ }, [choices, key, parent.claim]);
+
+ useLayoutEffect(() => {
+ if (revealRequest === undefined || choices.get(key)?.revealRequest === revealRequest) return;
+ choices.set(key, { open: true, revealRequest });
+ parent.claim();
+ }, [choices, key, parent.claim, revealRequest]);
+
+ const previousOpen = useRef(open);
+ useLayoutEffect(() => {
+ // Completion must not hide keyboard focus or an active text selection.
+ if (previousOpen.current && !open && !choice && ownsReadingPosition(bodyRef.current)) {
+ choices.set(key, { open: true });
+ parent.claim();
+ }
+ previousOpen.current = open;
+ }, [choice, choices, key, open, parent.claim]);
+
+ const setManualOpen = useCallback((next: boolean) => {
+ parent.claim();
+ notifyAnchor?.(titleRef.current);
+ if (!next && bodyRef.current?.contains(document.activeElement)) {
+ titleRef.current?.focus({ preventScroll: true });
+ }
+ choices.set(key, { ...choices.get(key), open: next });
+ }, [choices, key, notifyAnchor, parent.claim]);
+ const toggle = useCallback(() => setManualOpen(!currentOpen.current), [setManualOpen]);
+ const collapse = useCallback(() => setManualOpen(false), [setManualOpen]);
+
+ return {
+ open,
+ toggle,
+ collapse,
+ claim,
+ titleRef,
+ bodyRef,
+ parentVisible: parent.visible,
+ // Pointer selection and keyboard interaction establish ownership before
+ // a streaming update can apply an automatic close.
+ bodyEvents: { onPointerDownCapture: claim, onFocusCapture: claim },
+ };
+}
+
+export function DisclosureScope({
+ disclosure,
+ open = disclosure.open,
+ children,
+}: {
+ disclosure: ReturnType<typeof useAutomaticDisclosure>;
+ open?: boolean;
+ children: ReactNode;
+}) {
+ const value = useMemo(() => ({
+ claim: disclosure.claim,
+ visible: disclosure.parentVisible && open,
+ }), [disclosure.claim, disclosure.parentVisible, open]);
+ return <ParentContext.Provider value={value}>{children}</ParentContext.Provider>;
+}
diff --git a/apps/desktop/src/features/chat/transcript/shared.tsx b/apps/desktop/src/features/chat/transcript/shared.tsx
index debdf1aa5..67eae5377 100644
--- a/apps/desktop/src/features/chat/transcript/shared.tsx
+++ b/apps/desktop/src/features/chat/transcript/shared.tsx
@@ -2,7 +2,6 @@ import {
memo,
useCallback,
useId,
- useLayoutEffect,
useRef,
useState,
} from "react";
@@ -20,6 +19,9 @@ import {
import { useOpenChatFileRef, useOpenPreviewTarget } from "../../../hooks/use-preview-target";
import { useDisclosureAnchorNotifier } from "../../../lib/disclosure-anchor-context";
import { isThinkingActive, resolveThinkingDisplayMode } from "../../../lib/turn-process";
+import { useItemReveal, transcriptItemKey } from "../../../lib/transcript-search-context";
+import { disclosureKey, useAutomaticDisclosure } from "./disclosure";
+export { useAutomaticDisclosure } from "./disclosure";
import { messageThinking as thinkingText } from "../../../lib/assistant-turns";
import { useReferencedImageDataUrl } from "../../../lib/use-referenced-image-data-url";
import { useVerifiedChatText } from "../../../hooks/use-verified-chat-text";
@@ -306,57 +308,6 @@ export function ToolActionIcon({ action }: { action: ToolAction }) {
}
}
-/**
- * Automatic disclosure is deliberately separate from user disclosure state.
- * A running process may open its latest details and close them when it settles,
- * but one user click takes ownership for the rest of that component's lifetime.
- * Layout effects keep the automatic transition from moving the transcript for a
- * painted frame.
- *
- * A *manual* toggle also hands its own title to the scroller that owns it,
- * before the state changes (#324): the height under the click may keep changing
- * for several frames, and the reader's place in the transcript is the one thing
- * that must not move while it does. The automatic transition below goes through
- * `setOpen` directly and never claims a reading position.
- */
-export function useAutomaticDisclosure(automaticOpen: boolean, revealRequest?: number) {
- const [open, setOpen] = useState(automaticOpen || revealRequest !== undefined);
- const notifyAnchor = useDisclosureAnchorNotifier();
- const titleRef = useRef<HTMLButtonElement | null>(null);
- const userInteractedRef = useRef(false);
- const previousAutomaticOpenRef = useRef(automaticOpen);
-
- useLayoutEffect(() => {
- if (userInteractedRef.current) return;
- if (previousAutomaticOpenRef.current === automaticOpen) return;
- previousAutomaticOpenRef.current = automaticOpen;
- setOpen(automaticOpen);
- }, [automaticOpen]);
-
- const claim = useCallback(() => {
- userInteractedRef.current = true;
- }, []);
-
- useLayoutEffect(() => {
- if (revealRequest === undefined) return;
- claim();
- setOpen(true);
- }, [claim, revealRequest]);
-
- const toggle = useCallback(() => {
- claim();
- notifyAnchor?.(titleRef.current);
- setOpen((value) => !value);
- }, [claim, notifyAnchor]);
-
- const collapse = useCallback(() => {
- claim();
- notifyAnchor?.(titleRef.current);
- setOpen(false);
- }, [claim, notifyAnchor]);
-
- return { open, toggle, collapse, claim, titleRef };
-}
/** Actions whose path/url argument makes sense to preview in the panel. */
export const PREVIEWABLE_ACTIONS = new Set<ToolAction>(["read", "write", "edit", "fetch"]);
@@ -540,7 +491,8 @@ export const ThinkingRow = memo(function ThinkingRow({
}) {
const { t } = useTranslation();
const detailsId = useId();
- const disclosure = useAutomaticDisclosure(autoOpen);
+ const revealRequest = useItemReveal(message.id, "thinking");
+ const disclosure = useAutomaticDisclosure(autoOpen, revealRequest, disclosureKey("thinking", message.id));
const { open, toggle: toggleDisclosure, collapse: collapseDisclosure } = disclosure;
const titleRef = disclosure.titleRef;
const toggleRow = useCallback(() => {
@@ -569,7 +521,7 @@ export const ThinkingRow = memo(function ThinkingRow({
const text = thinkingText(message);
const summary = text.replace(/\s+/g, " ").trim();
return (
- <div className={`tool-row thinking ${open ? "open" : ""}`}>
+ <div className={`tool-row thinking ${open ? "open" : ""}`} data-transcript-item={transcriptItemKey(message.id, "thinking")}>
<button
ref={titleRef}
className="tool-row-header"
@@ -590,7 +542,7 @@ export const ThinkingRow = memo(function ThinkingRow({
</span>
</button>
{open ? (
- <div className="tool-row-body" id={detailsId}>
+ <div className="tool-row-body" id={detailsId} ref={disclosure.bodyRef} {...disclosure.bodyEvents}>
<DisclosureCollapseRail
label={t("chat.thinkingHide")}
onCollapse={collapseRow}
diff --git a/apps/desktop/src/hooks/use-transcript-search-focus.ts b/apps/desktop/src/hooks/use-transcript-search-focus.ts
index 759af96c8..f0c743e73 100644
--- a/apps/desktop/src/hooks/use-transcript-search-focus.ts
+++ b/apps/desktop/src/hooks/use-transcript-search-focus.ts
@@ -1,6 +1,7 @@
import { useLayoutEffect, useRef, type RefObject } from "react";
import type { TranscriptSearchTarget } from "../lib/transcript-reading";
import { locateTranscriptSearch } from "../lib/transcript-search-highlight";
+import { transcriptSearchSelector } from "../lib/transcript-search-context";
const READING_KEYS = new Set(["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "]);
const GESTURES = ["wheel", "touchstart", "touchmove", "pointerdown", "keydown"];
@@ -30,23 +31,90 @@ export function useTranscriptSearchFocus({
const scroller = scrollRef.current;
const content = contentRef.current;
if (!visible || !target || !scroller || !content) return;
- return installTranscriptSearchFocus({
- target,
- source,
- scroller,
- content,
- position,
- onNavigate,
- onPosition,
- });
+
+ let removeFocus: (() => void) | undefined;
+ let observer: MutationObserver | undefined;
+ const install = () => {
+ if (removeFocus) return true;
+ const targetElement = content.querySelector<HTMLElement>(
+ transcriptSearchSelector(target),
+ );
+ if (!targetElement || !transcriptSearchTargetVisible(target, targetElement, content)) {
+ return false;
+ }
+ removeFocus = installTranscriptSearchFocus({
+ target,
+ targetElement,
+ source,
+ scroller,
+ content,
+ position,
+ onNavigate,
+ onPosition,
+ });
+ return Boolean(removeFocus);
+ };
+
+ if (!install()) {
+ observer = new MutationObserver(() => {
+ if (!install()) return;
+ observer?.disconnect();
+ observer = undefined;
+ });
+ observer.observe(content, {
+ childList: true,
+ subtree: true,
+ attributes: true,
+ attributeFilter: ["aria-hidden", "class", "hidden", "inert"],
+ });
+ // Close the gap between the first lookup and observer registration.
+ if (install()) {
+ observer?.disconnect();
+ observer = undefined;
+ }
+ }
+
+ return () => {
+ observer?.disconnect();
+ removeFocus?.();
+ };
}, [contentRef, contentVersion, onNavigate, onPosition, scrollRef, source, target, visible]);
}
+function transcriptSearchTargetVisible(
+ target: TranscriptSearchTarget,
+ element: HTMLElement,
+ content: HTMLElement,
+): boolean {
+ for (
+ let current: HTMLElement | null = element;
+ current && current !== content;
+ current = current.parentElement
+ ) {
+ if (
+ current.hidden ||
+ current.hasAttribute("inert") ||
+ current.getAttribute("aria-hidden") === "true"
+ ) {
+ return false;
+ }
+ }
+
+ const itemKind = target.item?.kind;
+ const disclosureItem =
+ itemKind === "thinking" ||
+ itemKind === "tool" ||
+ itemKind === "hostedSearch" ||
+ (!itemKind && element.classList.contains("tool-row"));
+ return !disclosureItem || element.classList.contains("open");
+}
+
type SearchPosition = { current: { requestId: number; alignUntil: number } };
/** Install one browser focus effect; cleanup is safe during StrictMode replay. */
export function installTranscriptSearchFocus({
target,
+ targetElement,
source,
scroller,
content,
@@ -55,6 +123,7 @@ export function installTranscriptSearchFocus({
onPosition,
}: {
target: TranscriptSearchTarget;
+ targetElement?: HTMLElement;
source: string;
scroller: HTMLElement;
content: HTMLElement;
@@ -62,10 +131,10 @@ export function installTranscriptSearchFocus({
onNavigate: (fresh: boolean) => void;
onPosition?: (scrollTop: number) => void;
}) {
- const message = content.querySelector<HTMLElement>(
- `[data-message-id="${CSS.escape(target.messageId)}"]`,
+ const message = targetElement ?? content.querySelector<HTMLElement>(
+ transcriptSearchSelector(target),
);
- if (!message) return;
+ if (!message || !transcriptSearchTargetVisible(target, message, content)) return;
const row = message.closest<HTMLElement>(".message-row") ?? message;
row.classList.add("transcript-search-target");
const fresh = position.current.requestId !== target.requestId;
diff --git a/apps/desktop/src/lib/activity-summary.ts b/apps/desktop/src/lib/activity-summary.ts
new file mode 100644
index 000000000..ec43aca6e
--- /dev/null
+++ b/apps/desktop/src/lib/activity-summary.ts
@@ -0,0 +1,44 @@
+import type { AssistantActivityItem } from "./assistant-turns";
+import { getToolAction } from "./tool-display";
+import { runOutcome } from "./tool-presentation";
+import { isDelegationActivityItem, subagentOutcome, type SubagentOutcome } from "./subagent-topology";
+
+export function activityItemHasIssue(item: AssistantActivityItem): boolean {
+ if (item.kind === "hostedSearch") return item.round.status === "failed";
+ if (item.kind !== "tool") return false;
+ const message = item.message;
+ return message.toolStatus === "error" || message.toolStatus === "denied" ||
+ Boolean(message.isError) ||
+ (getToolAction(message.toolName) === "run" && runOutcome(message) === "failed");
+}
+
+export function visibleActivityItems(
+ items: readonly AssistantActivityItem[],
+ compact: boolean,
+ active: boolean,
+) {
+ return items.filter((item) => item.kind !== "thinking" || !compact ||
+ (active && item.message.status === "streaming" && !item.message.content.trim()));
+}
+
+export function activitySummary(items: readonly AssistantActivityItem[], statuses?: ReadonlyMap<string, SubagentOutcome>) {
+ const tools = items.filter((item) => item.kind !== "thinking");
+ const thinking = items.length - tools.length;
+ const actions = tools.map((item) => item.kind === "hostedSearch"
+ ? "search" : getToolAction(item.message.toolName));
+ const label = tools.length === 0 ? "chat.activityThinking"
+ : actions.every((action) => action === "run") ? "chat.activityCommands"
+ : actions.every((action) => action === "search") ? "chat.activitySearches"
+ : "chat.activityTools";
+ return {
+ label,
+ count: tools.length || thinking,
+ tools: tools.length,
+ thinking,
+ issues: items.filter((item) => {
+ if (!isDelegationActivityItem(item)) return activityItemHasIssue(item);
+ const outcome = subagentOutcome(item.message, statuses);
+ return outcome === "failed" || outcome === "denied";
+ }).length,
+ };
+}
diff --git a/apps/desktop/src/lib/transcript-reading.ts b/apps/desktop/src/lib/transcript-reading.ts
index fb8a30b7d..532630126 100644
--- a/apps/desktop/src/lib/transcript-reading.ts
+++ b/apps/desktop/src/lib/transcript-reading.ts
@@ -1,11 +1,17 @@
import type { SessionDetail, UiMessage } from "@pi-desktop/shared";
import { dedupeSessionMessages, mergeLiveSessionMessages } from "./session-transcript";
+/** Renderer-only precision for surfaces sharing one persisted message. */
+export type TranscriptItemTarget =
+ | { kind: "message" | "thinking" | "tool" }
+ | { kind: "hostedSearch"; roundId: string };
+
export type TranscriptSearchTarget = {
sessionId: string;
messageId: string;
query: string;
requestId: number;
+ item?: TranscriptItemTarget;
};
/** One renderer reading range, shared by ordinary history and search navigation. */
diff --git a/apps/desktop/src/lib/transcript-search-context.ts b/apps/desktop/src/lib/transcript-search-context.ts
index e9e9450b6..04fd002b9 100644
--- a/apps/desktop/src/lib/transcript-search-context.ts
+++ b/apps/desktop/src/lib/transcript-search-context.ts
@@ -1,4 +1,26 @@
-import { createContext } from "react";
-import type { TranscriptSearchTarget } from "./transcript-reading";
+import { createContext, useContext } from "react";
+import type { TranscriptItemTarget, TranscriptSearchTarget } from "./transcript-reading";
export const TranscriptSearchContext = createContext<TranscriptSearchTarget | null>(null);
+
+export function transcriptItemKey(messageId: string, kind: TranscriptItemTarget["kind"], roundId?: string) {
+ return JSON.stringify([messageId, kind, roundId ?? ""]);
+}
+
+export function transcriptSearchSelector(target: TranscriptSearchTarget) {
+ if (!target.item) return `[data-message-id="${CSS.escape(target.messageId)}"]`;
+ const item = target.item;
+ return `[data-transcript-item="${CSS.escape(transcriptItemKey(
+ target.messageId, item.kind, item.kind === "hostedSearch" ? item.roundId : undefined,
+ ))}"]`;
+}
+
+/** Legacy message navigation opens tool content, never unrelated reasoning. */
+export function useItemReveal(messageId: string, kind: TranscriptItemTarget["kind"], roundId?: string) {
+ const target = useContext(TranscriptSearchContext);
+ if (!target || target.messageId !== messageId) return undefined;
+ if (!target.item) return kind === "tool" || kind === "message" ? target.requestId : undefined;
+ if (target.item.kind !== kind) return undefined;
+ if (target.item.kind === "hostedSearch" && target.item.roundId !== roundId) return undefined;
+ return target.requestId;
+}
diff --git a/apps/desktop/src/lib/turn-process.ts b/apps/desktop/src/lib/turn-process.ts
index 35da68107..d37b1066b 100644
--- a/apps/desktop/src/lib/turn-process.ts
+++ b/apps/desktop/src/lib/turn-process.ts
@@ -1,5 +1,6 @@
import type { AppSettings, UiMessage } from "@pi-desktop/shared";
import type { AssistantTurnEntry, AssistantTurnPart } from "./assistant-turns";
+import { activityItemHasIssue } from "./activity-summary";
type ThinkingDisplayMode = NonNullable<AppSettings["thinkingDisplayMode"]>;
@@ -44,19 +45,13 @@ export function hasFailedProcessTool(parts: readonly AssistantTurnPart[]): boole
return parts.some(
(part) =>
part.kind === "activity" &&
- part.items.some(
- (item) =>
- item.kind === "tool" &&
- (item.message.toolStatus === "error" ||
- item.message.toolStatus === "denied" ||
- item.message.isError),
- ),
+ part.items.some(activityItemHasIssue),
);
}
-/** Compact groups a turn into one process disclosure; detailed does not. */
+/** Both presentation modes expose the same process hierarchy. */
export function shouldGroupTurnProcess(mode: ThinkingDisplayMode): boolean {
- return mode === "compact";
+ return mode === "detailed" || mode === "compact";
}
/** The last activity chunk of a turn owns detailed-mode's default-open tool. */
@@ -71,13 +66,13 @@ export function isLastActivityPart(
return false;
}
-/** Compact process stays collapsed unless an active tool failed. */
+/** Detailed keeps narration visible; compact reveals active failures only. */
export function shouldAutoOpenTurnProcess(
mode: ThinkingDisplayMode,
isActive: boolean,
hasToolFailure: boolean,
): boolean {
- return mode === "compact" && isActive && hasToolFailure;
+ return mode === "detailed" || (isActive && hasToolFailure);
}
/**
@@ -115,7 +110,7 @@ export function visibleProcessSteps(
}
for (const item of part.items) {
if (
- item.kind === "tool" ||
+ item.kind !== "thinking" ||
mode === "detailed" ||
isThinkingActive(item.message, active)
) {
diff --git a/apps/desktop/src/styles/messages.css b/apps/desktop/src/styles/messages.css
index be9e3a941..b37e16456 100644
--- a/apps/desktop/src/styles/messages.css
+++ b/apps/desktop/src/styles/messages.css
@@ -1860,7 +1860,7 @@
transition: transform var(--motion-duration-fast) var(--motion-ease-out);
}
-.tool-activity-group.open .tool-activity-caret {
+.tool-activity-group.open > .tool-activity-header > .tool-activity-caret {
transform: rotate(90deg);
}
@@ -1872,7 +1872,7 @@
opacity var(--motion-duration-fast) var(--motion-ease-out);
}
-.tool-activity-group.open .tool-activity-collapse {
+.tool-activity-group.open > .tool-activity-collapse {
grid-template-rows: 1fr;
opacity: 1;
}
@@ -2445,7 +2445,7 @@
flex: none;
margin-left: 2px;
color: var(--ds-text-muted);
- opacity: 0;
+ opacity: 0.65;
transition: transform var(--motion-duration-fast) var(--motion-ease-out);
}
@@ -2457,7 +2457,9 @@
opacity: 1;
}
-.tool-row.open .tool-row-caret {
+.tool-row.open > .tool-row-header > .tool-row-caret,
+.tool-row.open > .tool-row-head > .tool-row-header > .tool-row-caret,
+.tool-row.open > .tool-row-head > .tool-row-caret {
transform: rotate(90deg);
}
@@ -2989,14 +2991,15 @@
font-size: var(--text-xs);
}
-/* One disclosure owns the process; tools retain their own detail controls. */
+/* Process, activity groups and item details own independent disclosure levels. */
.turn-process {
width: 100%;
margin: 0 0 8px;
min-width: 0;
}
-.turn-process.open > .tool-activity-header > .tool-activity-caret {
+.turn-process.open > .tool-activity-header > .tool-activity-caret,
+.process-activity-group.open > .tool-activity-header > .tool-activity-caret {
transform: rotate(90deg);
}
@@ -3005,7 +3008,8 @@
padding-left: 18px;
}
-.turn-process-body[hidden] {
+.turn-process-body[hidden],
+.process-activity-body[hidden] {
display: none;
}
@@ -3014,6 +3018,42 @@
margin-block: 8px;
}
+.process-activity-group {
+ width: 100%;
+ min-width: 0;
+ margin-block: 6px;
+}
+
+.process-activity-body {
+ position: relative;
+ min-width: 0;
+}
+
+.process-activity-group.grouped > .process-activity-body {
+ margin-block: 3px 6px;
+ padding-inline-start: 12px;
+}
+
+.process-activity-group > .tool-activity-header,
+.turn-process > .tool-activity-header {
+ display: flex;
+ width: 100%;
+}
+
+.process-activity-group > .tool-activity-header > .tool-activity-label,
+.turn-process > .tool-activity-header > .tool-activity-label {
+ min-width: 0;
+ flex: 0 1 auto;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.process-activity-group > .tool-activity-header > .tool-activity-caret,
+.turn-process > .tool-activity-header > .tool-activity-caret {
+ margin-inline-start: auto;
+}
+
.thinking-compact {
display: flex;
align-items: center;
@@ -3023,6 +3063,10 @@
.turn-process-error {
display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ flex: none;
+ font-size: var(--text-xs-plus);
color: var(--ds-error);
}
diff --git a/docs/adr/turn-process-and-thinking-display.md b/docs/adr/turn-process-and-thinking-display.md
index 1d87aa809..605712db0 100644
--- a/docs/adr/turn-process-and-thinking-display.md
+++ b/docs/adr/turn-process-and-thinking-display.md
@@ -2,6 +2,7 @@
- Status: Accepted
- Date: 2026-09-17
+- Amended: 2026-09-20
- Issues: #510, #461
- Amends: D071, [ADR 0242](0242-delta-only-streaming-updates.md)
@@ -9,62 +10,90 @@
A model can alternate reasoning, tool calls and progress text many times before
answering one user request. Separate activity groups leave those progress
-messages at the same visual level as the answer. Some readers also need a
-thinking indicator without rapidly changing reasoning text.
+messages at the same visual level as the answer, while one flat process
+container still leaves long tool/search sequences difficult to scan. Some
+readers also need a thinking indicator without rapidly changing reasoning text.
## Decision
-Compact mode projects each assistant-turn entry into one process area and
-its trailing answer. Thinking, tools and intermediate assistant text keep
-their original order inside the process. A trailing assistant text stays
-visible while streaming; if a later tool or thinking block follows, that text
-belongs to the process. There is no semantic final-answer marker in UiMessage,
-so the renderer does not guess intent from the wording. User/system messages
-and compaction dividers retain their existing turn boundaries.
+Both display modes project each loaded assistant-turn entry into one turn-process
+disclosure plus its trailing answer. Thinking, tools and intermediate assistant
+text keep their original order inside the process. A trailing assistant text
+stays visible while streaming; if later tool or thinking activity follows, that
+text moves into the process without changing the stored message. There is no
+semantic final-answer marker in `UiMessage`, so the renderer does not guess
+intent from wording. User/system messages and compaction dividers retain their
+existing turn boundaries.
-Detailed mode does not wrap a process: thinking, tools and intermediate
-assistant text stay in transcript order beside the answer. Its last tool-call
-or hosted-search row of the last activity group starts expanded; earlier tool
-details stay collapsed. Compact mode starts completed process areas collapsed
-and keeps individual tool payloads collapsed. Manual disclosure choices survive
-streaming and completion. Search navigation opens the containing process.
-Tool failures open an unclaimed active process so the invocation error stays
-visible even in compact mode; that does not mark the whole turn as failed.
-Assistant errors and stopped trailing partial answers stay outside the process.
-Tool/delegation detail controls, permission cards, and transcript actions retain
-their existing behavior aside from that detailed last-tool default.
+The process has three independent disclosure levels: the whole turn process, an
+ordinary activity group, and one item's details. An ordinary activity group
+contains one contiguous tool/search/thinking segment between progress paragraphs
+and appears only when the mode has at least two visible items. A singleton uses
+its item disclosure directly; hidden compact-mode thinking does not create a
+redundant wrapper. Existing Task topology remains its segment's container and is
+not duplicated inside an ordinary activity group.
-Settings → AI → Defaults includes `thinkingDisplayMode`, an optional
-`detailed | compact` AppSettings field. Absent or unrecognized values display
-as detailed. Compact mode renders no reasoning text or excerpt: while a
-thinking-only message streams it shows a status indicator, and when reasoning
-ends the thinking row disappears. Answer text ends that indicator even while
-the assistant message is still streaming. A completed thinking-only process
-leaves no empty header. Tool rows and progress text remain expandable; detailed
-mode opens the last tool of the last activity group by default.
-Changing the setting updates mounted history and nested thinking rows.
+Detailed mode starts active and completed whole-process disclosures open. The
+ordinary group that owns the active execution segment starts open, then closes
+on completion only while untouched. Other completed ordinary groups start
+closed. Compact mode starts process and ordinary-group disclosures closed, but
+an untouched active process containing any recorded failed or denied tool stays
+open through later recovery and closes on turn completion if still untouched.
+Compact mode keeps every tool/search payload closed and renders no reasoning
+text or excerpt; it shows only the active thinking indicator and omits empty
+completed thinking-only containers.
-The field uses the existing host-owned settings JSON; no database migration or
-schema/protocol version change is required. It does not alter provider thinking
-levels, runtime/model context, stored reasoning, export, permissions, or copy
-payloads. Process durations use message/tool timestamps and recorded durations;
-a live UI clock adds no persisted fields. Step counts include rendered thinking,
-tool and intermediate-text items and omit hidden compact-mode thinking.
+Detailed mode preserves the leaf default only for the literal final item of the
+last activity group. If that item is an eligible tool-call or hosted-search row,
+its payload starts open; failed and denied items remain guarded closed. The
+renderer does not scan backward past a final thinking item to open an earlier
+tool. Opening a closed ancestor exposes the retained leaf state without opening
+all descendants.
+
+Each header toggles only its own level. Parent and child states are independent:
+closing a parent preserves descendant choices, reopening restores them, and
+sibling groups do not form an accordion. Manual interaction with an item claims
+the containing group and process as user-owned without toggling either ancestor;
+completion must not close a container around content the user opened, focused,
+or selected. Manual choices survive streaming, completion, mode changes,
+reparenting from singleton to group, and row remounts while the owning retained
+session pane remains alive. Pane eviction, session deletion, or renderer restart
+releases this presentation memory; it is not stored in messages or host settings.
+
+Search/navigation reveals only the precise ancestor path needed for its target:
+process, group, then item details when required. Replaying the same request does
+not repeatedly override a later manual close. Compact-mode reasoning remains
+hidden until the user chooses Detailed. Assistant errors, stopped trailing
+partial answers, permission/question/plan/goal decisions, and any other pending
+action surface remain outside hidden process content and reachable without
+expanding it.
+
+Settings → AI → Defaults retains `thinkingDisplayMode`, the optional
+`detailed | compact` `AppSettings` field. Absent or unrecognized values resolve
+to detailed. The field changes presentation only; it does not alter provider
+thinking levels, runtime/model context, stored reasoning, export, permissions,
+execution, or copy payloads. Process headers use recorded timing, direct
+tool/search counts, running state, and issue counts; they do not double-count
+delegated child work or treat a failed child as a failed assistant turn.
## Consequences
-- Compact completed turns have one process disclosure plus the visible answer.
-- Detailed mode does not group that work; compact remains the collapsed process.
-- Unchanged activity groups keep their memoized boundary during text deltas;
- the process wrapper does not move execution or persistence into the renderer.
-- This groups loaded transcript entries; it does not reconstruct history that
- has not been loaded or join turns across compaction boundaries.
+- Both modes expose one whole-process disclosure while keeping the final answer
+ and actionable interruptions reachable outside it.
+- Detailed mode keeps progress narration visible by default, folds untouched
+ completed activity groups, and preserves the literal-final-item leaf default.
+- Compact mode remains the low-detail option: the process is folded, payloads
+ stay closed, and reasoning content is suppressed.
+- Disclosure memory is pane-owned presentation state with stable turn, group,
+ and item identities; it is neither a persisted transcript contract nor a
+ central workflow-store concern.
+- This groups loaded transcript entries only; it does not reconstruct unloaded
+ history or join turns across compaction boundaries.
## Validation
-`turn-process.test.mjs` covers projection, timing, partial/error answers and
-legacy settings. `test:e2e:transcript` exercises real React/Chromium disclosure,
-streaming, search, mode selection, mounted-history updates and the existing
-100-group render boundary. `test:e2e:transcript-disclosure` retains the scroll
-anchor gate; `test:e2e:theme-surfaces` checks the surrounding theme controls.
-See E2E-CHAT-turn-process-and-thinking-display.
+For the 2026-09-20 amendment, the request explicitly limits validation to static
+checks and compilation. The linked E2E scenarios describe intended behavior for
+source and design review; no unit, component, integration, browser, Electron, or
+E2E tests are added or run for this amendment. See
+E2E-CHAT-turn-process-and-thinking-display for the synchronized scenario text.
diff --git a/docs/spec/04-ux/06-settings-ia.md b/docs/spec/04-ux/06-settings-ia.md
index bf19d2b68..5cb1f0b75 100644
--- a/docs/spec/04-ux/06-settings-ia.md
+++ b/docs/spec/04-ux/06-settings-ia.md
@@ -183,12 +183,15 @@ Settings is a **full-window page** that replaces the app sidebar + main chrome (
to Off, and has no follow-the-session entry. Settings search indexes the card,
its switch, the template row, the default-model row, and the reasoning row.
- **Thinking display mode** uses a menu select with Detailed (default) and
- Compact. Detailed shows reasoning, tools and intermediate text in place
- without grouping them into a process; Compact groups that work into a
- process, collapses completed processes, shows only an active thinking
- indicator, and hides finished thought rows. The global preference
+ Compact. Both modes use one whole-process disclosure. Detailed starts the
+ process open, keeps reasoning visible, opens the active multi-item activity
+ group, and closes an untouched group when it completes; Compact starts the
+ process and groups closed, keeps tool/search payloads closed, shows only an
+ active thinking indicator, and hides finished reasoning. Singleton activity
+ uses its item disclosure directly in either mode. The global preference
persists as `thinkingDisplayMode` in host-owned settings; missing values use
- Detailed. It affects presentation only, not model reasoning configuration.
+ Detailed. It affects presentation only, not model reasoning configuration,
+ and explicit disclosure choices are retained for the mounted session pane.
Settings search indexes the row and both mode names.
- The **Command shell** row in Defaults uses the host-discovered catalog of native
PowerShell 5.1, PowerShell 7, cmd, Git Bash, and Bash with IDs
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index e45b35364..4e64e1eca 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -806,31 +806,45 @@ reading surface of the workstation.
### Turn process and thinking display
-Compact mode projects each assistant-turn entry into one process disclosure
-containing reasoning, tools and intermediate assistant text in transcript
-order. Its trailing answer streams outside the disclosure. Later activity
-moves a provisional answer into the process without altering the stored
-message. Detailed mode does not wrap that process: the same parts stay in
-place. Its last tool-call (or hosted-search) row of the last activity group
-starts expanded; earlier tool details stay collapsed. Compact keeps those
-payloads collapsed. Assistant errors and trailing aborted partial replies stay visible.
-Compaction and user/system boundaries are unchanged.
-
-Compact mode starts completed process areas collapsed. Manual choices and
-search reveals own the disclosure until unmount. Failed tools open an
-unclaimed active process even in compact mode and keep their invocation-level
-error presentation. The compact header shows elapsed time and the visible
-process step count. Its thinking label applies only while the latest activity
-is streaming reasoning without answer text; streamed answers use the
-processing label. Delegation cards and individual tool details remain
-available inside the compact process.
-
-`thinkingDisplayMode` defaults to `detailed`. In `compact`, reasoning text and
-excerpts are absent, active reasoning has a status indicator, and completed
-thinking rows disappear. Tools and intermediate text remain accessible; a
-thinking-only completed process has no empty header. The setting also applies
-to nested thinking rows and updates mounted history. It never removes stored
-reasoning or changes model thinking configuration. See
+Both Detailed and Compact project each loaded assistant turn into one whole-process
+disclosure containing reasoning, tools, hosted searches and intermediate assistant
+text in transcript order. The trailing answer streams outside that disclosure;
+later activity can reclassify provisional answer text into the process without
+changing the stored message. Assistant errors and stopped trailing partial answers
+also stay outside it. User/system messages and compaction boundaries are unchanged.
+
+Within the process, an ordinary activity group represents one contiguous
+tool/search/thinking segment between progress paragraphs. It renders a group header
+only when the current mode has two or more visible items. A singleton uses its item
+disclosure directly, compact-hidden thinking never creates an empty wrapper, and
+the existing Task topology remains the container for delegated work.
+
+Detailed starts active and completed whole-process disclosures open. The ordinary
+group owning the active execution segment starts open, then closes on completion
+only if untouched; other completed groups start closed. Compact starts the process
+and ordinary groups closed. Its untouched active process remains open when any
+failed or denied tool has been recorded, through later successful recovery, and
+closes on completion if still untouched. Group headers summarize count, running
+state and issue count without treating a failed child as a failed turn.
+
+In Detailed, only the literal final item of the last activity group receives the
+leaf auto-open default when it is an eligible tool-call or hosted-search row.
+Failed and denied rows remain closed, and a final thinking item does not cause a
+backward scan for an earlier tool. Compact keeps all tool/search payloads closed and
+suppresses reasoning text and excerpts; only its active thinking indicator remains.
+
+Whole process, group and item are independent controls. Closing an ancestor keeps
+descendant choices and reopening restores them; opening a parent never expands all
+children. User interaction with a child claims its ancestors without toggling them,
+so completion cannot close around opened, focused or selected content. Choices use
+stable turn/group/item identities and remain while the retained session pane lives,
+including mode changes and row remounts; pane eviction, deletion or renderer restart
+reapplies defaults rather than persisting disclosure state to messages or settings.
+
+Search/navigation reveals the precise process -> group -> item path required by the
+target and applies each reveal request once. Compact reasoning stays hidden until
+the user selects Detailed. Permission, question, plan/goal approval and other
+pending action cards remain reachable outside a hidden process. See
[ADR turn-process-and-thinking-display](../../adr/turn-process-and-thinking-display.md).
### 4.4 States
@@ -1962,25 +1976,24 @@ Lightweight inline disclosure row showing a semantic tool action, its primary
argument hint, status, and a readable rendering of the result. It follows D071
and is intentionally not an elevated card.
-Consecutive tool calls form one ChatGPT-style processing group. Historical
-groups are collapsed by default. While the turn is active, the latest live
-group opens automatically so the process list is visible. In detailed mode,
-the latest tool-call or hosted-search row of the last activity group in a
-turn opens automatically; earlier rows stay collapsed. Compact mode keeps
-tool-call details collapsed by default, including failed tool calls. The
-latest thinking row opens automatically while it streams. When the group or
-turn settles, automatically managed thinking disclosures close so the answer
-remains the visual focus; a detailed last-tool disclosure stays open unless
-a later activity supersedes it. A user click on a group, row, or collapse
-rail takes ownership of that disclosure; later stream updates and completion
-never reverse that choice.
+One contiguous tool/search/thinking segment between progress paragraphs becomes an
+ordinary processing group only when it has two or more visible items. A singleton
+uses its item disclosure directly, and Task topology keeps its existing container.
+While the turn is active, the ordinary group owning the execution segment opens in
+Detailed and remains closed in Compact; when it settles, an untouched Detailed
+group closes. Detailed auto-opens a leaf payload only when the literal final item
+of the last activity group is an eligible tool-call or hosted-search row. Earlier,
+failed and denied rows remain closed, and a final thinking item does not select an
+earlier tool. Compact keeps every tool/search payload closed.
+
The group header shows `Processing · 12s` while active or `Processed for 12s`
-after completion. Expanding it reveals the ordered tool activity rows and their
-nested result disclosures. The group
-reports duration and containment, not turn outcome: a failed child remains an
-error on its own ToolCallRow but never changes the group header to a terminal
-failure. Terminal agent errors remain owned by either the assistant error or
-TurnOutcomeCard surface.
+after completion, plus bounded item and issue counts. Expanding it reveals the
+ordered activity rows and their independent result disclosures. A failed child
+remains an error on its own ToolCallRow but does not make the group or whole turn
+terminally failed; terminal agent errors remain owned by the assistant error or
+TurnOutcomeCard surface. A user action on a group, item, or collapse rail claims
+that level and its ancestors without toggling them, so streaming and completion
+never reverse the chosen state or close around focused/selected content.
Elapsed labels use compact automatically carried units: seconds below one
minute, minutes plus seconds below one hour, and hours plus minutes (and
seconds when non-zero) from one hour onward. Zero-value units are omitted, so
@@ -1999,14 +2012,14 @@ seconds when non-zero) from one hour onward. Zero-value units are omitted, so
- The leading Lucide icon reflects the action type: file, folder, search,
edit, terminal, web, or generic tool.
-- The group header owns the elapsed timer and step count. It stays in the
- transcript after completion. Historical groups remain
- collapsed; the latest active group opens automatically and returns to a
- collapsed state when it settles unless the user has interacted with it.
-- Tool-call details remain collapsed by default while a compact group is open.
- In detailed mode the last tool-call or hosted-search row of the last activity
- group starts expanded. The latest thinking row opens automatically while it
- streams and closes when the turn settles unless the user has interacted with it.
+- A multi-item group header owns elapsed time plus item and issue counts and stays
+ in the transcript after completion. In Detailed the active group starts open and
+ closes on completion only if untouched; completed groups otherwise start closed.
+ Compact groups start closed. A singleton has no group header.
+- Tool/search payloads remain collapsed in Compact. In Detailed, only an eligible
+ literal final item of the last activity group starts expanded; failed/denied
+ items remain closed, and a final thinking item does not select an earlier tool.
+ Live thinking follows its own disclosure policy and never opens sibling payloads.
- The processing group spans the full available assistant column, so expanded
result details keep a usable width even when the header or payload is short.
- The visible label is a natural-language action (`Read`, `Ran`, `Searched`),
@@ -2079,17 +2092,17 @@ twice.
| State | Header treatment | Expanded content |
|---|---|---|
-| Running | Progressive action with readable text and a pulsing marker; a `run` row also shows its spinner and pulses the status dot beside `Working…` | The latest thinking row opens automatically while it streams; detailed mode also opens the last tool of the last activity group; compact tool-call details stay collapsed |
-| Success | Past-tense action + result chips; no green success badge, except a `run` row's dot and `Done` | Result blocks, then arguments if not already shown; automatic thinking disclosures close when the turn settles; detailed last-tool stays open unless superseded |
-| Error | Past-tense action + compact danger status; details remain collapsed by default and open only on user request. A `run` row is in this state whenever its command exited non-zero, whatever the call reported (D227) | Error note first, then arguments |
-| Denied | Muted `Denied` status | Permission result when available |
+| Running | Progressive action with readable text and a pulsing marker; a `run` row also shows its spinner and pulses the status dot beside `Working…` | Detailed opens the active multi-item group; only an eligible literal-final tool/search payload opens. Compact payloads stay closed; live thinking follows its own indicator/disclosure policy |
+| Success | Past-tense action + result chips; no green success badge, except a `run` row's dot and `Done` | Result blocks, then arguments if not already shown; an untouched active group closes on completion, while manual group/item choices and the detailed literal-final leaf state are retained |
+| Error | Past-tense action + compact danger status; details remain collapsed by default and open only on user request. A `run` row is in this state whenever its command exited nonzero, whatever the call reported (D227) | Error note first, then arguments |
+| Denied | Muted `Denied` status; payload remains closed until requested | Permission result when available |
### 9.6 Interactions
-- Click the row: expand/collapse the result blocks. Compact tool-call details
- stay collapsed by default while a live group is open. Detailed mode opens the
- last tool-call of the last activity group; earlier and failed rows remain
- collapsed until the user opens them.
+- Click the row: expand/collapse only that result payload. Compact payloads start
+ closed. Detailed starts a payload open only when the row is the eligible literal
+ final item of the last activity group; earlier, failed and denied rows remain
+ closed until the user opens them.
- A file path that a row or its result names is a link, not decoration: clicking
the summary path of a `Read`, `Write`, `Edit`, or `fetch` row, or a path in a
result's file list or match groups, completes the reference through the same
@@ -2100,19 +2113,19 @@ twice.
ADR 0263). Such a click opens the file instead of toggling the row's
disclosure, and a reference that matches nothing reports itself without
opening a panel. A tool surface picks no destination of its own.
-- Click the processing header: expand/collapse the ordered activity list.
- Historical groups default collapsed; the latest active group opens while the
- turn is running and closes when it settles if the user has not touched it.
-- Click or keyboard-activate the left rule beside expanded thinking, tool
- details, delegated work, or processing steps: collapse that owning
- disclosure without changing adjacent expansion state. Any click on a group,
- row, or collapse rail makes that disclosure user-owned, so automatic stream
- transitions never reopen or close it later.
-- A failed child row remains error-hued and reports its failure in the compact
- row header, but its details are not auto-expanded. The containing group
- settles as `Processed for {elapsed}` even when a later tool recovered.
- Expansion uses a short height/opacity transition and keeps collapsed content
- inert.
+- Click the processing header: expand/collapse only that ordered activity list.
+ Detailed opens the active group and closes it on settlement only if untouched;
+ completed groups otherwise start closed. Compact groups start closed. Opening a
+ group does not expand every item, and sibling groups remain independent.
+- Click or keyboard-activate the left rule beside expanded thinking, tool details,
+ delegated work, or processing steps: collapse that owning disclosure without
+ changing adjacent expansion state. Item interaction also claims its containing
+ group and whole process as user-owned without toggling them; automatic stream or
+ completion transitions never reverse those states.
+- A failed child row remains error-hued and reports its failure in the row header,
+ but its payload is not auto-expanded. The containing group settles as
+ `Processed for {elapsed}` with an issue count even when a later tool recovered.
+ Expansion uses a short height/opacity transition and keeps collapsed content inert.
- Running updates replace the latest partial output in place. Bash's cumulative
`details.output` partial result is rendered through the stdout channel, while
the completed `details.stdout` value wins when both are present. Blocks are
diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.md
index 47590b309..bd2bdf0c0 100644
--- a/docs/spec/04-ux/09-interaction-patterns.md
+++ b/docs/spec/04-ux/09-interaction-patterns.md
@@ -808,34 +808,40 @@ may be retained while exactly one workspace supplies the visible shell context.
### 4.2 Collapse indicator
-- Tool activity starts as a lightweight collapsed row. Failed calls keep their
- error in the row header; they do not auto-expand.
-- Compact mode gives one assistant turn one process disclosure containing
- thinking, tool calls and intermediate progress text. The trailing answer
- streams outside it; later activity moves that text into the process. The
- header updates elapsed time once per second while active and shows the
- visible step count.
-- Detailed mode does not wrap a process. Its last tool-call or hosted-search
- row of the last activity group starts expanded; earlier tool details stay
- collapsed. Compact completed process areas collapse unless a click, keyboard
- activation or search reveal has taken ownership. Tool details keep their
- individual controls. Failed tool calls open an unclaimed active process so
- their errors stay visible even in compact mode.
-- Compact thinking mode shows only a status indicator while reasoning streams;
- when answer text starts or reasoning ends, the thought row disappears. Tools
- and progress text remain accessible, and a completed thinking-only process
- leaves no header. Neither mode changes stored reasoning.
-- A failed row is invocation-local truth and remains visible immediately. The
- containing group reports processing duration only and settles as processed,
- even when a later call recovers. Terminal turn failure is derived only from
- the terminal agent event and appears through either the assistant error or
- TurnOutcomeCard surface, plus sidebar state and notification surfaces.
-- Expanding the processing group reveals the ordered rows; each row retains its
- own nested disclosure for output and input.
-- Activating the row reveals clamped output first and raw input second.
-- Each section scrolls internally and exposes its own copy action.
-- The disclosure chevron rotates on expansion. Reduced-motion disables
- non-essential running-marker pulse and rotation animation.
+- Tool activity starts as a lightweight collapsed item row. Failed and denied
+ calls keep their issue in the row header and do not auto-expand their payload.
+- Both modes give each loaded assistant turn one whole-process disclosure. It
+ contains thinking, tools, hosted searches and intermediate progress text; the
+ trailing answer, assistant errors and stopped trailing text remain outside it.
+- A contiguous activity segment receives a group disclosure only when it has at
+ least two mode-visible items. Progress text ends the segment, a singleton uses
+ its item disclosure directly, and compact-hidden thinking does not create a
+ redundant group. Existing Task topology remains separate.
+- Detailed starts active and completed whole processes open. Its active ordinary
+ group starts open and closes when it completes only if untouched; completed
+ groups otherwise start closed. Compact starts the process and groups closed,
+ except an untouched active process with any recorded failed/denied tool remains
+ open through recovery and closes on completion.
+- In Detailed, leaf auto-open applies only when the literal final item of the last
+ activity group is an eligible tool-call or hosted-search row. Failed/denied
+ items stay closed, and a final thinking item never causes a backward scan.
+ Compact keeps every item payload closed and hides reasoning text/excerpts while
+ retaining its active thinking indicator.
+- Activating a process, group or item header toggles only that level. Closing a
+ parent preserves child state, reopening restores it, and sibling groups remain
+ independent. Opening a parent is never an expand-all action.
+- A manual item action claims its group and process as user-owned without toggling
+ them. Streaming and completion cannot reopen a manual close or close around
+ content the user opened, focused or selected. Choices survive mode changes,
+ singleton-to-group growth and remounts while the retained session pane lives.
+- Search/navigation opens only the precise process -> group -> item ancestor path
+ required for the target, once per reveal request. Compact reasoning requires an
+ explicit switch to Detailed. Closing search does not collapse the revealed path.
+- Pending permission, question, plan/goal approval and other action cards remain
+ reachable outside hidden process content.
+- Each disclosure uses its own button, `aria-expanded` and `aria-controls`; closed
+ descendants leave the tab and accessibility order. Reduced-motion disables
+ non-essential marker and chevron animation.
### 4.3 Tool result truncation
@@ -1301,19 +1307,19 @@ Project drag/drop follows these patterns:
a multi-line draft: the bottom reserve is padding on the transcript content, so
the content is observed on its border box and the newest turn moves up with
the composer instead of sliding behind it (D287).
-- A manual disclosure — a tool, thinking or activity title, a delegate's brief
- toggle, or an error-detail toggle — holds the reading position of the scroller
- that owns it (issue #324). The title is handed to that scroller before the
- expansion state changes, follow mode is left, and the scroller restores the
- title's viewport offset from its own resize observer for every frame of the
- height change, so an animated activity group cannot drag the clicked title out
- of view. A scroller nested inside another one (the delegate run dock, D302)
- holds its own position and passes the hold outward, because growing it grows
- the outer content too.
-- Leaving follow for a disclosure is not a re-pin: after a toggle the transcript
- stays where the reader put it, with the jump-to-latest control visible, until
- real scroll input, that control, a new turn or a navigation releases the hold.
- There is no delayed "take the bottom back" correction (D430).
+- A manual disclosure — whole process, activity group, tool/search/thinking item,
+ delegate brief, or error detail — holds the reading position of the scroller
+ that owns it (issue #324). Only the initiating level claims the anchor; marking
+ ancestors user-owned does not claim their scroll positions. The title is handed
+ to the scroller before the state changes, follow mode is left, and the scroller
+ restores the title's viewport offset for every frame of the height change. A
+ nested scroller (the delegate run dock, D302) holds its own position and passes
+ the hold outward because growing it also grows the outer content.
+- Closing a parent does not reset a retained child's disclosure or reading state.
+ Search reveal opens the required ancestors and uses the precise target as the
+ final anchor. Leaving follow for any disclosure is not a re-pin: the transcript
+ stays where the reader put it, with jump-to-latest visible, until real scroll
+ input, that control, a new turn or navigation releases the hold (D430).
- Scroll input is attributed to the scroller that can consume it. A press on a
row, a control or an editable field is an ordinary click rather than the start
of a scroll; a keystroke inside a text field belongs to that field; and input a
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 29d07c29e..0dbdfd2cc 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -2140,45 +2140,41 @@ identify the platform validation still needed.
- **Milestone**: M5
- **Status**: Unit-covered (`settings-responsive-layout.test.mjs`); scenario Documented
-#### E2E-040: Codex-style tool activity survives transcript reload
-- **Preconditions**: Provider configured; project open; a session can run a
- successful tool and a failing or aborted tool.
-- **Steps**: 1) Run representative read, search, edit, and command tools. 2)
- While the turn is active, inspect the latest processing group and its latest
- tool/thinking row. 3) Confirm the group header retains its localized
- processing label, elapsed time, and step count while live activity remains
- in the rows or dedicated runtime indicator. 4) Wait for completion and inspect
- the settled transcript. 5)
- Manually expand a completed group and row, then copy its output. 6) While a
- later turn is streaming, manually collapse its active group and verify that
- new stream updates do not reopen it. 7) Click the vertical rule beside an
- expanded row, then keyboard-focus and activate the processing group's
- vertical rule. 8) Reload the session and expand the restored group.
-- **Expected**: The latest active group opens automatically so the process list
- is visible. Compact tool-call details, including failed tool details, remain
- collapsed. In detailed mode the last tool-call of the last activity group
- starts expanded and earlier rows stay collapsed. The latest thinking step
- opens automatically while it streams; older groups and rows remain collapsed.
- The header shows its localized processing label, elapsed time, and step count
- without an additional status capsule. When the turn settles, the automatic
- thinking disclosure closes, while a group or row touched by the user keeps
- its chosen state. A user-expanded tool call keeps its detail heading and
- content aligned with the tool row rather than introducing another horizontal
- indent; the collapse rail remains usable beside the body. Expanded calls use
- transparent semantic activity rows with an action icon, natural-language verb,
- monospace primary argument, and quiet disclosure. The processing group uses
- the full assistant-column width, so a short label or payload does not shrink
- expanded details into a content-sized chip. Each expanded-content vertical rule
- is a pointer and keyboard-focusable collapse control for its owning disclosure.
- Nested expansion shows output before raw input in clamped scroll regions. Live
- partial output updates in place. Reloaded rows preserve the tool name,
- arguments, result, and status.
+#### E2E-040: Nested tool activity survives transcript reload
+- **Preconditions**: Provider configured; project open; a turn can contain
+ progress text, multiple search/tool/thinking items, and a failed or denied tool.
+- **Steps**: 1) In Detailed, stream progress paragraph A, a multi-item search
+ segment, progress paragraph B, and a multi-item command segment. 2) Inspect the
+ open whole process and active group; manually close the active group while more
+ output arrives. 3) Complete the turn and inspect untouched versus user-owned
+ groups. 4) Open one completed group and one item, copy its output, close and
+ reopen the group, then open a sibling group independently. 5) Repeat with a
+ singleton item and with the last activity group's literal final item set to a
+ tool/search, thinking, failed tool, and denied tool. 6) Switch to Compact and
+ inspect the active-thinking, failure/recovery and completed states. 7) Remount
+ rows within the retained pane, then reload the renderer and reopen the session.
+- **Expected**: Both modes use one whole-process disclosure and keep the trailing
+ answer outside it. Detailed keeps active and completed processes open; the
+ active multi-item group opens, then closes on completion only if untouched.
+ Compact starts processes/groups and all payloads closed, hides reasoning text,
+ and keeps an untouched active process open after a failed/denied tool through
+ later recovery. A singleton has no group wrapper. Detailed auto-opens a payload
+ only when the literal final item of the last activity group is an eligible
+ tool/search; it never scans backward past thinking, and failure/denial guards
+ keep that leaf closed. Parent, child and sibling choices are independent;
+ closing/reopening a parent preserves descendants, and streaming/completion does
+ not override user-owned choices. Retained-pane remounts preserve choices;
+ renderer restart reapplies defaults while tool names, arguments, results and
+ statuses remain restored. Group/process headers show bounded running and issue
+ summaries without marking the whole turn failed.
- **Specs linked**: `04-ux/01-ui-ia.md`,
`04-ux/07-ui-design-system.md`, `04-ux/08-component-spec.md`,
`04-ux/09-interaction-patterns.md`
- **Acceptance**: C (chat stream), E (tools), F (persistence)
- **Milestone**: M3
-- **Status**: Draft
+- **Status**: Draft. For the 2026-09-20 nested-disclosure change, this scenario is
+ intended behavior for static source/design review only; no unit, component,
+ integration, browser, Electron or E2E test is added or run by that scoped task.
#### E2E-041: Conversation minimap navigates long transcripts
@@ -13715,26 +13711,32 @@ plugin-form fixtures in an isolated temporary directory at runtime.
### E2E-CHAT-turn-process-and-thinking-display
-- **Preconditions:** A turn with thinking, multiple tools, intermediate progress
- and a final answer; detailed and compact display modes.
-- **Steps:** Stream the turn; finish it; expand/collapse its process; search an
- intermediate message; switch display modes through Settings → AI → Defaults.
- Repeat with a stopped partial answer, an assistant error and a failed tool.
-- **Expected:** In detailed mode, thinking, tools and intermediate text stay
- in place with no process wrapper, and the last tool-call of the last activity
- group starts expanded. Compact mode keeps that process collapsed
- until expanded, with tool payloads collapsed. Manual choices survive updates; search reveals its target; live answer text
- stays readable. Errors and stopped trailing text stay visible. Compact mode
- exposes no reasoning text or excerpt, shows a live indicator, and leaves no
- completed thinking-only header. Tools and progress remain accessible. Switching
- to detailed restores reasoning from unchanged messages. Saved mode survives
- application restart; an older settings blob without the field uses detailed.
-- **Automation:** `test:e2e:transcript` covers the mounted renderer interactions,
- settings control and unchanged-group performance. `test:e2e:transcript-disclosure`
- covers scroll anchoring; `test:e2e:theme-surfaces` covers the shared theme
- controls. Isolated Host `settings.set/get` checks verify both modes across
- process restart and preservation during unrelated partial settings writes.
- Renderer fixtures alone do not prove settings persistence.
+- **Preconditions:** A turn with progress paragraph A, multiple searches plus
+ thinking, progress paragraph B, multiple commands plus thinking, and a final
+ answer; Detailed and Compact display modes; precise transcript search targets.
+- **Steps:** Review the nested disclosure path in Detailed, including independent
+ group/item toggles, parent close/reopen, a singleton segment, literal-final-item
+ leaf selection, failure/denial/recovery, retained-pane remounts and a precise
+ search reveal. Repeat in Compact and with permission/question/plan/goal action
+ cards, a stopped partial answer, an assistant error and delegated child work.
+- **Expected:** Both modes use one whole-process disclosure and leave the final
+ answer, assistant errors, stopped trailing text and pending actions outside it.
+ Detailed starts active/completed processes open; the active multi-item group is
+ open and an untouched group closes on completion. Compact starts processes and
+ groups closed, hides reasoning, and keeps payloads closed; an untouched active
+ process with a recorded failed/denied tool stays open through recovery and closes
+ on completion. Singletons have no group. Detailed auto-opens only an eligible
+ literal final tool/search item of the last activity group; it does not scan past
+ thinking, and failed/denied leaves stay closed. Parent/child/sibling states remain
+ independent, pane-owned user choices survive updates, mode changes and remounts,
+ and renderer restart reapplies defaults. Search opens only the precise process ->
+ group -> item or Task-panel path once per request; Compact reasoning requires an
+ explicit switch to Detailed. Saved mode survives restart and a missing/unknown
+ setting resolves to Detailed.
+- **Validation scope for the 2026-09-20 change:** Intended behavior for static
+ source/design review only. The scoped task adds or runs no unit, component,
+ integration, runtime, browser, Electron or E2E tests; existing automation names
+ elsewhere in this plan are prior inventory, not evidence that this change ran.
- **Specs:** 04-ux/06-settings-ia, 04-ux/08-component-spec,
04-ux/09-interaction-patterns; ADR turn-process-and-thinking-display.
diff --git a/docs/superpowers/specs/2026-09-20-nested-thinking-process-disclosure-design.md b/docs/superpowers/specs/2026-09-20-nested-thinking-process-disclosure-design.md
new file mode 100644
index 000000000..8ef9d3413
--- /dev/null
+++ b/docs/superpowers/specs/2026-09-20-nested-thinking-process-disclosure-design.md
@@ -0,0 +1,331 @@
+# Nested Thinking and Tool Process Disclosure
+
+## Status and scope
+
+- Status: Proposed for review; implementation is not authorized by this document.
+- Date: 2026-09-20.
+- Branch: `feat/thinking-process-collapse`, directly in the project checkout as requested.
+- Inspected baseline: `aad46adb` (local `main` and cached `origin/main` at intake). Fetching remote `main` failed with SSH `Permission denied (publickey)`; this proposal does not claim verification against the latest remote revision.
+- Deliverable: interaction design, implementation boundaries, and acceptance criteria only. No runtime, UI, settings, or accepted specification changes are included.
+- Validation scope, per the user's explicit instruction: static checks and compilation only. Runtime tests are not required for this proposal or its implementation; section 8 defines the scoped validation commands.
+- Reference: the three screenshots supplied with the request. They demonstrate whole-process and command-group disclosure; they do not establish Codex's live defaults, persistence rules, or internal implementation. Those details below are PI-Desktop design decisions.
+
+## 1. Problem and verified current behavior
+
+In the supplied PI-Desktop screenshot, consecutive search/tool and thinking rows remain visible between assistant progress paragraphs. Users can inspect individual details, but cannot collapse the entire block of rows as one unit in detailed mode. A long operation therefore makes progress narration and the final answer harder to scan.
+
+The gap is at the container levels, not an absence of all disclosure controls:
+
+| Surface | Verified implementation | Consequence |
+| --- | --- | --- |
+| Whole process | `shouldGroupTurnProcess()` returns true only for compact mode | Detailed mode has no whole-process disclosure |
+| Ordinary activity group | `AssistantTurn` passes `embedded`; `ActivityGroup` returns rows directly for embedded groups without subagents | There is no group header to hide a cluster of tool/thinking rows |
+| Individual tool/search/thinking | `ToolRow`, `HostedSearchRow`, and `ThinkingRow` already have disclosure behavior | Preserve these controls and their payload rendering |
+| Automatic opening | Only the literal final item of the last activity group receives the tool/search auto-open flag; failed/denied tools suppress it. If that final item is thinking, no earlier tool is selected instead | Preserve this positional rule; nesting must not open every payload |
+| User ownership | `useAutomaticDisclosure()` stops automatic changes after manual interaction for that component's lifetime | Preserve and extend this principle across ancestors |
+| Existing specification | The accepted turn-process ADR explicitly says detailed mode does not wrap a process | This proposal intentionally changes that presentation decision; it is not an already-approved contract |
+
+Source references are listed in section 10. Findings are based on source and test inspection; the running desktop was not used to reproduce the screenshots.
+
+## 2. Recommended interaction model
+
+Use three independent disclosure levels:
+
+1. **Turn process:** all process content belonging to one existing assistant-turn entry, with a duration/status header. The trailing response and assistant errors remain outside it.
+2. **Activity group:** one contiguous segment of tools, provider-hosted searches, and reasoning rows between assistant progress paragraphs. Collapsing it hides all its item headers and details, leaving one summary row.
+3. **Item details:** the existing tool arguments/results, command output, search results, or reasoning text for one item.
+
+Progress narration remains between groups within the turn process. Users can read the explanation with execution details folded away, expand one group, then inspect one result. Closing the outer process hides the complete process with one action.
+
+“Process” is a UI umbrella term. Provider reasoning, assistant progress text, tool execution, and the final answer remain distinct data and are not merged into one reasoning field.
+
+### Example: the user's search sequence
+
+Fully collapsed process:
+
+```text
+> Processed for 9m 36s · 4 tools
+
+The final answer remains visible here.
+```
+
+Process expanded, activity groups collapsed:
+
+```text
+v Processed for 9m 36s · 4 tools
+ I will locate the compression threshold and its defaults.
+
+ > Searched code · 2 searches · includes thinking
+
+ I found the core file and will inspect its defaults.
+
+ > Searched code · 2 searches · includes thinking
+
+The final answer remains visible here.
+```
+
+One activity group expanded, followed by an explicit click to expand one search item:
+
+```text
+v Processed for 9m 36s · 4 tools
+ I will locate the compression threshold and its defaults.
+
+ v Searched code · 2 searches · includes thinking
+ > Search (compact|compress).*threshold
+ v Search autoCompact|auto_compact
+ Search arguments and results...
+ > Thinking Inspect the shared context settings...
+
+ I found the core file and will inspect its defaults.
+ > Searched code · 2 searches · includes thinking
+
+The final answer remains visible here.
+```
+
+The “includes thinking” text illustrates the mixed content in the screenshot. It may be omitted when space is tight, but the accessible group name must describe the content accurately. The same structure uses “Ran 5 commands” for a command-only group.
+
+### Grouping rules
+
+- Reuse existing `AssistantTurnPart` activity boundaries and item order. Do not infer phases from natural-language headings, elapsed-time thresholds, or tool names.
+- Assistant progress text ends an activity group. Do not combine groups across progress paragraphs merely because they run the same tool.
+- Thinking may remain in the same activity group as adjacent tools, matching the user's red-box examples. A thinking row alone is a direct item disclosure; avoid an empty extra group layer.
+- A single ordinary tool/search item also uses its item disclosure directly. A group header is useful for two or more visible items. Hidden compact-mode thinking does not create an otherwise redundant group.
+- When a live singleton grows into a group, retain its item identity and any manual choice. A manually opened item makes the new group open and user-owned, so newly introduced nesting does not hide content being read.
+- Keep existing Task topology boundaries. Do not fold parent tools into a subagent's work or duplicate subagent rows in an ordinary activity group. The existing topology card serves as that segment's second-level container. Keep its detail-panel presentation; extend navigation into that existing panel as specified in section 5.
+- User/system messages and compaction dividers keep their existing turn boundaries. Only loaded history is grouped; no reconstruction of unloaded turns is implied.
+
+## 3. Default states and manual ownership
+
+The setting remains `thinkingDisplayMode: detailed | compact`, with absent/unknown values resolving to detailed. No additional settings are needed.
+
+The table describes untouched controls. Explicit user choices override these defaults.
+
+| Level | Detailed: active | Detailed: completed/history | Compact |
+| --- | --- | --- | --- |
+| Whole process | Open | Open | Closed, except an untouched active turn containing any recorded failed/denied tool remains open, even after later successful tools |
+| Ordinary activity group | Open while it owns the active execution segment | Closed | Closed |
+| Tool/search payload | Preserve the literal-last-item rule described below | Preserve that same rule inside closed ancestors | Closed |
+| Reasoning item | Keep existing live reasoning behavior | Closed | No reasoning text or excerpt; active thinking indicator only |
+| Task topology | Retain current live/manual policy | Retain current policy | Retain current policy |
+
+Detailed mode keeps completed progress narration visible by default, preserving its purpose. It gains a whole-process collapse control while completed execution groups become easier to scan. Adopting Codex-like nesting does not require silently changing detailed mode into compact mode.
+
+The preserved leaf default applies only when the literal final item of the last activity group is a tool or hosted-search row, with that row's existing failure/denial guards. It does not scan backward past a thinking item to find a tool. Opening an untouched completed group exposes its precomputed leaf defaults; it does not reset them closed. Thus a group ending in an eligible tool can reveal that tool's output immediately, while the screenshot example ending in thinking reveals only headers until an item is explicitly opened.
+
+### State transition rules
+
+- Clicking a header changes only that level. Opening a group never means “expand all descendants.” Closing a parent does not reset any child choices.
+- Opening a previously closed parent restores child states. Sibling groups remain independent; this is not an exclusive accordion.
+- A manual action on an item claims the containing group and turn as user-owned, without toggling either ancestor. Completion must not close the container around an output the user explicitly opened.
+- If a user closes an active group or the whole process, new tool calls, streaming text, retries, and completion do not reopen it. Only summary/status information changes.
+- Automatic completion may close an untouched active group. It must not close a group whose output is being selected, whose body holds keyboard focus, or whose body was explicitly interacted with. Those actions establish user ownership.
+- A tool error does not imply that the assistant turn failed. A later successful recovery does not erase the earlier tool's failure marker.
+- Show a collapsed group's running or failure summary even when its payload is hidden. If the whole process is closed, propagate the aggregate to its visible header. Do not reopen manually closed ancestors to show an error. Preserve the compact outer exception: while the turn is active, any recorded failed/denied tool keeps an untouched outer process open through later progress or successful recovery. It closes automatically on turn completion only if still untouched. Inner groups remain closed with issue counts visible; raw error output requires explicit opening. The design must account for failure -> progress -> successful tool -> turn completion, both untouched and manually closed; review this path statically.
+- No timer-based auto-collapse and no automatic “collapse everything when the answer arrives.” The default detailed process remains open unless the user closes it.
+
+### State lifetime
+
+Disclosure state belongs to the transcript presentation, keyed by session, stable turn identity, activity identity, and item identity. Do not use array indexes or localized labels as keys.
+
+The initial implementation should retain choices while the owning session pane is retained, including streaming, completion, mode changes, and row remounts within its mounted-history window. Evicting the session pane, deleting the session, or restarting the renderer releases those choices and reapplies defaults. Cross-restart persistence is out of scope.
+
+Use one authoritative pane-owned disclosure map for retained state; component-local state cannot satisfy remount and reparenting guarantees. Each node records its effective `open` value, ownership (`automatic` or `user`), and last applied reveal request. Stable item keys use message ID plus kind; hosted search adds its round ID. Group identity derives from its first unfiltered activity item. Mode filtering cannot change keys. Keep this map out of persisted messages and the central workflow store.
+
+When a singleton gains a group wrapper, reuse its item record unchanged. Create the group record from the mode default unless a manually opened or focused/selected child requires an open, user-owned group; an explicitly closed ancestor still wins. When filtering removes a redundant wrapper, retain its record for later restoration. Explicit reveal/toggle events apply in event order; automatic updates never overwrite user-owned records. Search applies only once per new request. Release records on session-pane eviction/deletion/restart and prune nodes authoritatively removed from the transcript, not nodes merely outside the mounted window.
+
+Mode switches preserve explicit choices for surviving nodes and reapply defaults only to untouched nodes. Compact still suppresses all reasoning text, regardless of a retained thinking-item open state. Switching back to detailed restores that item's choice within the retained pane.
+
+## 4. Headers, hierarchy, and status
+
+### Whole-process header
+
+Use one lightweight header with a consistent chevron, status/duration, a count, and an issue marker when necessary. Use the existing recorded timing helpers; UI clocks must not introduce persisted timing fields or invent a precise historical duration when evidence is absent.
+
+Suggested localized labels:
+
+| Meaning | English | Simplified Chinese |
+| --- | --- | --- |
+| Reasoning is currently active | Thinking for {time} | 思考中 {time} |
+| Tools or preparation are active | Processing for {time} | 处理中 {time} |
+| Process has ended | Processed for {time} | 用时 {time} |
+| Homogeneous command group | Ran {count} commands | 运行了 {count} 条命令 |
+| Homogeneous search group | Searched code · {count} searches | 搜索代码 · {count} 次 |
+| Mixed group | Tool activity · {count} tools | 工具操作 · {count} 项 |
+| Mixed group with reasoning | Includes thinking | 含思考 |
+| Group contains failure | {count} failed | {count} 项失败 |
+
+Final wording goes through existing i18n/pluralization conventions. The process count should name what it counts: tools/search rounds rather than silently including progress paragraphs under a “tools” label. Count each direct tool invocation and hosted search round once; do not double-count delegated child work. If there are no tools, omit the tool count. Detailed thinking-only processes remain collapsible; completed compact thinking-only processes leave no empty header.
+
+### Group and item headers
+
+- Derive group labels from existing action categories; use a neutral mixed label rather than calling every tool a command. Multiple reasoning-only items use a Thinking group with a reasoning-item count, never a zero-tool activity label. Compact omits completed reasoning-only groups entirely.
+- A collapsed group shows count, running state, and issue count as applicable. Live updates remain bounded to the summary row; do not print raw output or long reasoning excerpts beneath a folded group.
+- Keep command text, file/search summary, output preview links, copy actions, status and duration on item headers as currently supported. Long commands truncate in the header; full content remains available through existing detail/copy surfaces.
+- Failed, denied, cancelled and running states use text/icon distinctions, not color alone. Status aggregation must reuse existing command exit-code and delegation outcome logic; a tool transport success with a nonzero shell exit remains a failed command.
+- Preserve existing single-owner live-status selection. The new group must not add another independent “working” indicator beside the transcript's current authoritative status.
+
+### Visual treatment
+
+Use existing typography, color, radius and motion tokens with lightweight rows. Indent each container level modestly; avoid three nested cards or deep indentation that consumes command-output width. Keep chevrons visible at rest, pointing right when closed and down when open. Hover treatment supplements the chevron rather than being the only discovery cue.
+
+Each header and optional collapse rail controls its own container. Nested CSS selectors must be scoped to direct children so opening the outer process does not rotate every inner chevron or expand every descendant body. Expanded output may retain its existing bounded scrolling; do not add a second scrollable container for ordinary groups.
+
+On narrow windows, preserve status and disclosure controls; truncate optional summaries first. Cover light, dark, and plugin themes and reduced-motion preferences using existing tokens.
+
+## 5. Search, accessibility, and reading position
+
+### Search and navigation
+
+For an existing search/navigation target, reveal the ancestor path needed to expose it: turn, containing group, then item detail when the target is in that detail. The current renderer `TranscriptSearchTarget` carries only `messageId`, which cannot distinguish thinking, response text and multiple hosted-search rounds. Add a renderer-local target descriptor with item kind (`message`, `thinking`, `tool`, `hostedSearch`), message ID, hosted-search round ID where applicable, and the owning Task/delegation identity for delegated children. Preserve the current session/query/request fields. Existing message-only search results continue to target message content; a more precise kind is supplied only when the navigation source can identify that surface. Do not invent a target from an ambiguous message ID or change host indexing as part of this design.
+
+Give each target a stable item DOM anchor using the same item identity as disclosure state, rather than selecting the first matching message ID. Apply the reveal request to its ancestor path, await the React commit and target registration in the owning scroll surface, then highlight/focus/anchor it. Use layout/registration synchronization rather than a fixed delay. A newer request, session change or pane disposal invalidates outstanding focus work.
+
+For a delegated-child target, reveal the owning Task topology and select the existing subagent detail panel; do not introduce an additional inline Task rendering. Resolve the latest owning Task in a resumed delegation chain, then reveal the child's item inside the panel and focus it through the panel's own scroll owner. Extend the panel's reveal input and item anchors for this purpose. If the owning Task or child cannot be loaded through existing navigation, report that the target is unavailable rather than focusing an unrelated main-turn row.
+
+A new explicit reveal request may override a previous manual close. Re-rendering the same request must not repeatedly force-open a node after the user closes it. Closing search does not collapse the path automatically.
+
+This proposal does not expand search indexing scope. Compact-mode reasoning remains hidden: a reasoning-only target should offer the existing mode switch to detailed rather than silently revealing text or changing the saved setting. If the target is not loaded, use existing history loading before resolving the disclosure path.
+
+### Keyboard and assistive technology
+
+- Use real buttons for disclosure headers with `aria-expanded`, stable `aria-controls`, localized names and visible focus treatment. Enter and Space toggle only the focused header.
+- Closed descendants are hidden/inert or unmounted, excluded from tab order and accessibility traversal. Do not nest buttons inside buttons.
+- Copy, file-preview and link actions do not bubble into a parent toggle. Text selection does not toggle a disclosure.
+- Before hiding content that contains focus, move focus to its visible controlling header. If an ancestor is also closing, focus the nearest remaining visible ancestor header.
+- Announce material status changes politely through the existing status owner; do not announce every token or every elapsed second.
+- Collapse rails must have distinct accessible labels, such as “Collapse tool group” and “Collapse command output.” They supplement the header control.
+
+### Scroll ownership
+
+Preserve the existing disclosure anchor mechanism. Capture the clicked level's header and viewport offset before changing height, and keep that header stable through layout/animation. Only the initiating disclosure claims the scroll anchor; claiming ancestors for manual ownership must not also claim their scroll positions.
+
+If the user has scrolled away from the bottom, expanding/collapsing does not jump to the latest output. Stream-follow resumes only through existing follow/jump behavior. Opening ancestors for search uses the search target as its final anchor. Parent visibility changes do not reset a retained child output's reading position.
+
+## 6. Responses, errors, and actionable content
+
+Reuse `projectTurnProcess()` semantics: the trailing assistant text is provisionally visible outside the process while streaming. If later activity proves it was progress, move it into the process in original order. Do not infer a final answer from its wording. Preserve its identity and reading anchor during reclassification, and do not reopen a manually closed process.
+
+Assistant errors and stopped trailing partial answers remain visible outside the process. Keep user messages, permission requests, ask/question interactions, plan/goal approval surfaces and outcome cards reachable according to their existing ownership. Never make a pending decision accessible only by expanding a hidden ancestor.
+
+Review/change cards need an explicit placement check during implementation: completed informational cards may remain with their tool, while any card requiring a user action must have an always-reachable existing action surface. Do not duplicate approval controls or change their execution semantics to solve visibility.
+
+Parent process collapse does not close an already-open subagent detail panel or cancel work. Folding is purely presentational: no effect on tool execution, permissions, retries, cancellation, stored reasoning, context use, export or copy payloads.
+
+## 7. Implementation outline and compatibility
+
+This is a renderer presentation change. No new dependency, host API, database migration, provider protocol change, or settings enum is needed for the proposed core behavior.
+
+| Area | Proposed work |
+| --- | --- |
+| `lib/turn-process.ts` | Enable the process container in both modes; separate container availability from mode-specific defaults and visible-item counts; preserve response projection |
+| `AssistantTurn.tsx` | Compose one process plus responses; retain stable identities and existing delegation status ownership |
+| `ActivityGroup.tsx` | Restore ordinary group disclosure when there are multiple visible items; preserve singleton and topology treatments; keep presentation logic separate from delegation/runtime status |
+| `shared.tsx` / disclosure hook | Preserve manual ownership, add precise ancestor claiming and any necessary pane-owned state; keep scroll anchoring under its current owner |
+| `ToolRow.tsx`, `HostedSearchRow.tsx`, `ThinkingRow` | Reuse item rendering; connect precise reveal paths and retained item states without duplicating payload logic |
+| Transcript pane/search integration | Scope state lifecycle and reveal identity; retain existing loading and live-status authority |
+| `styles/messages.css`, i18n | Add scoped nested-container styles, meaningful localized headers and accessible names |
+
+Do not add all new state and policy to the already-large transcript components. Extract only the directly required pure grouping/default-state logic or disclosure hook. Avoid a generic arbitrary-depth tree framework: the product needs the three levels defined here and the existing subagent panel.
+
+Implementation sequence after design agreement:
+
+1. Review the current source against the screenshot sequence and singleton, compact, error and delegation behavior requirements.
+2. Implement deterministic container/default rules and stable disclosure identities; review pure logic and state transitions statically.
+3. Wire both modes to the outer process and restore ordinary activity groups, preserving existing item details and user actions.
+4. Statically review interaction paths, search, focus, scrolling and stream updates; complete the compilation and static checks listed in section 8.
+5. Update the accepted turn-process ADR, directly affected UX specs, translations and release notes in the implementation change. Synchronize existing scenario documentation only where necessary to avoid contradicting the new behavior; this does not require adding or running runtime tests.
+
+The current proposal does not overwrite accepted specs to make them claim that the feature already exists. The following documents need coordinated updates when implemented:
+
+- `docs/adr/turn-process-and-thinking-display.md`: revise the “detailed does not wrap a process” decision and explain compatibility/default choices.
+- `docs/spec/04-ux/08-component-spec.md`: hierarchy, defaults, state lifetime and headers.
+- `docs/spec/04-ux/09-interaction-patterns.md`: nested disclosure, search reveal, focus and scroll rules.
+- `docs/spec/04-ux/06-settings-ia.md`: update the descriptions of Detailed/Compact without adding settings.
+- `docs/spec/06-delivery/04-e2e-test-plan.md`: if existing scenario descriptions contradict the new behavior, synchronize their text and record this task's static-only validation scope. This is documentation alignment, not a requirement to add or execute E2E tests.
+- Corresponding documentation translations and user-facing release notes.
+
+## 8. Acceptance and validation
+
+Per the user's explicit instruction, acceptance for this task and its implementation is limited to static checks and compilation. The user path and edge cases below define intended product behavior for source/design review; they are not executable test requirements or a manual runtime test checklist. Do not add or run unit, mounted-component, integration, browser, Electron or E2E tests for this task, and do not start or attach to a desktop instance for validation.
+
+### Representative user path
+
+Given a detailed-mode turn containing progress paragraph A, two searches plus thinking, progress paragraph B, two commands plus thinking, and a final response:
+
+1. Both progress paragraphs and the final response are readable with completed groups collapsed.
+2. Open the search group: only that group's item headers appear.
+3. Open one search result: only its details appear; its siblings remain closed.
+4. Close and reopen the group: the selected search result retains its state.
+5. Open the command group independently; copy its command without collapsing any level.
+6. Close the whole process: all progress/groups disappear; the final response stays visible.
+7. Reopen the process: both groups and item choices are restored.
+8. The clicked header remains at its reading position throughout manual toggles.
+
+### Edge cases for static design review
+
+| Scenario | Expected result |
+| --- | --- |
+| Active group manually closed, then more tools/results arrive | Stays closed; count/status updates |
+| Item manually opened, then group/turn completes | Ancestors stay open; item state retained |
+| Untouched active group ends | May close according to defaults; never hides focused/selected content |
+| Singleton becomes a multi-item group | No loss of manual state, duplicated payload, or hidden focused item |
+| Completed history in detailed mode | Outer process open; ordinary groups closed; item defaults preserved inside |
+| Parent closed while a child is open | Child state and reading position retained |
+| Detailed → compact → detailed | Reasoning absent in compact; explicit choices restored for surviving nodes |
+| Failure, denial, nonzero exit, cancellation or recovery | Accurate item/group status; no false whole-turn failure |
+| Permission/question/proposal pending | Actionable surface remains reachable with process closed |
+| Pure reasoning / pure answer / tools without answer | No redundant or empty compact containers; available details remain inspectable |
+| Search targets progress vs tool output vs hosted search | Only required ancestors open; target is unambiguous and visible |
+| Same search request rerenders after manual close | No repeated forced reopening |
+| Retained pane switch / history row remount / pane eviction | Choices retained within pane lifetime; eviction resets deliberately |
+| Delegations and later parent tools | Existing topology ownership preserved; no duplicate or misleading nesting |
+| Narrow window, themes, keyboard, reduced motion | Controls usable; focus and status readable; no ancestor CSS leakage |
+| Repeated streaming in a long transcript | Unchanged historical groups retain memoized boundaries; hidden payloads are not eagerly formatted |
+
+### Static and compilation checks
+
+After implementation, run the existing static/build commands applicable to the changed renderer surface:
+
+```bash
+pnpm build:js
+pnpm --filter @pi-desktop/desktop typecheck
+pnpm lint
+pnpm docs:check
+git diff --check
+```
+
+Review the diff for stable disclosure identities, state ownership, ancestor visibility, search-target wiring, i18n keys and scoped CSS selectors. Existing runtime-test sources may be read as evidence of prior behavior; this does not authorize running them or require expanding them.
+
+For this document-only change, check local references, encoding, whitespace and document consistency; application compilation is deferred until implementation changes application code. Report only commands actually executed. Static checks and compilation do not prove runtime scrolling, focus, streaming or visual behavior, so do not report those paths as runtime-validated.
+
+## 9. Alternatives and decisions to review
+
+| Alternative | Assessment |
+| --- | --- |
+| Only expose ordinary activity-group headers | Fixes the red-box symptom, but leaves detailed mode without the requested whole-process collapse |
+| Add only a whole-process wrapper | Lets users hide everything, but cannot retain progress narration while hiding one execution block |
+| Collapse completed whole processes by default in detailed mode | Reduces height further, but hides progress narration and makes Detailed/Compact less distinct; not recommended for the initial change |
+| Always add all three levels, even for one item | Creates redundant clicks and repeated labels; use singleton elision with retained item state |
+| Persist every disclosure to the host | Adds storage and lifecycle complexity without a requirement; retain pane-lifetime state only |
+
+Recommended review baseline: adopt all three independent levels, keep detailed process narration open by default, fold completed ordinary groups, and retain the current leaf-detail defaults. Do not add expand-all actions or new preferences until actual use demonstrates a need.
+
+## 10. Inspected source and existing contracts
+
+Paths are relative to this proposal. They describe the inspected baseline, not future guarantees.
+
+- [Turn process projection and defaults](../../../apps/desktop/src/lib/turn-process.ts)
+- [Assistant turn and activity grouping](../../../apps/desktop/src/lib/assistant-turns.ts)
+- `apps/desktop/src/features/chat/transcript/AssistantTurn.tsx` — AssistantTurn composition
+- `apps/desktop/src/features/chat/transcript/TurnProcess.tsx` — TurnProcess container
+- `apps/desktop/src/features/chat/transcript/ActivityGroup.tsx` — ActivityGroup and embedded behavior
+- `apps/desktop/src/features/chat/transcript/ToolRow.tsx` — ToolRow disclosure and command outcome
+- `apps/desktop/src/features/chat/transcript/HostedSearchRow.tsx` — HostedSearchRow
+- `apps/desktop/src/features/chat/transcript/shared.tsx` — Disclosure ownership and ThinkingRow
+- [Transcript scroll owner](../../../apps/desktop/src/features/chat/transcript/hooks/useTranscriptScroll.ts)
+- `scripts/e2e/turn-process.tsx` — Current turn-process interaction probe
+- `scripts/e2e/transcript-disclosure-anchor.tsx` — Disclosure anchoring probe
+- [Accepted turn-process ADR](../../adr/turn-process-and-thinking-display.md)
+- [Transcript reading ownership ADR](../../adr/transcript-reading-ownership.md)
+- [Component specification](../../spec/04-ux/08-component-spec.md)
+- [Interaction specification](../../spec/04-ux/09-interaction-patterns.md)
diff --git a/docs/zh-CN/adr/index.md b/docs/zh-CN/adr/index.md
index 5a0a40ac2..3dba8e84d 100644
--- a/docs/zh-CN/adr/index.md
+++ b/docs/zh-CN/adr/index.md
@@ -294,7 +294,7 @@ ADR 记录那些不应被静默改变的架构选择。中文入口与英文索
| 0283 | [远程 MCP 服务端 OAuth 2.1 认证](/adr/0283-remote-mcp-oauth) | 已接受 |
| 0284 | [`packages/host-runtime` 的无头运行时边界](/adr/0284-headless-runtime-boundary) | 已接受(实施中)(D447;ADR 0205 R2 前置) |
| 0285 | [`packages/racp` 的 `RACP-WS` 传输](/adr/0285-racp-ws-transport) | 已接受(实施中)(D448;ADR 0205 R2) |
-| turn-process-and-thinking-display | [回合过程与思考展示](/adr/turn-process-and-thinking-display) | 已接受 |
+| turn-process-and-thinking-display | [回合过程与思考展示](/zh-CN/adr/turn-process-and-thinking-display) | 已接受(2026-09-20 修订) |
| 0289 | [签名的 macOS GitHub Release 与应用内更新](/adr/0289-signed-macos-github-releases) | 已接受(D450;修订 ADR 0022 / 0145 / 0191 / 0204 / D078) |
| 0290 | [恢复可拖拽侧边栏宽度,过窄时收起](/adr/0290-resizable-sidebar-collapse-threshold) | 已接受(D459;修订 ADR 0141 / ADR 0238) |
| 0291 | [移除设置页面的语音界面](/adr/0291-remove-speech-settings-ui) | 已接受(修订 ADR 0281) |
diff --git a/docs/zh-CN/adr/turn-process-and-thinking-display.md b/docs/zh-CN/adr/turn-process-and-thinking-display.md
new file mode 100644
index 000000000..24e0172d0
--- /dev/null
+++ b/docs/zh-CN/adr/turn-process-and-thinking-display.md
@@ -0,0 +1,74 @@
+# ADR turn-process-and-thinking-display:回合过程与思考展示
+
+> [英文源 ADR](/adr/turn-process-and-thinking-display) 是状态与决策内容的最终依据。
+
+- 状态:已接受
+- 日期:2026-09-17
+- 修订:2026-09-20
+- Issues:#510、#461
+- 修订对象:D071、[ADR 0242](/adr/0242-delta-only-streaming-updates)
+
+## 背景
+
+模型在回答一次用户请求之前,可能多次交替输出推理、工具调用和进度文字。仅使用分散
+的活动组,会让进度文字与最终回答处于同一视觉层级;仅使用一个扁平的过程容器,又会
+让较长的工具或搜索序列难以浏览。部分用户还需要稳定的思考状态提示,而不是快速变化
+的推理正文。
+
+## 决策
+
+两种显示模式都把每个已加载的助手回合条目投影为一个“回合过程”披露区和其后的最终
+回答。思考、工具和中间进度文字按原顺序保留在过程中。流式输出时,暂定为回答的末尾
+助手文字保持可见;如果随后出现工具或思考活动,该文字会移入过程,但不会改写已存
+消息。`UiMessage` 没有语义化的最终回答标记,因此渲染器不根据措辞猜测。用户消息、
+系统消息和压缩分隔线继续保留原有回合边界。
+
+过程包含三个相互独立的披露层级:整个回合过程、普通活动组和单项详情。普通活动组
+包含两个进度段落之间的一段连续工具、搜索或思考活动,并且仅在当前模式下至少有两个
+可见项时出现。单个工具、搜索或思考直接使用自身披露;紧凑模式隐藏的思考不会制造
+多余的组层级。现有 Task 拓扑仍是其片段的容器,不会在普通活动组中重复渲染。
+
+详细模式下,活动中和已完成的整个过程默认展开。拥有当前执行片段的普通活动组在运行
+时默认展开;完成时仅在用户未操作的情况下自动收起。其他已完成的普通活动组默认
+收起。紧凑模式下,过程和普通活动组默认收起;但活动回合中只要记录过失败或被拒工具,
+尚未被用户接管的外层过程会在后续恢复期间保持展开,并在回合完成后自动收起。紧凑
+模式下所有工具和搜索载荷默认收起,不渲染推理正文或摘要,仅保留活动思考指示器,且
+不会留下空的已完成纯思考容器。
+
+详细模式仅为最后一个活动组的字面最后一项保留叶子默认值。如果该项是符合条件的工具
+调用或托管搜索,其载荷默认展开;失败和被拒项仍受保护并保持收起。若最后一项是思考,
+渲染器不会向前寻找并打开更早的工具。打开一个已收起的祖先只会恢复已保留的叶子状态,
+不会展开所有后代。
+
+每个标题只切换自己的层级。父子状态彼此独立:收起父级会保留后代选择,重新展开会恢复
+这些选择,同级组不是互斥手风琴。用户操作某个条目时,会把所属组和过程标记为用户接管,
+但不会切换祖先;完成事件不得收起包含用户已展开、聚焦或选择内容的容器。只要所属的
+保留会话窗格仍存在,手动选择就跨流式更新、完成、模式切换、单项变组和行重新挂载保留。
+窗格淘汰、会话删除或渲染器重启会释放这些展示状态;它们不写入消息或宿主设置。
+
+搜索和导航只展开暴露精确目标所需的祖先路径:过程、活动组,以及必要时的条目详情。
+同一请求重新渲染时,不会反复覆盖用户之后的手动收起。紧凑模式中的推理仍保持隐藏,
+直到用户选择详细模式。助手错误、中止后的末尾部分回答、权限/提问/计划/目标决策及
+其他待处理操作面必须位于隐藏过程之外,无需展开过程即可操作。
+
+“设置 -> AI -> 默认项”继续使用可选的 `thinkingDisplayMode` 设置,取值为
+`detailed | compact`;缺失或未知值按详细模式处理。该字段只改变展示,不改变提供商
+思考级别、运行时或模型上下文、已存推理、导出、权限、执行或复制载荷。过程标题使用已
+记录的计时、直接工具/搜索计数、运行状态和问题计数;不会重复计算委派子任务,也不会
+把单个失败工具误报为整个助手回合失败。
+
+## 结果
+
+- 两种模式都提供一个整个过程的披露,同时把最终回答和待处理操作保留在过程之外。
+- 详细模式默认保留进度叙述可见,收起未操作的已完成活动组,并保留字面最后一项的叶子
+ 默认值。
+- 紧凑模式仍是低细节选项:过程收起、载荷关闭、推理内容隐藏。
+- 披露记忆是以稳定回合、组和条目标识为键的窗格展示状态,不是持久化转录契约,也不
+ 属于中央工作流 store。
+- 只对已加载的转录条目分组;不会重建未加载历史,也不会跨压缩边界合并回合。
+
+## 验证
+
+2026-09-20 的修订按本次请求仅进行静态检查和编译。关联的 E2E 场景用于描述源码与设计
+审查中的预期行为;本次修订不新增或运行单元、组件、集成、浏览器、Electron 或 E2E
+测试。同步后的场景文本见 E2E-CHAT-turn-process-and-thinking-display。
diff --git a/docs/zh-CN/spec/04-ux/06-settings-ia.md b/docs/zh-CN/spec/04-ux/06-settings-ia.md
index 62e37dc71..1ac036601 100644
--- a/docs/zh-CN/spec/04-ux/06-settings-ia.md
+++ b/docs/zh-CN/spec/04-ux/06-settings-ia.md
@@ -89,7 +89,7 @@
都以相同方式展开。关闭时的触发器按当前文案收缩,不超过设置控件列。
- **默认项**卡:主机支持的默认运行模式(Agent / Plan / Goal)、
命令 Shell 选择、链接打开目标、上下文用量显示(剩余或已用)、
- 回车发送控制和大段文本粘贴阈值。链接打开目标默认使用工作面板浏览器,
+ 思考显示模式、回车发送控制和大段文本粘贴阈值。链接打开目标默认使用工作面板浏览器,
可将对话、会话记录和插件页的 HTTP(S) 点击路由到系统浏览器。插件/设置页
若目标是工作面板,会先回到对话再打开(不记入导航栈),避免被遮罩挡住;没有会话时才回退到
系统浏览器。工作区 HTML
@@ -106,6 +106,13 @@
「跟随输入框当前模型」。因此会有两行都题为「默认模型」,靠各自卡片标题区分(提示词增强 vs 模型默认项)。思考
强度行是一个菜单选择器,列出所选模型实际支持的等级(不支持时该行仍显示「关闭思考」并禁用),默认「关闭
思考」,且不提供「跟随会话」项。设置搜索会索引该卡、其开关、模板行、默认模型行与思考强度行。
+- **思考显示模式**使用菜单选择器,提供详细(默认)和紧凑。两种模式都使用一个
+ 整体过程披露。详细模式默认展开过程、显示推理、展开活动中的多项活动组,并在用户
+ 未操作时于组完成后将其收起;紧凑模式默认收起过程与活动组,保持工具/搜索载荷
+ 关闭,只显示活动思考指示器并隐藏已完成推理。单项活动在两种模式下都直接使用自身
+ 披露。全局偏好以 `thinkingDisplayMode` 持久化到宿主设置;缺失值使用详细模式。
+ 它只影响展示,不改变模型推理配置;显式披露选择在已挂载的会话窗格内保留。设置
+ 搜索会索引该行和两种模式名称。
- 语音绑定(`AppSettings.speech`)**不属于设置页面**(ADR 0291)。宿主仍保留语音能力与
`speech/*` IPC,供插件和已存绑定使用;这里不再提供转写/朗读的服务、协议、模型或音色
选择,设置搜索也不再索引语音相关键。
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 7295f9843..5a2e69d41 100644
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@ -1012,6 +1012,38 @@ SESSIONS [msg+][↕]
由工具调用分隔的提供商级助手片段在
存储,但组成一个助手轮流,直到下一条用户消息。
+### 回合过程与思考展示
+
+详细和紧凑模式都会把每个已加载的助手回合投影为一个整体过程披露,其中按转录顺序
+包含推理、工具、托管搜索和中间进度文字。末尾回答在披露之外流式显示;后续活动可以
+把暂定回答重新归入过程,但不会改写已存消息。助手错误和中止后的末尾部分回答也留在
+过程之外。用户/系统消息及压缩边界不变。
+
+过程内的普通活动组表示两个进度段落之间的一段连续工具、搜索或思考活动。只有当前
+模式下至少有两个可见项时才显示组标题。单项活动直接使用自身披露,紧凑模式隐藏的
+思考不会制造空包装,委派工作继续使用现有 Task 拓扑作为容器。
+
+详细模式下,活动中和已完成的整体过程默认展开。拥有当前执行片段的普通活动组默认
+展开,完成时仅在用户未操作的情况下自动收起;其他已完成组默认收起。紧凑模式下过程
+和普通活动组默认收起;若活动回合记录过失败或被拒工具,尚未被用户接管的过程会在
+后续成功恢复期间保持展开,并在回合完成后收起。组标题显示计数、运行状态和问题计数,
+但不会把失败子项当作整个回合失败。
+
+详细模式仅对最后一个活动组的字面最后一项应用叶子自动展开;该项必须是符合条件的
+工具调用或托管搜索。失败和被拒行保持收起,最后一项为思考时不会向前寻找更早工具。
+紧凑模式保持所有工具/搜索载荷关闭,不显示推理正文或摘要,只保留活动思考指示器。
+
+整个过程、活动组和条目是相互独立的控件。收起祖先会保留下级选择,重新展开时恢复;
+展开父级不会展开所有后代。用户操作子项时会接管祖先但不切换祖先,因此完成事件不能
+收起包含已展开、聚焦或选中内容的容器。选择以稳定回合/组/条目标识保存在会话窗格
+内,跨模式切换和行重新挂载保留;窗格淘汰、会话删除或渲染器重启后重新应用默认值,
+不会写入消息或设置。
+
+搜索和导航只展开命中目标所需的精确“过程 -> 组 -> 条目”路径,并且每个显示请求只
+应用一次。紧凑模式中的推理在用户切换到详细模式前保持隐藏。权限、提问、计划/目标
+审批及其他待处理操作卡位于隐藏过程之外,始终可达。参见
+[ADR turn-process-and-thinking-display](/zh-CN/adr/turn-process-and-thinking-display)。
+
### 7.2 解剖学
```text
@@ -1037,7 +1069,7 @@ SESSIONS [msg+][↕]
| 会话转换 | 热目标面板立即以其保留的内容和位置被揭示。若它仍在运行或仍持有尚未刷入的已完成回复,其实时渲染器快照在持久化再验证中保留。冷目标让可见面板在一条细进度轨道下停留在它自己的会话上,直到目标提交;没有任何内容被调暗,隐藏的面板保持挂载且惰性,当前流更新不会延迟 |
| 流媒体 | 追加新令牌;仅在固定到底部时自动滚动 |
| 回合开始 | 发送/重试/重新生成重新固定跟随模式并跳转到底部 |
-| 仅思考流媒体 | 文字记录打开;披露保持开放;没有空的答案气泡;底部状态继续标明回合仍在运行 |
+| 仅思考流式输出 | 详细模式按活动思考策略显示条目;紧凑模式只显示状态指示器。用户手动收起后,后续推理不会重新打开该层级;没有空回答气泡,底部状态继续标明回合仍在运行 |
| 运行中兜底 | 未知具体运行时阶段且不在规划状态时,整轮显示带跳动圆点的紧凑 Working 行,包括部分输出暂停和工具完成后的空档 |
| 运行中规划 | 整轮在同一位置显示带跳动圆点的紧凑规划/目标行,具体运行时阶段优先;等待用户操作或回合结束时隐藏。Composer 模式芯片脉冲 |
| 空闲 | 可滚动;没有自动滚动 |
@@ -1061,10 +1093,8 @@ SESSIONS [msg+][↕]
保留助手消息原有 14px 底部内边距和运行状态栏完整高度,默认字号下纯文字
片段到状态文字为 24px。用户消息保留真实的悬停操作栏与原有间距,包括首次
等待阶段;按钮通过透明度隐藏但保持占位,悬停时不推动内容。
-- 切换思维披露:expand/collapse 独立于
- 最终答案;当推理到达时,流式传输会重新打开它。扩展后的
-内容的左侧规则本身就是一个指针和键盘可聚焦的折叠
- 控制。
+- 切换思考条目只改变该层级,独立于整个过程、活动组和最终回答。流式更新不会重新打开
+ 用户已手动收起的层级;展开内容旁的左侧栏本身是可用指针和键盘聚焦操作的收起控件。
- 悬停代码块:出现复制按钮
- 将鼠标悬停或聚焦在小地图标记上:显示本地化的发件人和有界的
纯文本预览;一个用户内产生多个助手片段
@@ -1390,15 +1420,18 @@ Renderer: `apps/desktop/src/components/Markdown.tsx` + `apps/desktop/src/lib/s
参数提示、状态和结果的可读呈现。遵循D071
并且故意不是一张高级卡。
-连续的工具调用形成一个 ChatGPT 样式的处理组。历史组默认折叠。
-进行中的最新组会自动展开;回合结束后,若用户没有接管该披露,
-自动管理的组会收起,把视觉焦点留给回答。组标题在活动时显示
-`Processing · 12s`,完成后显示 `Processed for 12s`,不再额外画状态胶囊。
-实时活动留在处理组、最新行或专用运行时指示器里。展开它会显示
-有序的工具活动行及其嵌套结果披露。小组报告持续时间和遏制,
-而不是结果:失败的孩子本身仍然是一个错误
-ToolCallRow 但从未将组标头更改为终端故障。终端
-代理错误仍归助理错误和 TurnOutcomeCard 表面所有。
+两个进度段落之间的一段连续工具、搜索或思考活动,仅在有两个及以上可见项时成为普通
+处理组。单项活动直接使用自身披露,Task 拓扑继续使用原有容器。回合活动期间,拥有
+当前执行片段的普通组在详细模式下默认展开,在紧凑模式下默认收起;详细模式的未操作
+组在完成时自动收起。详细模式仅在最后一个活动组的字面最后一项是符合条件的工具调用
+或托管搜索时自动展开其载荷;更早、失败和被拒行保持收起,最后一项为思考时不会向前
+选择工具。紧凑模式保持所有工具/搜索载荷关闭。
+
+组标题在活动时显示 `Processing · 12s`,完成后显示 `Processed for 12s`,并提供有界
+条目与问题计数。展开后显示有序活动行及其相互独立的结果披露。失败子项仍在自己的
+ToolCallRow 上显示错误,但不会让组或整个回合成为终端失败;终端 Agent 错误仍由助手
+错误或 TurnOutcomeCard 表面拥有。用户操作组、条目或收起栏时会接管该层级及其祖先,
+但不切换祖先,因此流式更新和完成不会覆盖选择,也不会收起聚焦或选中的内容。
### 9.2 解剖学
@@ -1417,8 +1450,12 @@ ToolCallRow 但从未将组标头更改为终端故障。终端
- 领先的 Lucide 图标反映了操作类型:文件、文件夹、搜索、
编辑、终端、Web 或通用工具。
-- 组标题包含已用计时器和步数。它停留在
- 完成后的记录,除非明确打开,否则保持折叠状态。
+- 多项组标题拥有经过时间以及条目和问题计数,并在完成后保留在转录中。详细模式下
+ 活动组默认展开,完成时仅在用户未操作时收起;其他已完成组默认收起。紧凑模式的组
+ 默认收起。单项活动没有组标题。
+- 紧凑模式保持工具/搜索载荷关闭。详细模式仅自动展开最后一个活动组中符合条件的
+ 字面最后一项;失败/被拒项保持收起,最后一项为思考时不会选择更早工具。活动思考
+ 遵循自身披露策略,绝不会展开同级载荷。
- 处理组跨越完整可用的辅助列,因此扩展
即使标头或有效负载很短,结果详细信息也会保持可用宽度。
- 可见标签是自然语言操作(`Read`、`Ran`、`Searched`),
@@ -1474,24 +1511,24 @@ pi-ai 结果信封携带 `details` 中的结构化有效负载并重复它
| 状态 | 标头处理 | 扩展内容 |
|---|---|---|
-| 跑步 | 渐进式动作 + 闪光 + 旋转器 | 最新部分输出 |
-| 成功 | 过去时动作+结果筹码;没有绿色成功徽章 | 结果块,然后是参数(如果尚未显示) |
-| 错误 | 过去式动作+紧凑的危险状态;自动扩展 | 首先是错误注释,然后是参数 |
-| 被拒绝 | 静音 `Denied` 状态 | 可用时的许可结果 |
+| 运行中 | 渐进动作配可读文字与脉冲标记;`run` 行还显示旋转器,并让 `Working…` 旁状态点脉冲 | 详细模式展开活动的多项组;仅符合条件的字面最后一个工具/搜索载荷展开。紧凑载荷保持关闭;活动思考遵循自身指示器/披露策略 |
+| 成功 | 过去时动作加结果芯片;除 `run` 行状态点和 `Done` 外不显示绿色成功徽标 | 先显示结果块,再显示尚未呈现的参数;未操作的活动组在完成时收起,手动组/条目选择和详细模式字面最后叶子状态保留 |
+| 错误 | 过去时动作加紧凑危险状态;详情默认收起,只在用户请求时展开。只要命令退出码非零,`run` 行就处于此状态,不受调用报告影响(D227) | 先显示错误说明,再显示参数 |
+| 被拒绝 | 静音 `Denied` 状态;载荷在请求前保持关闭 | 可用时显示权限结果 |
### 9.6 互动
-- 单击行:expand/collapse 结果块;成功行默认值
- 折叠和失败的行会自动打开。
-- 单击处理标题:expand/collapse 订购的活动列表。
- 处理组默认折叠,包括在回合处于活动状态时。
-- 单击或键盘激活扩展思维、工具旁边的左侧规则
- 详细信息、委派的工作或处理步骤:折叠该所有权
- 公开而不改变相邻的扩展状态。
-- 失败的子行保持自动扩展和错误色调,而包含
- 即使后来的工具恢复了,组也会稳定为 `Processed for {elapsed}`。
- 扩展使用短 height/opacity 过渡并保留折叠内容
- 惰性的。
+- 单击条目只展开/收起该结果载荷。紧凑模式载荷默认关闭。详细模式仅在该行是最后一个
+ 活动组中符合条件的字面最后一项时默认展开;更早、失败和被拒行保持收起,直到用户
+ 主动打开。
+- 单击处理标题只展开/收起该有序活动列表。详细模式的活动组默认展开,完成时仅在用户
+ 未操作的情况下收起;其他已完成组和紧凑模式组默认收起。展开组不会展开所有条目。
+- 单击或用键盘激活展开思考、工具详情、委派工作或处理步骤旁的左侧栏,只收起所属
+ 披露,不改变相邻状态。条目操作会把所属组和整个过程标记为用户接管,但不会切换
+ 祖先;之后的流式更新或完成不能自动反转这些状态。
+- 失败子行保持错误色并在标题中报告失败,但载荷不会自动展开。包含它的组即使后来工具
+ 已恢复,也会以 `Processed for {elapsed}` 收尾并显示问题计数。展开使用短
+ height/opacity 过渡,收起内容保持惰性。
- 运行更新替换最新的部分输出。积木已建成
仅在扩展上,因此流媒体费用保持便宜。
- 结果在争论之前呈现,因此主要结果具有更高的
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 298ee8eca..df25da0fd 100644
--- a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md
+++ b/docs/zh-CN/spec/04-ux/09-interaction-patterns.md
@@ -662,22 +662,28 @@
### 4. 2 折叠指示器
-- 工具活动以轻量级折叠行开始;打开呼叫失败
- 自动,因此错误仍然是其调用的本地错误。
-- 连续的工具活动包含在一个折叠的处理组中。其
- 标头在活动时每秒更新一次经过时间,在
-下一条记录消息,并公开包含的步骤数。
-- 失败的行是调用局部事实并且立即保持可见。的
- 仅包含组报告处理持续时间并按处理结果结算,
- 即使稍后的呼叫恢复。终端转向故障仅源自
- 终端代理事件并通过助手错误出现,
- TurnOutcomeCard、侧边栏状态和通知界面。
-- 展开处理组显示有序行;每行都保留其
- 自己的输出和输入的嵌套公开。
-- 激活该行首先显示钳位输出,然后显示原始输入。
-- 每个部分在内部滚动并公开其自己的复制操作。
-- 披露 V 形在扩展时旋转。减少运动禁用
- 非必要的 shimmer/rotation 动画。
+- 工具活动以轻量的收起条目开始。失败和被拒调用在行标题中保留问题状态,载荷不会
+ 自动展开。
+- 两种模式都为每个已加载的助手回合提供一个整体过程披露,其中包含思考、工具、托管
+ 搜索和中间进度文字;末尾回答、助手错误和中止后的末尾文字位于过程之外。
+- 连续活动片段仅在当前模式下至少有两个可见项时获得组披露。进度文字结束该片段,
+ 单项活动直接使用自身披露,紧凑模式隐藏的思考不会制造多余组;Task 拓扑保持独立。
+- 详细模式下,活动中和已完成的整体过程默认展开。活动普通组默认展开,完成时仅在用户
+ 未操作的情况下收起;其他已完成组默认收起。紧凑模式下过程与组默认收起,但活动回合
+ 只要记录过失败或被拒工具,未接管的外层过程会在恢复期间保持展开,并在完成后收起。
+- 详细模式仅在最后一个活动组的字面最后一项是符合条件的工具调用或托管搜索时自动
+ 展开该叶子。失败/被拒项保持收起;最后一项是思考时不会向前查找工具。紧凑模式保持
+ 所有条目载荷关闭,隐藏推理正文与摘要,只保留活动思考指示器。
+- 激活过程、组或条目标题只切换该层级。收起父级会保留子级状态,重新展开时恢复,
+ 同级组彼此独立;展开父级不是“全部展开”。
+- 手动操作条目会把所属组和过程标记为用户接管,但不会切换祖先。流式更新和完成不会
+ 重新打开手动收起,也不会收起包含用户已展开、聚焦或选中内容的容器。只要保留会话
+ 窗格仍存在,选择就跨模式切换、单项变组和重新挂载保留。
+- 搜索和导航只打开命中目标所需的精确“过程 -> 组 -> 条目”祖先路径,每个显示请求仅
+ 应用一次。紧凑模式中的推理需要显式切换到详细;关闭搜索不会收起已显示路径。
+- 待处理权限、提问、计划/目标审批及其他操作卡位于隐藏过程之外,始终可达。
+- 每个披露使用独立按钮、`aria-expanded` 和 `aria-controls`;收起的后代离开 Tab 与
+ 无障碍遍历顺序。减少动态效果会禁用非必要标记和 V 形动画。
### 4. 3 工具结果截断
@@ -1024,6 +1030,14 @@ Mode/provider/model/permission/shell 配置和新提示仍然存在
这包括输入框因多行草稿而变高:底部预留是转录内容上的 padding,
因此按 border-box 观察内容,让最新回合随输入框一起上移,而不是
滑到输入框后面(D287)。
+- 手动切换整个过程、活动组、工具/搜索/思考条目、委派摘要或错误详情时,由所属滚动器
+ 保持阅读位置(issue #324)。只有发起切换的层级声明滚动锚点;把祖先标记为用户接管
+ 不会同时声明祖先位置。状态变化前先把标题交给滚动器,并在高度变化的每一帧恢复其
+ 视口偏移。嵌套滚动器(委派运行停靠区,D302)保持自身位置,并因外层内容同时增长而
+ 向外传递保持。
+- 收起父级不会重置已保留子级的披露或阅读状态。搜索显示会展开所需祖先,并以精确目标
+ 作为最终锚点。任何披露导致的退出跟随都不是重新贴底;在真实滚动输入、跳转控件、
+ 新回合或导航释放保持前,转录停留在用户阅读位置并显示“回到最新”(D430)。
- 用户发送/重试/重新生成:重新固定,隐藏跳转控件,并将最新内容放置在布局阶段,以便新的回合可见,而无需历史记录顶部的闪烁;后续的持久化行和流式传输行继续遵循底部
- 滚动到底部按钮:位置固定在转录区域的右下角,偏移 12px
- 向上滚动释放跟随模式后按钮立即出现
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index c600c7b1f..b21e24768 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -1061,31 +1061,31 @@ unit/integration 测试;代码 pull request 使用有选择且高价值的 E2E
- **里程碑**:M5
- **状态**:单位覆盖(`settings-responsive-layout.test.mjs`);场景已记录
-#### E2E-040:Codex 风格的工具活动在转录本重新加载后仍然存在
-- **先决条件**:已配置提供商;项目开放;一个会话可以运行一个
- 成功的工具和失败或中止的工具。
-- **步骤**:1) 运行代表性读取、搜索和命令工具。 2) 检查
- 处于活动状态时折叠的处理标头。 3)等待完成
- 并扩大加工组。 4) 展开已完成的行并复制其
- 输出。 5) 单击展开行旁边的垂直线,然后单击键盘焦点
- 并激活处理组的垂直规则。 6) 重新加载会话并
- 展开恢复的组。
-- **预期**:连续调用默认折叠在一个本地化版本下
- 处理标头更新然后冻结其经过的时间并显示
- 步数。扩展调用使用透明语义活动行
- 动作图标、自然语言动词、等宽主要参数和安静
- 披露。处理组使用完整的辅助列宽度,因此
- 短标签或有效负载不会将扩展的细节缩小为内容大小
- 芯片。每个扩展内容垂直规则都是一个指针并且可通过键盘聚焦
- 对其自身披露的崩溃控制。嵌套扩展显示输出
- 在夹紧滚动区域中的原始输入之前。实时部分输出更新
- 地方。重新加载的行保留工具名称、参数、结果和状态。
-- **链接规格**:`04-ux/01-ui-ia.md`,
- `04-ux/07-ui-design-system.md`、`04-ux/08-component-spec.md`、
- `04-ux/09-interaction-patterns.md`
-- **接受**:C(聊天流)、E(工具)、F(持久性)
+#### E2E-040:嵌套工具活动在转录重新加载后仍然存在
+- **先决条件**:已配置提供商并打开项目;回合可以包含进度文字、多个搜索/工具/思考
+ 条目,以及失败或被拒工具。
+- **步骤**:1) 在详细模式流式输出进度段落 A、多项搜索片段、进度段落 B 和多项命令
+ 片段。2) 检查已展开的整体过程和活动组;在更多输出到达时手动收起活动组。3) 完成
+ 回合并比较未操作与用户接管的组。4) 展开一个已完成组和其中一个条目,复制输出,
+ 收起并重新展开该组,再独立打开同级组。5) 分别检查单项片段,以及最后一个活动组的
+ 字面最后一项为工具/搜索、思考、失败工具和被拒工具。6) 切换到紧凑模式,检查活动
+ 思考、失败后恢复及完成状态。7) 在保留窗格内重新挂载行,然后重载渲染器并重新打开
+ 会话。
+- **预期**:两种模式都使用一个整体过程披露,末尾回答位于其外。详细模式的活动中和
+ 已完成过程默认展开;活动多项组展开,并且只在用户未操作时于完成后收起。紧凑模式
+ 的过程、组和所有载荷默认收起,推理正文隐藏;记录过失败/被拒工具的未操作活动过程
+ 会在后续恢复期间保持展开。单项没有组包装。详细模式只在最后一个活动组的字面最后
+ 一项是符合条件的工具/搜索时自动展开载荷;不会越过思考向前查找,失败/被拒保护会
+ 保持叶子关闭。父级、子级和同级选择彼此独立;收起并重新展开父级会保留下级状态,
+ 流式更新和完成不会覆盖用户接管的选择。保留窗格中的重新挂载保留选择;渲染器重启
+ 重新应用默认值,但工具名称、参数、结果和状态仍会恢复。组/过程标题显示有界运行和
+ 问题摘要,不会把整个回合标记为失败。
+- **链接规格**:`04-ux/01-ui-ia.md`、`04-ux/07-ui-design-system.md`、
+ `04-ux/08-component-spec.md`、`04-ux/09-interaction-patterns.md`
+- **验收**:C(聊天流)、E(工具)、F(持久性)
- **里程碑**:M3
-- **状态**:草案
+- **状态**:草案。2026-09-20 的嵌套披露变更仅把本场景作为静态源码/设计审查的
+ 预期行为;该范围不新增或运行单元、组件、集成、浏览器、Electron 或 E2E 测试。
#### E2E-041:对话小地图导航长记录
@@ -8158,3 +8158,26 @@ the latest destination. These assertions measure work counts, not device FPS.
- **阶段:** 发布后维护。
- **自动化:** `pnpm test:e2e:dialog-overflow`;源代码检查不能替代实际布局验证。
- **状态:** 已实现,原生 Windows 已验证,macOS/Linux 尚未实机验证。
+
+### E2E-CHAT-turn-process-and-thinking-display
+
+- **先决条件:** 一个回合包含进度段落 A、多次搜索及思考、进度段落 B、多条命令及
+ 思考和最终回答;详细与紧凑显示模式;精确的转录搜索目标。
+- **步骤:** 在详细模式静态审查嵌套披露路径,包括相互独立的组/条目切换、父级收起
+ 与恢复、单项片段、字面最后一项选择、失败/被拒/恢复、保留窗格重新挂载和精确搜索
+ 显示。随后在紧凑模式重复,并覆盖权限/提问/计划/目标操作卡、中止的部分回答、
+ 助手错误和委派子任务。
+- **预期:** 两种模式都使用一个整体过程披露,并把最终回答、助手错误、中止后的末尾
+ 文字和待处理操作留在过程之外。详细模式的活动中/已完成过程默认展开;活动多项组
+ 展开,未操作组在完成时收起。紧凑模式的过程、组和载荷默认收起,隐藏推理;记录过
+ 失败/被拒工具的未操作活动过程会在恢复期间保持展开,并在完成后收起。单项没有组。
+ 详细模式只自动展开最后一个活动组中符合条件的字面最后工具/搜索项;不会越过思考
+ 向前查找,失败/被拒叶子保持关闭。父级、子级和同级状态相互独立;窗格拥有的用户
+ 选择跨更新、模式切换和重新挂载保留,渲染器重启后重新应用默认值。搜索对每个请求
+ 只打开精确的“过程 -> 组 -> 条目”或 Task 面板路径;紧凑模式中的推理需要显式切换到
+ 详细。已保存模式跨重启保留,缺失或未知设置按详细模式处理。
+- **2026-09-20 变更的验证范围:** 仅作为静态源码/设计审查的预期行为。本次限定任务
+ 不新增或运行单元、组件、集成、运行时、浏览器、Electron 或 E2E 测试;本计划其他位置
+ 的既有自动化名称只是历史清单,不表示本次变更已运行这些测试。
+- **规格:** 04-ux/06-settings-ia、04-ux/08-component-spec、
+ 04-ux/09-interaction-patterns;ADR turn-process-and-thinking-display。
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index 3d50ad723..41db5ff52 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -445,6 +445,22 @@ export const de = {
"waitingForSubagents_other": "Warten auf {{count}} Subagenten",
"processingSteps": "{{count}} Schritt",
"processingSteps_other": "{{count}} Schritte",
+ "processTools": "{{count}} Tool",
+ "processTools_other": "{{count}} Tools",
+ "activityCommands": "{{count}} Befehl",
+ "activityCommands_other": "{{count}} Befehle",
+ "activitySearches": "{{count}} Suche",
+ "activitySearches_other": "{{count}} Suchen",
+ "activityTools": "{{count}} Tool-Aktion",
+ "activityTools_other": "{{count}} Tool-Aktionen",
+ "activityThinking": "{{count}} Denkschritt",
+ "activityThinking_other": "{{count}} Denkschritte",
+ "activityIncludesThinking": "Enthält Denken",
+ "activityFailures": "{{count}} Problem",
+ "activityFailures_other": "{{count}} Probleme",
+ "collapseProcess": "Prozess einklappen",
+ "collapseActivityGroup": "Aktivitätsgruppe einklappen",
+ "collapseToolOutput": "Tool-Ausgabe einklappen",
"collapseDetails": "Details ausblenden",
"subagentTaskExpand": "Mehr anzeigen",
"subagentTaskCollapse": "Weniger anzeigen",
@@ -942,7 +958,7 @@ sklm: {
"linkOpenTargetWorkpanel": "Arbeitsbereich-Browser",
"linkOpenTargetExternal": "Standard-Betriebssystem-Browser",
"thinkingDisplayMode": "Denkprozess anzeigen",
- "thinkingDisplayModeDesc": "Detailliert zeigt Denken, Werkzeuge und Zwischentext an Ort und Stelle. Kompakt fasst das in einem Prozess zusammen, zeigt während des Denkens einen Hinweis und blendet abgeschlossene Denkprozesse aus.",
+ "thinkingDisplayModeDesc": "Der Modus Detailliert zeigt den Fortschritt in einem ausklappbaren Prozess mit verschachtelten Tool-Gruppen und dem Denkprozess. Der Modus Kompakt startet mit eingeklapptem Prozess und blendet den Denkprozess aus.",
"thinkingDisplayDetailed": "Detailliert (Standard)",
"thinkingDisplayCompact": "Kompakt",
"contextUsageDisplay": "Kontextnutzung-Anzeige",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index 0337c6bf2..7a0fb14ee 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -452,6 +452,22 @@ export const en = {
waitingForSubagents_other: "Waiting for {{count}} subagents",
processingSteps: "{{count}} step",
processingSteps_other: "{{count}} steps",
+ processTools: "{{count}} tool",
+ processTools_other: "{{count}} tools",
+ activityCommands: "{{count}} command",
+ activityCommands_other: "{{count}} commands",
+ activitySearches: "{{count}} search",
+ activitySearches_other: "{{count}} searches",
+ activityTools: "{{count}} tool action",
+ activityTools_other: "{{count}} tool actions",
+ activityThinking: "{{count}} thinking step",
+ activityThinking_other: "{{count}} thinking steps",
+ activityIncludesThinking: "Includes thinking",
+ activityFailures: "{{count}} issue",
+ activityFailures_other: "{{count}} issues",
+ collapseProcess: "Collapse process",
+ collapseActivityGroup: "Collapse activity group",
+ collapseToolOutput: "Collapse tool output",
collapseDetails: "Collapse details",
subagentTaskExpand: "Show more",
subagentTaskCollapse: "Show less",
@@ -951,7 +967,7 @@ sklm: {
linkOpenTargetWorkpanel: "Work panel browser",
linkOpenTargetExternal: "Default OS browser",
thinkingDisplayMode: "Thinking display mode",
- thinkingDisplayModeDesc: "Detailed shows reasoning, tools and intermediate text in place. Compact groups that work into a process, shows a thinking indicator while active, and hides completed thinking.",
+ thinkingDisplayModeDesc: "Detailed shows progress in an expandable process with nested tool groups and reasoning. Compact starts the process collapsed and hides reasoning.",
thinkingDisplayDetailed: "Detailed (default)",
thinkingDisplayCompact: "Compact",
contextUsageDisplay: "Context usage readout",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index 6db3644b7..a2b9249d3 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -445,6 +445,22 @@ export const es = {
"waitingForSubagents_other": "Esperando {{count}} subagentes",
"processingSteps": "{{count}} paso",
"processingSteps_other": "{{count}} pasos",
+ "processTools": "{{count}} herramienta",
+ "processTools_other": "{{count}} herramientas",
+ "activityCommands": "{{count}} comando",
+ "activityCommands_other": "{{count}} comandos",
+ "activitySearches": "{{count}} búsqueda",
+ "activitySearches_other": "{{count}} búsquedas",
+ "activityTools": "{{count}} acción de herramienta",
+ "activityTools_other": "{{count}} acciones de herramienta",
+ "activityThinking": "{{count}} paso de razonamiento",
+ "activityThinking_other": "{{count}} pasos de razonamiento",
+ "activityIncludesThinking": "Incluye razonamiento",
+ "activityFailures": "{{count}} problema",
+ "activityFailures_other": "{{count}} problemas",
+ "collapseProcess": "Contraer proceso",
+ "collapseActivityGroup": "Contraer grupo de actividad",
+ "collapseToolOutput": "Contraer salida de herramienta",
"collapseDetails": "Contraer detalles",
"subagentTaskExpand": "Mostrar más",
"subagentTaskCollapse": "Mostrar menos",
@@ -942,7 +958,7 @@ sklm: {
"linkOpenTargetWorkpanel": "Navegador del panel de trabajo",
"linkOpenTargetExternal": "Navegador predeterminado del sistema",
"thinkingDisplayMode": "Visualización del razonamiento",
- "thinkingDisplayModeDesc": "Detallado muestra razonamiento, herramientas y texto intermedio en su sitio. Compacto agrupa ese trabajo en un proceso, muestra un indicador mientras se razona y oculta el razonamiento al terminar.",
+ "thinkingDisplayModeDesc": "Detallado muestra el progreso en un proceso expandible con grupos de herramientas anidados y razonamiento. Compacto inicia el proceso contraído y oculta el razonamiento.",
"thinkingDisplayDetailed": "Detallado (predeterminado)",
"thinkingDisplayCompact": "Compacto",
"contextUsageDisplay": "Lectura del uso del contexto",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index dd1863387..56e63e002 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -445,6 +445,22 @@ export const fr = {
"waitingForSubagents_other": "En attente de {{count}} sous-agents",
"processingSteps": "{{count}} étape",
"processingSteps_other": "{{count}} étapes",
+ "processTools": "{{count}} outil",
+ "processTools_other": "{{count}} outils",
+ "activityCommands": "{{count}} commande",
+ "activityCommands_other": "{{count}} commandes",
+ "activitySearches": "{{count}} recherche",
+ "activitySearches_other": "{{count}} recherches",
+ "activityTools": "{{count}} action d'outil",
+ "activityTools_other": "{{count}} actions d'outil",
+ "activityThinking": "{{count}} étape de raisonnement",
+ "activityThinking_other": "{{count}} étapes de raisonnement",
+ "activityIncludesThinking": "Inclut le raisonnement",
+ "activityFailures": "{{count}} problème",
+ "activityFailures_other": "{{count}} problèmes",
+ "collapseProcess": "Réduire le processus",
+ "collapseActivityGroup": "Réduire le groupe d'activité",
+ "collapseToolOutput": "Réduire la sortie de l'outil",
"collapseDetails": "Réduire les détails",
"subagentTaskExpand": "Afficher plus",
"subagentTaskCollapse": "Afficher moins",
@@ -942,7 +958,7 @@ sklm: {
"linkOpenTargetWorkpanel": "Navigateur du panneau de travail",
"linkOpenTargetExternal": "Navigateur par défaut du système",
"thinkingDisplayMode": "Affichage du raisonnement",
- "thinkingDisplayModeDesc": "Le mode détaillé affiche raisonnement, outils et texte intermédiaire sur place. Le mode compact les regroupe dans un processus, affiche un indicateur pendant la réflexion, puis masque le raisonnement terminé.",
+ "thinkingDisplayModeDesc": "Le mode détaillé affiche la progression dans un processus dépliable avec des groupes d'outils imbriqués et le raisonnement. Le mode compact démarre avec le processus replié et masque le raisonnement.",
"thinkingDisplayDetailed": "Détaillé (par défaut)",
"thinkingDisplayCompact": "Compact",
"contextUsageDisplay": "Affichage de l'usage du contexte",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index 4ae4abf01..bc22f8e83 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -454,6 +454,22 @@ export const ko = {
waitingForSubagents_other: "서브에이전트 {{count}}개 대기 중",
processingSteps: "{{count}}단계",
processingSteps_other: "{{count}}단계",
+ processTools: "도구 {{count}}개",
+ processTools_other: "도구 {{count}}개",
+ activityCommands: "명령 {{count}}개",
+ activityCommands_other: "명령 {{count}}개",
+ activitySearches: "검색 {{count}}회",
+ activitySearches_other: "검색 {{count}}회",
+ activityTools: "도구 작업 {{count}}개",
+ activityTools_other: "도구 작업 {{count}}개",
+ activityThinking: "생각 단계 {{count}}개",
+ activityThinking_other: "생각 단계 {{count}}개",
+ activityIncludesThinking: "생각 포함",
+ activityFailures: "문제 {{count}}개",
+ activityFailures_other: "문제 {{count}}개",
+ collapseProcess: "처리 과정 접기",
+ collapseActivityGroup: "활동 그룹 접기",
+ collapseToolOutput: "도구 출력 접기",
collapseDetails: "세부 정보 접기",
subagentTaskExpand: "더 보기",
subagentTaskCollapse: "접기",
@@ -952,7 +968,7 @@ sklm: {
linkOpenTargetWorkpanel: "작업 패널 브라우저",
linkOpenTargetExternal: "시스템 기본 브라우저",
thinkingDisplayMode: "사고 과정 표시 모드",
- thinkingDisplayModeDesc: "상세 모드는 사고·도구·중간 텍스트를 제자리에 표시하고 처리 블록으로 묶지 않습니다. 간결 모드는 그 과정을 하나로 묶고, 사고 중에는 상태만 표시하며 완료된 사고는 숨깁니다.",
+ thinkingDisplayModeDesc: "상세 모드는 중첩된 도구 그룹과 사고 과정을 포함한 진행 상황을 펼칠 수 있는 처리 과정에 표시합니다. 간결 모드는 처리 과정을 접힌 상태로 시작하고 사고 과정을 숨깁니다.",
thinkingDisplayDetailed: "상세 (기본값)",
thinkingDisplayCompact: "간결",
contextUsageDisplay: "컨텍스트 사용량 표시",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index e673e52b2..fb2b2e5bf 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -454,6 +454,22 @@ export const tr = {
waitingForSubagents_other: "{{count}} alt ajan bekleniyor",
processingSteps: "{{count}} adım",
processingSteps_other: "{{count}} adım",
+ processTools: "{{count}} araç",
+ processTools_other: "{{count}} araç",
+ activityCommands: "{{count}} komut",
+ activityCommands_other: "{{count}} komut",
+ activitySearches: "{{count}} arama",
+ activitySearches_other: "{{count}} arama",
+ activityTools: "{{count}} araç işlemi",
+ activityTools_other: "{{count}} araç işlemi",
+ activityThinking: "{{count}} düşünme adımı",
+ activityThinking_other: "{{count}} düşünme adımı",
+ activityIncludesThinking: "Düşünmeyi içerir",
+ activityFailures: "{{count}} sorun",
+ activityFailures_other: "{{count}} sorun",
+ collapseProcess: "İşlemi daralt",
+ collapseActivityGroup: "Etkinlik grubunu daralt",
+ collapseToolOutput: "Araç çıktısını daralt",
collapseDetails: "Ayrıntıları daralt",
subagentTaskExpand: "Daha fazla göster",
subagentTaskCollapse: "Daha az göster",
@@ -952,7 +968,7 @@ sklm: {
linkOpenTargetWorkpanel: "Çalışma paneli tarayıcısı",
linkOpenTargetExternal: "Varsayılan sistem tarayıcısı",
thinkingDisplayMode: "Düşünme görünümü",
- thinkingDisplayModeDesc: "Ayrıntılı mod düşünme, araçlar ve ara metni yerinde gösterir, bir işlem bloğunda birleştirmez. Sade mod bunları bir işlemde gruplar, düşünürken bir gösterge gösterir ve tamamlanan düşünmeyi gizler.",
+ thinkingDisplayModeDesc: "Ayrıntılı mod ilerlemeyi, iç içe araç grupları ve düşünmeyle birlikte genişletilebilir bir işlemde gösterir. Sade mod işlemi daraltılmış olarak başlatır ve düşünmeyi gizler.",
thinkingDisplayDetailed: "Ayrıntılı (varsayılan)",
thinkingDisplayCompact: "Sade",
contextUsageDisplay: "Bağlam kullanımı göstergesi",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index 7e18317e2..4ffe7201b 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -449,6 +449,22 @@ export const zhCN = {
waitingForSubagents_other: "正在等待 {{count}} 个 Subagent",
processingSteps: "{{count}} 个步骤",
processingSteps_other: "{{count}} 个步骤",
+ processTools: "{{count}} 个工具",
+ processTools_other: "{{count}} 个工具",
+ activityCommands: "{{count}} 个命令",
+ activityCommands_other: "{{count}} 个命令",
+ activitySearches: "{{count}} 次搜索",
+ activitySearches_other: "{{count}} 次搜索",
+ activityTools: "{{count}} 次工具操作",
+ activityTools_other: "{{count}} 次工具操作",
+ activityThinking: "{{count}} 个思考步骤",
+ activityThinking_other: "{{count}} 个思考步骤",
+ activityIncludesThinking: "包含思考",
+ activityFailures: "{{count}} 个问题",
+ activityFailures_other: "{{count}} 个问题",
+ collapseProcess: "折叠处理过程",
+ collapseActivityGroup: "折叠活动分组",
+ collapseToolOutput: "折叠工具输出",
collapseDetails: "折叠详情",
subagentTaskExpand: "展开全部",
subagentTaskCollapse: "收起",
@@ -941,7 +957,7 @@ sklm: {
linkOpenTargetWorkpanel: "工作区浏览器",
linkOpenTargetExternal: "系统默认浏览器",
thinkingDisplayMode: "思考过程展示模式",
- thinkingDisplayModeDesc: "详细模式按原文展开思考、工具和中间文本,不合成处理块。精简模式将过程收进处理块,思考中仅显示状态提示,结束后隐藏思考块。",
+ thinkingDisplayModeDesc: "详细模式在可展开的处理过程中显示进度、嵌套工具分组和思考内容。精简模式默认折叠处理过程并隐藏思考内容。",
thinkingDisplayDetailed: "详细(默认)",
thinkingDisplayCompact: "精简",
contextUsageDisplay: "上下文用量读数",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index 3081e17c7..04981a511 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -449,6 +449,22 @@ export const zhTW = {
waitingForSubagents_other: "正在等待 {{count}} 個 Subagent",
processingSteps: "{{count}} 個步驟",
processingSteps_other: "{{count}} 個步驟",
+ processTools: "{{count}} 個工具",
+ processTools_other: "{{count}} 個工具",
+ activityCommands: "{{count}} 個指令",
+ activityCommands_other: "{{count}} 個指令",
+ activitySearches: "{{count}} 次搜尋",
+ activitySearches_other: "{{count}} 次搜尋",
+ activityTools: "{{count}} 次工具操作",
+ activityTools_other: "{{count}} 次工具操作",
+ activityThinking: "{{count}} 個思考步驟",
+ activityThinking_other: "{{count}} 個思考步驟",
+ activityIncludesThinking: "包含思考",
+ activityFailures: "{{count}} 個問題",
+ activityFailures_other: "{{count}} 個問題",
+ collapseProcess: "摺疊處理過程",
+ collapseActivityGroup: "摺疊活動群組",
+ collapseToolOutput: "摺疊工具輸出",
collapseDetails: "摺疊詳情",
subagentTaskExpand: "展開全部",
subagentTaskCollapse: "收起",
@@ -941,7 +957,7 @@ sklm: {
linkOpenTargetWorkpanel: "工作區瀏覽器",
linkOpenTargetExternal: "系統預設瀏覽器",
thinkingDisplayMode: "思考過程顯示模式",
- thinkingDisplayModeDesc: "詳細模式依原文展開思考、工具與中間文字,不合成處理區塊。精簡模式將過程收進處理區塊,思考中僅顯示狀態提示,結束後隱藏思考區塊。",
+ thinkingDisplayModeDesc: "詳細模式在可展開的處理過程中顯示進度、巢狀工具群組和思考內容。精簡模式預設摺疊處理過程並隱藏思考內容。",
thinkingDisplayDetailed: "詳細(預設)",
thinkingDisplayCompact: "精簡",
contextUsageDisplay: "上下文用量讀數",