From 30bf50e62f90561057716339fa71805d605d8a98 Mon Sep 17 00:00:00 2001 From: todouu Date: Thu, 29 Oct 2026 11:22:23 +0800 Subject: [PATCH 1/6] feat(chat): fold everything between the prompt and the final answer A turn now shows the user prompt, one collapsed Process details row holding all thinking, tool calls, notices and intermediate text, and the final answer. A provider error on an intermediate message keeps the turn unfolded so the error stays visible. --- lib/chat-transcript-plan.test.mjs | 68 +++++++++++++++++++++++++------ lib/chat-transcript-plan.ts | 60 ++++++++++++++++++++++++--- 2 files changed, 110 insertions(+), 18 deletions(-) diff --git a/lib/chat-transcript-plan.test.mjs b/lib/chat-transcript-plan.test.mjs index bec8c3c07..6d04da9d7 100644 --- a/lib/chat-transcript-plan.test.mjs +++ b/lib/chat-transcript-plan.test.mjs @@ -36,10 +36,10 @@ test("plans a plain Q/A pair as standalone rows", () => { ]); }); -test("an answer that ended the turn stays visible when a reminder resumes the agent", () => { +test("DSH-style: intermediate replies fold with the activity, only the final answer stays visible", () => { // Session 01a0d187: the agent yields a reply carrying drafts, a todo - // reminder restarts it, it updates todos, then closes with a short message - // pointing back at the drafts. The drafts must not fold behind the closer. + // reminder restarts it, it updates todos, then closes with a short message. + // Everything before the closer folds into one row, drafts included. const messages = [ user("u1"), assistant("a1", [{ type: "thinking", thinking: "plan" }, toolCall("tc1")]), @@ -54,15 +54,14 @@ test("an answer that ended the turn stays visible when a reminder resumes the ag const rows = planTranscriptRows(messages); assert.equal(rows.length, 1); assert.deepEqual(shape(rows[0]), [ - ["activity", [1, 3]], - ["text", "Drafted replies: 1, 2, 3"], - ["activity", [4, 5]], + ["activity", [1, 3, 4, 5]], ["text", "I need your decision on the drafts above."], ]); - assert.deepEqual(rows[0].segments.filter((s) => s.kind === "activity").map((s) => s.toolCallCount), [1, 2]); + assert.equal(rows[0].segments[0].toolCallCount, 3); + assert.equal(rows[0].segments[0].stepCount, 4); }); -test("text before a tool call stays visible and splits the activity around it", () => { +test("text before a tool call folds into the single activity row", () => { const messages = [ user("u1"), assistant("a1", [{ type: "text", text: "Checking the repo." }, toolCall("tc1"), toolCall("tc2")]), @@ -74,13 +73,58 @@ test("text before a tool call stays visible and splits the activity around it", ]; const [row] = planTranscriptRows(messages); assert.deepEqual(shape(row), [ - ["text", "Checking the repo."], ["activity", [1, 4]], ["text", "Done."], ]); - assert.equal(row.segments[1].toolCallCount, 3); - // Only text that ends its message carries usage/error. - assert.deepEqual(row.segments.filter((s) => s.kind === "text").map((s) => s.last), [false, true]); + assert.equal(row.segments[0].toolCallCount, 3); + // Blocks of one message stay one piece: the text and its tool calls render together. + assert.deepEqual(row.segments[0].pieces[0].blocks.map((b) => b.type), ["text", "toolCall", "toolCall"]); + assert.equal(row.segments[1].last, true); +}); + +test("a provider error on an intermediate message keeps the turn unfolded", () => { + const messages = [ + user("u1"), + assistant("a1", [{ type: "text", text: "Trying." }, toolCall("tc1")]), + toolResult("tc1"), + { ...assistant("a2", [{ type: "text", text: "Half an answer" }]), stopReason: "error", errorMessage: "provider failed" }, + assistant("a3", [toolCall("tc2")]), + toolResult("tc2"), + assistant("a4", undefined, "Recovered."), + ]; + const [row] = planTranscriptRows(messages); + assert.deepEqual(shape(row), [ + ["text", "Trying."], + ["activity", [1]], + ["text", "Half an answer"], + ["activity", [4]], + ["text", "Recovered."], + ]); +}); + +test("a turn that ends in tool calls has no answer yet, so it folds completely", () => { + const messages = [ + user("u1"), + assistant("a1", [{ type: "text", text: "Looking." }, toolCall("tc1")]), + toolResult("tc1"), + assistant("a2", [toolCall("tc2")]), + ]; + const [row] = planTranscriptRows(messages); + assert.deepEqual(shape(row), [["activity", [1, 3]]]); + assert.equal(row.segments[0].toolCallCount, 2); +}); + +test("a notice after the final answer stays after it instead of hiding the answer", () => { + const notice = { role: "custom", customType: "job-result", display: true, content: "job done" }; + const messages = [ + user("u1"), + assistant("a1", [toolCall("tc1")]), + toolResult("tc1"), + assistant("a2", undefined, "All done."), + notice, + ]; + const [row] = planTranscriptRows(messages); + assert.deepEqual(shape(row), [["activity", [1]], ["text", "All done."], ["activity", [4]]]); }); test("a provider error after activity gets its own visible segment", () => { diff --git a/lib/chat-transcript-plan.ts b/lib/chat-transcript-plan.ts index 0b8bdf8db..5765c875d 100644 --- a/lib/chat-transcript-plan.ts +++ b/lib/chat-transcript-plan.ts @@ -11,11 +11,12 @@ import type { AgentMessage, AssistantContentBlock, AssistantMessage, CustomMessa * Rows are appended in transcript order; a row is either: * - { kind: "message", index } — one message rendered standalone (messages * before the first anchor, or a turn with nothing to fold) - * - { kind: "group", userIndex, endIndex, segments } — one anchored turn. Like - * the omp TUI, agent text is never hidden: the turn renders as its anchor - * followed by `segments` in order, where each run of activity (thinking, - * tool calls, notices) between two pieces of text folds into one collapsed - * row. A turn stays one row so the render-window math is unchanged. + * - { kind: "group", userIndex, endIndex, segments } — one anchored turn. DSH + * style: the turn renders as its anchor, one collapsed row holding everything + * in between (thinking, tool calls, notices, intermediate text), then the + * final answer. A provider error on an intermediate message keeps the turn + * unfolded so the error stays visible (see `foldToFinalAnswer`). A turn stays + * one row so the render-window math is unchanged. */ /** A folded activity entry: the listed blocks of an assistant message, or a whole non-assistant message. */ @@ -123,7 +124,54 @@ export function planTurnSegments( // Text that ends its message carries the message's usage and error. if (lastText && segments.at(-1) === lastText) (lastText as Extract).last = true; } - return segments; + return foldToFinalAnswer(messages, segments); +} + +/** + * DSH-style fold: everything between the anchor and the final answer (thinking, + * tool calls, notices and the agent's intermediate text) collapses into ONE + * activity segment; only the final answer stays visible. + * + * - The final answer is the last text segment, unless tool calls follow it: a + * turn that ends in tool calls has no answer yet, so it folds completely. + * - A provider error on an intermediate message disables the fold for the turn, + * so the failure stays visible in place instead of hiding inside the fold. + */ +function foldToFinalAnswer(messages: AgentMessage[], segments: TranscriptSegment[]): TranscriptSegment[] { + let finalIdx = -1; + for (let i = segments.length - 1; i >= 0; i--) { + if (segments[i].kind === "text") { finalIdx = i; break; } + } + if (finalIdx >= 0 && segments.slice(finalIdx + 1).some((s) => s.kind === "activity" && s.toolCallCount > 0)) finalIdx = -1; + + const head = finalIdx >= 0 ? segments.slice(0, finalIdx) : segments; + const final = finalIdx >= 0 ? segments[finalIdx] : null; + const tail = finalIdx >= 0 ? segments.slice(finalIdx + 1) : []; + + const pieces: ActivityPiece[] = []; + let toolCallCount = 0; + const addPiece = (piece: ActivityPiece) => { + const prev = pieces.at(-1); + // Blocks of one message that were split into text/activity runs render as one entry again. + if (prev?.blocks && piece.blocks && prev.index === piece.index) { + pieces[pieces.length - 1] = { index: prev.index, blocks: [...prev.blocks, ...piece.blocks] }; + } else { + pieces.push(piece); + } + }; + for (const segment of head) { + if (segment.kind === "activity") { + for (const piece of segment.pieces) addPiece(piece); + toolCallCount += segment.toolCallCount; + continue; + } + if ((messages[segment.index] as AssistantMessage).errorMessage?.trim()) return segments; + if (segment.blocks.length > 0) addPiece({ index: segment.index, blocks: segment.blocks }); + } + if (pieces.length === 0) return segments; + + const folded: TranscriptSegment = { kind: "activity", pieces, stepCount: pieces.length, toolCallCount }; + return final ? [folded, final, ...tail] : [folded]; } /** From 89b98a5713a96178a977bb3a2f32f0e01c09cc07 Mon Sep 17 00:00:00 2001 From: todouu Date: Thu, 29 Oct 2026 13:47:16 +0800 Subject: [PATCH 2/6] feat(chat): add expand-process-details setting and hover-only message actions --- app/globals.css | 14 ++++++++++++++ components/AppShell.tsx | 15 +++++++++++++++ components/ChatWindow.tsx | 15 ++++++++++----- components/MessageView.tsx | 7 ++++--- components/SettingsConfig.tsx | 8 +++++++- lib/i18n/locales/en.json | 2 ++ lib/i18n/locales/ja.json | 2 ++ lib/i18n/locales/zh-CN.json | 2 ++ 8 files changed, 56 insertions(+), 9 deletions(-) diff --git a/app/globals.css b/app/globals.css index 0d755f27e..eeafb726a 100644 --- a/app/globals.css +++ b/app/globals.css @@ -3338,6 +3338,20 @@ html[data-touch-targets="accessible"] .chat-scroll-bottom { align-items: center; gap: 3px; } +/* Per-message action buttons (copy, markdown, read aloud, edit, fork) stay + hidden until the pointer is over the message or focus is inside it. Opacity + keeps the layout stable; touch screens have no hover, so they always show. */ +.message-actions-row { + opacity: 0; + transition: opacity var(--dur-fast) var(--ease-out-warm); +} +.message-hover-scope:hover .message-actions-row, +.message-hover-scope:focus-within .message-actions-row { + opacity: 1; +} +@media (hover: none) { + .message-actions-row { opacity: 1; } +} .message-copy-action { display: inline-flex; align-items: center; diff --git a/components/AppShell.tsx b/components/AppShell.tsx index 4d094a39d..58308c6cd 100644 --- a/components/AppShell.tsx +++ b/components/AppShell.tsx @@ -109,6 +109,8 @@ const NEVER_FOLD_ACTIVITY_STORAGE_KEY = "omp-web:never-fold-activity"; const SHOW_TOOL_CALLS_UNFOLDED_STORAGE_KEY = "omp-web:show-tool-calls-unfolded"; // Off by default, so the transcript keeps collapsing reasoning until asked. const EXPAND_THINKING_STORAGE_KEY = "omp-web:expand-thinking"; +// Off by default: the "Process details" fold starts collapsed until asked. +const EXPAND_PROCESS_DETAILS_STORAGE_KEY = "omp-web:expand-process-details"; const PROVIDER_USAGE_VISIBLE_STORAGE_KEY = "omp-web:provider-usage-visible"; const NATIVE_SELECT_ALL_STORAGE_KEY = "omp-web:scope-native-select-all"; const OPEN_URL_AUTOMATICALLY_STORAGE_KEY = "omp-web:open-url-automatically"; @@ -166,6 +168,7 @@ export function AppShell({ appName }: { appName: string }) { // "Expand thinking blocks by default" — like the tool-call preference, a // UI-only behavior, so it lives in localStorage rather than omp's config. const [expandThinkingByDefault, setExpandThinkingByDefault] = useState(false); + const [expandProcessDetails, setExpandProcessDetails] = useState(false); const [hideThinkingBlock, setHideThinkingBlock] = useState(false); useEffect(() => { // omp's own setting, so the transcript hides thinking when the TUI does. @@ -200,6 +203,7 @@ export function AppShell({ appName }: { appName: string }) { setNeverFoldActivity(window.localStorage.getItem(NEVER_FOLD_ACTIVITY_STORAGE_KEY) === "true"); setShowToolCallsUnfolded(window.localStorage.getItem(SHOW_TOOL_CALLS_UNFOLDED_STORAGE_KEY) === "true"); setExpandThinkingByDefault(window.localStorage.getItem(EXPAND_THINKING_STORAGE_KEY) === "true"); + setExpandProcessDetails(window.localStorage.getItem(EXPAND_PROCESS_DETAILS_STORAGE_KEY) === "true"); setProviderUsageVisible(window.localStorage.getItem(PROVIDER_USAGE_VISIBLE_STORAGE_KEY) !== "false"); setScopeNativeSelectAll(window.localStorage.getItem(NATIVE_SELECT_ALL_STORAGE_KEY) === "true"); setOpenUrlAutomatically(window.localStorage.getItem(OPEN_URL_AUTOMATICALLY_STORAGE_KEY) === "true"); @@ -247,6 +251,14 @@ export function AppShell({ appName }: { appName: string }) { // The preference still applies for this page load. } }, []); + const handleExpandProcessDetailsChange = useCallback((expand: boolean) => { + setExpandProcessDetails(expand); + try { + window.localStorage.setItem(EXPAND_PROCESS_DETAILS_STORAGE_KEY, String(expand)); + } catch { + // The preference still applies for this page load. + } + }, []); const handleProviderUsageVisibleChange = useCallback((visible: boolean) => { setProviderUsageVisible(visible); try { @@ -2045,6 +2057,8 @@ export function AppShell({ appName }: { appName: string }) { onShowToolCallsUnfoldedChange={handleShowToolCallsUnfoldedChange} expandThinkingByDefault={expandThinkingByDefault} onExpandThinkingByDefaultChange={handleExpandThinkingByDefaultChange} + expandProcessDetails={expandProcessDetails} + onExpandProcessDetailsChange={handleExpandProcessDetailsChange} onHideThinkingBlockChange={setHideThinkingBlock} providerUsageVisible={providerUsageVisible} onProviderUsageVisibleChange={handleProviderUsageVisibleChange} @@ -2585,6 +2599,7 @@ export function AppShell({ appName }: { appName: string }) { neverFoldActivity={neverFoldActivity} showToolCallsUnfolded={showToolCallsUnfolded} expandThinkingByDefault={expandThinkingByDefault} + expandProcessDetails={expandProcessDetails} hideThinkingBlock={hideThinkingBlock} searchQuery={chatSearchQuery} searchTarget={searchMatchTarget && searchMatchTarget.sessionId === selectedSession?.id ? searchMatchTarget : null} diff --git a/components/ChatWindow.tsx b/components/ChatWindow.tsx index fa2f4c28f..cda920187 100644 --- a/components/ChatWindow.tsx +++ b/components/ChatWindow.tsx @@ -66,6 +66,8 @@ interface Props { showToolCallsUnfolded?: boolean; /** "Expand thinking blocks by default": open each thinking block on mount. */ expandThinkingByDefault?: boolean; + /** "Expand process details by default": open each Process details fold on mount. */ + expandProcessDetails?: boolean; /** omp `hideThinkingBlock`: omit thinking from the transcript. */ hideThinkingBlock?: boolean; onAgentEnd?: () => void; @@ -216,9 +218,10 @@ export function OmpRuntimeVersion() { ); } -function ProcessDetailsGroup({ messageCount, toolCallCount, children }: { messageCount: number; toolCallCount: number; children: () => ReactNode }) { +function ProcessDetailsGroup({ messageCount, toolCallCount, defaultExpanded = false, children }: { messageCount: number; toolCallCount: number; defaultExpanded?: boolean; children: () => ReactNode }) { const { t, tn } = useI18n(); - const [expanded, setExpanded] = useState(false); + // The preference only seeds the state; toggling by hand keeps working. + const [expanded, setExpanded] = useState(defaultExpanded); const parts = [t("chatWindow.processDetails"), tn("chatWindow.messageCount", messageCount)]; if (toolCallCount > 0) parts.push(tn("chatWindow.toolCallCount", toolCallCount)); @@ -305,6 +308,7 @@ interface CommittedTranscriptProps { neverFoldActivity: boolean; showToolCallsUnfolded: boolean; expandThinkingByDefault: boolean; + expandProcessDetails: boolean; hideThinkingBlock: boolean; visibleCount: number; /** True while the viewport is near the bottom of the conversation. When @@ -325,7 +329,7 @@ interface CommittedTranscriptProps { const CommittedTranscript = memo(function CommittedTranscript({ messages, entryIds, conversationMeta, messageRefs, isStreaming, sessionBusy, isCompacting, externalRunActive, isNew, forkingEntryId, editingEntryId, handleFork, handleEdit, modelNames, messageCwd, onOpenFile, sessionId, - toolCallsDefaultCollapsed, hideToolActivity, neverFoldActivity, showToolCallsUnfolded, expandThinkingByDefault, hideThinkingBlock, visibleCount, nearBottom, sentinelRef, handleLoadMoreClick, + toolCallsDefaultCollapsed, hideToolActivity, neverFoldActivity, showToolCallsUnfolded, expandThinkingByDefault, expandProcessDetails, hideThinkingBlock, visibleCount, nearBottom, sentinelRef, handleLoadMoreClick, }: CommittedTranscriptProps) { const { t } = useI18n(); const { toolResultsMap, lastAnchorIdx, visibleRefIndexByMessage } = conversationMeta; @@ -483,7 +487,7 @@ const CommittedTranscript = memo(function CommittedTranscript({ key={`activity-${userIdx}-${segmentIdx}`} ref={refIdx === undefined ? undefined : (el) => { messageRefs.current[refIdx] = el; }} > - + {() => renderActivityPieces(messages, segment.pieces, renderMessage)} , @@ -507,7 +511,7 @@ const CommittedTranscript = memo(function CommittedTranscript({ ); }); -export function ChatWindow({ session, newSessionCwd, newSessionHostId, hostStatus: channelHostStatus, hostLabel, newSessionWorkspace, toolCallsDefaultCollapsed = true, hideToolActivity = true, neverFoldActivity = false, showToolCallsUnfolded = false, expandThinkingByDefault = false, hideThinkingBlock = false, onAgentEnd, onSessionCreated, onSessionForked, onSessionMoved, modelsRefreshKey, chatInputRef, sessionInfoContainer, onBranchDataChange, onSystemPromptChange, onSystemPromptLoaderChange, onSessionStatsChange, onSessionStatsPanelOpen, onProviderUsageContextChange, onGenerationSpeedChange, onOpenFile: onOpenWorkspaceFile, onOpenUrl, onOpenProviders, searchQuery = "", searchTarget = null, onSearchTargetHandled }: Props) { +export function ChatWindow({ session, newSessionCwd, newSessionHostId, hostStatus: channelHostStatus, hostLabel, newSessionWorkspace, toolCallsDefaultCollapsed = true, hideToolActivity = true, neverFoldActivity = false, showToolCallsUnfolded = false, expandThinkingByDefault = false, expandProcessDetails = false, hideThinkingBlock = false, onAgentEnd, onSessionCreated, onSessionForked, onSessionMoved, modelsRefreshKey, chatInputRef, sessionInfoContainer, onBranchDataChange, onSystemPromptChange, onSystemPromptLoaderChange, onSessionStatsChange, onSessionStatsPanelOpen, onProviderUsageContextChange, onGenerationSpeedChange, onOpenFile: onOpenWorkspaceFile, onOpenUrl, onOpenProviders, searchQuery = "", searchTarget = null, onSearchTargetHandled }: Props) { const { t, tn } = useI18n(); const fileSource = useMemo(() => ({ hostId: session?.hostId ?? newSessionHostId ?? "local", @@ -1414,6 +1418,7 @@ export function ChatWindow({ session, newSessionCwd, newSessionHostId, hostStatu neverFoldActivity={neverFoldActivity} showToolCallsUnfolded={showToolCallsUnfolded} expandThinkingByDefault={expandThinkingByDefault} + expandProcessDetails={expandProcessDetails} hideThinkingBlock={hideThinkingBlock} visibleCount={visibleCount} nearBottom={nearBottom} diff --git a/components/MessageView.tsx b/components/MessageView.tsx index a8e2f1a1c..df8ddfcf5 100644 --- a/components/MessageView.tsx +++ b/components/MessageView.tsx @@ -393,6 +393,7 @@ function UserMessageView({ message, cwd, onOpenFile, entryId, onFork, forking, f return (
@@ -458,7 +459,7 @@ function UserMessageView({ message, cwd, onOpenFile, entryId, onFork, forking, f {/* Bottom row: action buttons + timestamp — inside the bubble's column, spanning its width, so the timestamp aligns with its right edge. */} -
@@ -759,7 +760,7 @@ function AssistantMessageView({ return (
@@ -879,7 +880,7 @@ function AssistantMessageView({ {!isStreaming && (texts.some((text) => text.trim()) || time || canFork || (ttsSupported && speakableText.trim().length > 0)) && (
-
+
{ttsSupported && speakableText.trim().length > 0 && ( diff --git a/components/SettingsConfig.tsx b/components/SettingsConfig.tsx index 7178468ef..6f42ecfad 100644 --- a/components/SettingsConfig.tsx +++ b/components/SettingsConfig.tsx @@ -162,6 +162,7 @@ const SETTING_INDEX: SettingIndexEntry[] = [ { id: "completion-sound", tab: "general", sectionKey: "settingsConfig.interfaceBehavior", labelKey: "settingsConfig.completionSound", descKey: "settingsConfig.completionSoundDesc", fallbackSection: "Interface & Behavior", fallbackLabel: "Completion sound", fallbackDesc: "Play a tone when the agent completes a run.", scope: "UI" }, { id: "keep-tool-calls-collapsed", tab: "general", sectionKey: "settingsConfig.interfaceBehavior", labelKey: "settingsConfig.keepToolCallsCollapsed", descKey: "settingsConfig.keepToolCallsCollapsedDesc", fallbackSection: "Interface & Behavior", fallbackLabel: "Keep tool calls collapsed", fallbackDesc: "Show only compact headers while tools execute.", scope: "UI" }, { id: "expand-thinking-by-default", tab: "general", sectionKey: "settingsConfig.interfaceBehavior", labelKey: "settingsConfig.expandThinkingByDefault", descKey: "settingsConfig.expandThinkingByDefaultDesc", fallbackSection: "Interface & Behavior", fallbackLabel: "Expand thinking blocks by default", fallbackDesc: "Open every thinking block as it appears, including while it streams, and keep it out of Process details so reasoning is readable without clicking each one. Collapsing a block by hand still works.", scope: "UI" }, + { id: "expand-process-details", tab: "general", sectionKey: "settingsConfig.interfaceBehavior", labelKey: "settingsConfig.expandProcessDetails", descKey: "settingsConfig.expandProcessDetailsDesc", fallbackSection: "Interface & Behavior", fallbackLabel: "Expand process details by default", fallbackDesc: "Open the Process details row of each turn, so thinking, intermediate replies and tool calls are visible without clicking. Collapsing a row by hand still works.", scope: "UI" }, { id: "hide-tool-activity", tab: "general", sectionKey: "settingsConfig.interfaceBehavior", labelKey: "settingsConfig.hideToolActivity", descKey: "settingsConfig.hideToolActivityDesc", fallbackSection: "Interface & Behavior", fallbackLabel: "Hide tool activity while working", fallbackDesc: "Fold a running turn's tool calls into one Process details row, the same way a finished turn folds them. Expand the row to see each call and its result.", scope: "UI" }, { id: "show-tool-calls-unfolded", tab: "general", sectionKey: "settingsConfig.interfaceBehavior", labelKey: "settingsConfig.showToolCallsUnfolded", descKey: "settingsConfig.showToolCallsUnfoldedDesc", fallbackSection: "Interface & Behavior", fallbackLabel: "Show tool calls outside Process details", fallbackDesc: "Keep each tool call's row visible in the transcript instead of folding it into Process details. Whether the row opens is still set by \"Keep tool calls collapsed\".", scope: "UI" }, { id: "never-fold-activity", tab: "general", sectionKey: "settingsConfig.interfaceBehavior", labelKey: "settingsConfig.neverFoldActivity", descKey: "settingsConfig.neverFoldActivityDesc", fallbackSection: "Interface & Behavior", fallbackLabel: "Never fold tool activity", fallbackDesc: "Show thinking, tool calls and notices as their own rows in every turn instead of folding them into Process details. Overrides \"Hide tool activity while working\".", scope: "UI" }, @@ -861,7 +862,7 @@ function CompactionMethodOrder({ value, onChange, ...aria }: { value: readonly C ); } -export function SettingsConfig({ activeTab, toolCallsDefaultCollapsed, onToolCallsDefaultCollapsedChange, hideToolActivity, onHideToolActivityChange, neverFoldActivity, onNeverFoldActivityChange, showToolCallsUnfolded, onShowToolCallsUnfoldedChange, expandThinkingByDefault, onExpandThinkingByDefaultChange, onHideThinkingBlockChange, providerUsageVisible, onProviderUsageVisibleChange, scopeNativeSelectAll, onScopeNativeSelectAllChange, openUrlAutomatically, onOpenUrlAutomaticallyChange, cwd, remoteHost, sessionId, onModelsSaved, onPluginsReloaded, appUpdate, onRefreshAppUpdate, onRequestAppUpdate, onSelectTab, onClose }: { +export function SettingsConfig({ activeTab, toolCallsDefaultCollapsed, onToolCallsDefaultCollapsedChange, hideToolActivity, onHideToolActivityChange, neverFoldActivity, onNeverFoldActivityChange, showToolCallsUnfolded, onShowToolCallsUnfoldedChange, expandThinkingByDefault, onExpandThinkingByDefaultChange, expandProcessDetails, onExpandProcessDetailsChange, onHideThinkingBlockChange, providerUsageVisible, onProviderUsageVisibleChange, scopeNativeSelectAll, onScopeNativeSelectAllChange, openUrlAutomatically, onOpenUrlAutomaticallyChange, cwd, remoteHost, sessionId, onModelsSaved, onPluginsReloaded, appUpdate, onRefreshAppUpdate, onRequestAppUpdate, onSelectTab, onClose }: { activeTab: SettingsTab; toolCallsDefaultCollapsed: boolean; onToolCallsDefaultCollapsedChange: (collapsed: boolean) => void; @@ -873,6 +874,8 @@ export function SettingsConfig({ activeTab, toolCallsDefaultCollapsed, onToolCal onShowToolCallsUnfoldedChange: (show: boolean) => void; expandThinkingByDefault: boolean; onExpandThinkingByDefaultChange: (expand: boolean) => void; + expandProcessDetails: boolean; + onExpandProcessDetailsChange: (expand: boolean) => void; onHideThinkingBlockChange?: (hide: boolean) => void; providerUsageVisible: boolean; onProviderUsageVisibleChange: (visible: boolean) => void; @@ -1282,6 +1285,9 @@ export function SettingsConfig({ activeTab, toolCallsDefaultCollapsed, onToolCal + + + diff --git a/lib/i18n/locales/en.json b/lib/i18n/locales/en.json index 0d894e18e..51cee031e 100644 --- a/lib/i18n/locales/en.json +++ b/lib/i18n/locales/en.json @@ -1484,6 +1484,8 @@ "settingsConfig.neverFoldActivityDesc": "Show thinking, tool calls and notices as their own rows in every turn instead of folding them into Process details. Overrides \"Hide tool activity while working\".", "settingsConfig.expandThinkingByDefault": "Expand thinking blocks by default", "settingsConfig.expandThinkingByDefaultDesc": "Open each thinking block as it appears, including while it streams, and keep it out of Process details so reasoning is readable without clicking every one. Collapsing a block by hand still works.", + "settingsConfig.expandProcessDetails": "Expand process details by default", + "settingsConfig.expandProcessDetailsDesc": "Open the Process details row of each turn, so thinking, intermediate replies and tool calls are visible without clicking. Collapsing a row by hand still works.", "settingsConfig.openUrlAutomatically": "Open agent links without asking", "settingsConfig.openUrlAutomaticallyDesc": "Links the agent opens from the session you are viewing open in a new tab right away. Links from other sessions always ask first. Your browser may still block pop-ups.", "settingsConfig.scopeNativeSelectAll": "Scope native Select All (experimental)", diff --git a/lib/i18n/locales/ja.json b/lib/i18n/locales/ja.json index f4da5be21..519ca6159 100644 --- a/lib/i18n/locales/ja.json +++ b/lib/i18n/locales/ja.json @@ -1443,6 +1443,8 @@ "settingsConfig.neverFoldActivityDesc": "すべてのターンで、思考・ツール呼び出し・通知を「プロセス詳細」にまとめず、それぞれ個別の行として表示します。「作業中のツール実行を隠す」より優先されます。", "settingsConfig.expandThinkingByDefault": "思考ブロックを既定で展開", "settingsConfig.expandThinkingByDefaultDesc": "各思考ブロックを表示された時点で展開し(ストリーミング中も含む)、「プロセス詳細」にまとめずに表示します。1つずつクリックせずに推論を読めます。手動での折りたたみも引き続き可能です。", + "settingsConfig.expandProcessDetails": "プロセス詳細を既定で展開", + "settingsConfig.expandProcessDetailsDesc": "各ターンの「プロセス詳細」を最初から展開し、クリックせずに思考・途中の返信・ツール呼び出しを確認できます。手動での折りたたみも引き続き可能です。", "settingsConfig.openUrlAutomatically": "エージェントのリンクを確認せずに開く", "settingsConfig.openUrlAutomaticallyDesc": "表示中のセッションでエージェントが開くリンクを、すぐに新しいタブで開きます。他のセッションからのリンクは常に確認します。ブラウザーがポップアップをブロックする場合があります。", "settingsConfig.scopeNativeSelectAll": "ネイティブの「すべて選択」の範囲を制限(試験的)", diff --git a/lib/i18n/locales/zh-CN.json b/lib/i18n/locales/zh-CN.json index 98d0c3479..d61defa5a 100644 --- a/lib/i18n/locales/zh-CN.json +++ b/lib/i18n/locales/zh-CN.json @@ -1443,6 +1443,8 @@ "settingsConfig.neverFoldActivityDesc": "在每一轮中把思考、工具调用和通知各自单独成行显示,而不是折叠进「过程详情」。优先于「工作时隐藏工具活动」。", "settingsConfig.expandThinkingByDefault": "默认展开思考块", "settingsConfig.expandThinkingByDefaultDesc": "每个思考块一出现就展开(包括流式输出过程中),并且不折叠进「过程详情」,无需逐条点击即可阅读推理内容。仍可手动折叠单个思考块。", + "settingsConfig.expandProcessDetails": "默认展开过程详情", + "settingsConfig.expandProcessDetailsDesc": "每一轮的「过程详情」默认展开,无需点击即可看到思考、中间回复和工具调用。仍可手动折叠单个过程详情。", "settingsConfig.openUrlAutomatically": "无需确认即可打开智能体链接", "settingsConfig.openUrlAutomaticallyDesc": "当前查看的会话中智能体打开的链接会立即在新标签页中打开。来自其他会话的链接始终会先询问。浏览器仍可能拦截弹出窗口。", "settingsConfig.scopeNativeSelectAll": "限制原生“全选”范围(实验性)", From 5039c90385a33e5e1c11f39e5fd0809b0d8313a1 Mon Sep 17 00:00:00 2001 From: todouu Date: Thu, 29 Oct 2026 13:57:34 +0800 Subject: [PATCH 3/6] docs(changelog): note DSH-style transcript folding and hover-only message actions --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 940751e11..8c2c2097e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -87,6 +87,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f - **The service installers set up the host daemon too.** `ompweb systemd install`, `ompweb-launchd install` and the Windows tray install now register `ompweb host` as a second unit (`ompweb-host`) next to the web service, restarting it after a 10 s delay so it can wait for the web server to write its host link on first install. `uninstall` and `status` cover both, and the tray menus show the daemon state. - **Forking a session or editing a message asks first.** The Fork button under a message and the Edit button under your own message now open a confirmation dialog, so a stray tap while scrolling no longer creates a new session or rewinds the current one. - **Expanded thinking blocks no longer collapse when a step finishes.** With "Expand thinking blocks by default" on, a thinking block opened while streaming, then moved into a closed Process details row as soon as the step committed. Thinking now stays out of the fold while the setting is on. +- **The chat transcript is quieter by default, closer to DSH.** A finished turn now shows your prompt, one collapsed "Process details" row, and the final answer. The row holds the thinking, tool calls, notices and the agent's intermediate text. A turn whose intermediate message carries a provider error stays unfolded so the error remains visible. A new setting, **Expand process details by default** (Settings → Interface & Behavior, off by default), opens that row as it appears. The per-message action buttons (copy, Markdown, read aloud, edit, fork) are hidden until the pointer is over the message or focus is inside it; touch screens always show them. - **In-app updates work when ompweb runs as a systemd service.** The update worker ran inside the service's cgroup, so stopping the server killed the worker too: nothing was installed, the service could stay down (`Restart=on-failure` does not restart a clean SIGTERM exit), and every page load reopened the update dialog at "Stop ompweb-managed sessions". The worker now runs in its own transient scope (`systemd-run --scope`) and stops, updates and starts the unit through `systemctl`, starting it again if the install fails. - **An update whose worker died is reported as failed.** A running update whose worker process is gone, or whose lease has expired, now becomes a failed attempt the dialog can show and clean up, instead of waiting forever. - **Upgrade ompweb before its hosts.** The web server links a host daemon one link protocol version older than its own, so a host keeps running sessions until its `ompweb` is updated. After a web restart the server adopts that daemon's live runs, as it does a current daemon's, without resuming them; only a large message from such a host still arrives whole instead of in pieces, which can stall that host's link on a slow connection. A daemon older than that, or newer than the web server, is still asked to upgrade. From 9291a2217a2c16012dd6589119432bd2abdd9e13 Mon Sep 17 00:00:00 2001 From: todouu Date: Thu, 29 Oct 2026 14:34:05 +0800 Subject: [PATCH 4/6] fix(chat): keep the user message timestamp visible when actions are hidden --- components/MessageView.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/MessageView.tsx b/components/MessageView.tsx index df8ddfcf5..b9f6619dd 100644 --- a/components/MessageView.tsx +++ b/components/MessageView.tsx @@ -459,10 +459,11 @@ function UserMessageView({ message, cwd, onOpenFile, entryId, onFork, forking, f {/* Bottom row: action buttons + timestamp — inside the bubble's column, spanning its width, so the timestamp aligns with its right edge. */} -
+
{(canEdit || canFork) && (
}
)} +
{time && {time}}
From 20e9ff88250dee2eab804dbaead12b8099aba01d Mon Sep 17 00:00:00 2001 From: todouu Date: Thu, 29 Oct 2026 14:38:25 +0800 Subject: [PATCH 5/6] Revert "fix(chat): keep the user message timestamp visible when actions are hidden" This reverts commit 5e947d26f5202e8209e898b93559220cf1a4aa41. --- components/MessageView.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/MessageView.tsx b/components/MessageView.tsx index b9f6619dd..df8ddfcf5 100644 --- a/components/MessageView.tsx +++ b/components/MessageView.tsx @@ -459,11 +459,10 @@ function UserMessageView({ message, cwd, onOpenFile, entryId, onFork, forking, f {/* Bottom row: action buttons + timestamp — inside the bubble's column, spanning its width, so the timestamp aligns with its right edge. */} -
-
{(canEdit || canFork) && (
}
)} -
{time && {time}}
From 46dabb420cfb62ce1e99845e7cab3b9f16f343c0 Mon Sep 17 00:00:00 2001 From: pengshuai Date: Fri, 6 Nov 2026 11:13:08 +0800 Subject: [PATCH 6/6] fix(chat): keep thinking and tool calls out of the DSH fold when their settings are on --- lib/chat-transcript-plan.ts | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/lib/chat-transcript-plan.ts b/lib/chat-transcript-plan.ts index 5765c875d..671d440f6 100644 --- a/lib/chat-transcript-plan.ts +++ b/lib/chat-transcript-plan.ts @@ -136,6 +136,9 @@ export function planTurnSegments( * turn that ends in tool calls has no answer yet, so it folds completely. * - A provider error on an intermediate message disables the fold for the turn, * so the failure stays visible in place instead of hiding inside the fold. + * - Thinking (`showThinking`) and tool calls (`showToolCalls`) arrive inside + * text segments as non-reply blocks. They stay in place; only the reply text + * around them folds. The fold sits where its first piece was. */ function foldToFinalAnswer(messages: AgentMessage[], segments: TranscriptSegment[]): TranscriptSegment[] { let finalIdx = -1; @@ -148,30 +151,41 @@ function foldToFinalAnswer(messages: AgentMessage[], segments: TranscriptSegment const final = finalIdx >= 0 ? segments[finalIdx] : null; const tail = finalIdx >= 0 ? segments.slice(finalIdx + 1) : []; - const pieces: ActivityPiece[] = []; - let toolCallCount = 0; + const out: TranscriptSegment[] = []; + const folded: Extract = { kind: "activity", pieces: [], stepCount: 0, toolCallCount: 0 }; const addPiece = (piece: ActivityPiece) => { - const prev = pieces.at(-1); + if (folded.pieces.length === 0) out.push(folded); + const prev = folded.pieces.at(-1); // Blocks of one message that were split into text/activity runs render as one entry again. if (prev?.blocks && piece.blocks && prev.index === piece.index) { - pieces[pieces.length - 1] = { index: prev.index, blocks: [...prev.blocks, ...piece.blocks] }; + folded.pieces[folded.pieces.length - 1] = { index: prev.index, blocks: [...prev.blocks, ...piece.blocks] }; } else { - pieces.push(piece); + folded.pieces.push(piece); } }; for (const segment of head) { if (segment.kind === "activity") { for (const piece of segment.pieces) addPiece(piece); - toolCallCount += segment.toolCallCount; + folded.toolCallCount += segment.toolCallCount; continue; } if ((messages[segment.index] as AssistantMessage).errorMessage?.trim()) return segments; - if (segment.blocks.length > 0) addPiece({ index: segment.index, blocks: segment.blocks }); + const runs: { reply: boolean; blocks: AssistantContentBlock[] }[] = []; + for (const block of segment.blocks) { + const reply = isReplyBlock(block); + const run = runs.at(-1); + if (run?.reply === reply) run.blocks.push(block); + else runs.push({ reply, blocks: [block] }); + } + for (const [i, run] of runs.entries()) { + if (run.reply) addPiece({ index: segment.index, blocks: run.blocks }); + else out.push({ kind: "text", index: segment.index, blocks: run.blocks, last: segment.last && i === runs.length - 1 }); + } } - if (pieces.length === 0) return segments; + if (folded.pieces.length === 0) return segments; + folded.stepCount = folded.pieces.length; - const folded: TranscriptSegment = { kind: "activity", pieces, stepCount: pieces.length, toolCallCount }; - return final ? [folded, final, ...tail] : [folded]; + return final ? [...out, final, ...tail] : out; } /**