From fc42f2b1706f5a321c80fd61f621945273bd6f2c Mon Sep 17 00:00:00 2001 From: Callum Alpass Date: Tue, 3 Nov 2026 00:17:14 +1100 Subject: [PATCH] Conversation: raised blocks and bars, no rules, no repeated title --- src/ui/CommandOutput.tsx | 4 +- src/ui/ThreadView.tsx | 85 +++++++++++++++++++++++++--------------- 2 files changed, 55 insertions(+), 34 deletions(-) diff --git a/src/ui/CommandOutput.tsx b/src/ui/CommandOutput.tsx index 408c199..7acb4ba 100644 --- a/src/ui/CommandOutput.tsx +++ b/src/ui/CommandOutput.tsx @@ -6,7 +6,7 @@ import { useEffect, useRef, useState, type RefObject } from "react"; import type { T3Session } from "../client/session.ts"; import { colors } from "./theme.ts"; -/** Only expanded command rows in the viewport subscribe; the server bounds the output tail. */ +/** Only expanded command rows in the viewport subscribe; the server bounds the output tail. The row's element block gives the padding. */ export function CommandOutput(props: { readonly session: T3Session; readonly threadId: ThreadId; readonly itemId: TurnItemId; readonly scrollRef: RefObject }) { const box = useRef(null); const [visible, setVisible] = useState(false); @@ -28,7 +28,7 @@ export function CommandOutput(props: { readonly session: T3Session; readonly thr return props.session.watchCommandOutput(props.threadId, props.itemId, setView, setError); }, [props.session, props.threadId, props.itemId, visible]); const lines = view ? terminalOutputPlainText(view.output.text).trimEnd().split("\n") : []; - return + return {error ? {`Could not load output: ${error}`} : null} {view?.output.truncated || lines.length > 12 ? Earlier output not shown : null} {lines.slice(-12).join("\n") || (view ? view.running ? "Waiting for output…" : "No output." : "Loading output…")} diff --git a/src/ui/ThreadView.tsx b/src/ui/ThreadView.tsx index 5601189..cb08fdb 100644 --- a/src/ui/ThreadView.tsx +++ b/src/ui/ThreadView.tsx @@ -10,6 +10,7 @@ import { FindText } from "./FindText.tsx"; import { Button, Buttons, isLeftClick, isRightClick, useHover } from "./Button.tsx"; import { CommandOutput } from "./CommandOutput.tsx"; +import { BAR } from "./edges.ts"; import type { T3Session, ThreadHistory } from "../client/session.ts"; import { liveWorkEntryLabel, workEntryDisplayLabel, type MessagesTimelineRow, type Timeline, type WorkLogEntry } from "../model/timeline.ts"; import { blockFor } from "../model/transcript.ts"; @@ -34,9 +35,6 @@ export interface ConversationMouse { /** The conversation, row for row as the web app derives it (MessagesTimeline.logic). */ export function ThreadView(props: { - readonly project: string; - readonly title: string; - readonly detail: string; readonly timeline: Timeline | null; readonly findQuery?: string | undefined; readonly findMatch?: OrchestrationV2SearchThreadResult["match"] | undefined; @@ -59,15 +57,7 @@ export function ThreadView(props: { const { timeline, history } = props; const pendingIds = new Set(timeline?.pending.approvals.map((approval) => approval.requestId) ?? []); return ( - - - {props.project ? `${props.project} / ` : ""} - - {props.title} - - - {props.detail} - + {props.parent ? ( props.onOpenThread(props.parent!.threadId)}> {`↰ ${props.parent.title} (u)`} @@ -108,10 +98,8 @@ function LoadEarlier({ history, onLoad }: { readonly history: ThreadHistory; rea function Divider({ label, color, onPress }: { readonly label: string; readonly color: string; readonly onPress?: (() => void) | undefined }) { const [hover, hoverProps] = useHover(); return ( - isLeftClick(event) && onPress() } : {})}> - + isLeftClick(event) && onPress() } : {})}> {` ${label} `} - ); } @@ -157,14 +145,19 @@ const Row = memo(function Row(props: { case "attempt-fold": // The finished turn's work, folded: the web's turn separator. return ( - mouse.toggleFold(row.kind === "turn-fold" ? row.runId : row.attemptId)} border> - {(hover) => {`${row.label} ${row.expanded ? "⌄" : "›"}`}} + mouse.toggleFold(row.kind === "turn-fold" ? row.runId : row.attemptId)}> + {(hover) => {`${row.label} ${row.expanded ? "⌄" : "›"}`}} ); case "work-toggle": return ( mouse.toggleFold(row.groupId)}> - {(hover) => {`${SUMMARY_GLYPH[row.summaryKind] ?? "•"} ${row.summary} ${row.expanded ? "⌄" : "›"}`}} + {(hover) => ( + + {SUMMARY_GLYPH[row.summaryKind] ?? "•"} + {` ${row.summary} ${row.expanded ? "⌄" : "›"}`} + + )} ); case "work": @@ -185,7 +178,12 @@ const Row = memo(function Row(props: { case "working": { const since = props.workStartedAt ? Date.parse(props.workStartedAt) : NaN; const verb = row.compacting ? "Compacting" : "Working"; - return {Number.isFinite(since) ? `◐ ${verb} for ${formatWorkingDurationLabel(props.now - since)}` : `◐ ${verb}…`}; + return ( + + ◐ + {Number.isFinite(since) ? ` ${verb} for ${formatWorkingDurationLabel(props.now - since)}` : ` ${verb}…`} + + ); } case "thinking": return ∴ Thinking…; @@ -194,7 +192,7 @@ const Row = memo(function Row(props: { case "proposed-plan": if (props.findQuery) return ; return ( - + Plan @@ -204,7 +202,12 @@ const Row = memo(function Row(props: { case "event": return ; case "worktree-setup": - return ◐ Setting up worktree…; + return ( + + ◐ + {" Setting up worktree…"} + + ); default: // assistant-meta, html-render, mcp-app: nothing a terminal can show. return null; @@ -214,7 +217,7 @@ const Row = memo(function Row(props: { const USER_FOLD_LINES = 8; const USER_FOLD_CHARS = 600; -/** The web's user bubble: right-aligned, at most 80% wide, folded past 8 lines or 600 characters. */ +/** Your message: a full-width raised block, folded past 8 lines or 600 characters. */ function UserMessage({ text, messageId, selected, onSelect, onMenu }: { readonly text: string; readonly messageId: string; readonly selected: boolean; readonly onSelect: () => void; readonly onMenu: () => void }) { const [hover, hoverProps] = useHover(); const trimmed = text.trim(); @@ -223,7 +226,7 @@ function UserMessage({ text, messageId, selected, onSelect, onMenu }: { readonly if (shown.length > USER_FOLD_CHARS) shown = `${shown.slice(0, USER_FOLD_CHARS).trimEnd()}…`; const folded = shown.length < trimmed.length; return ( - (isRightClick(event) ? onMenu() : isLeftClick(event) ? onSelect() : undefined)}> + (isRightClick(event) ? onMenu() : isLeftClick(event) ? onSelect() : undefined)}> {shown} {folded ? {`… ${Math.max(1, lines.length - shown.split("\n").length)} more lines`} : null} @@ -261,16 +264,29 @@ function WorkEntry({ entry, expanded: groupExpanded, label, onOpenThread, onMenu const projected = entry.projectedItem; const failed = workEntryDisplayIndicatesToolFailure(entry); const child = childThreadOf(entry); - const tone = failed || entry.tone === "error" ? colors.bad : child ? colors.accent : entry.tone === "thinking" ? colors.faint : colors.muted; + const glyphColor = failed || entry.tone === "error" ? colors.bad : child ? colors.accent : colors.faint; const clickable = Boolean(command || child); - const text = {`${failed ? "✕" : glyphFor(entry)} ${firstLine(label)}${child ? " ↗" : ""}`}; + const labelColor = clickable && hover ? colors.text : entry.tone === "thinking" ? colors.faint : colors.muted; + const text = ( + + {failed ? "✕" : glyphFor(entry)} + {` ${firstLine(label)}${child ? " ↗" : ""}`} + + ); const source = projected ? { threadId: projected.sourceThreadId, itemId: projected.sourceItemId } : null; const streaming = expanded && streamCommandOutput && source !== null; if (command) return (isRightClick(event) ? onMenu({ kind: "command", command: command.input, output: command.output ?? "", omitted: command.outputOmitted === true, source }) : isLeftClick(event) ? setExpanded(!expanded) : undefined)}>{expanded ? "⌄ " : "› "}{text} - {streaming ? - : expanded && command.outputOmitted ? - : expanded ? {command.output || "No output."} : null} + {expanded ? ( + + {`$ ${command.input}`} + + {streaming ? + : command.outputOmitted ? + : {command.output || "No output."}} + + + ) : null} ; return child ? isLeftClick(event) && onOpenThread(child)}>{text} : text; } @@ -284,7 +300,7 @@ export function childThreadOf(entry: WorkLogEntry): ThreadId | null { function EventRow({ item, pending, onRespond }: { readonly onRespond: (decision: ProviderApprovalDecision) => void; readonly item: MessagesTimelineRow extends infer R ? (R extends { kind: "event"; projectedItem: { item: infer I } } ? I : never) : never; readonly pending: boolean }) { if (item.type === "approval_request" && pending) { return ( - + {approvalTitle(item.requestKind)} @@ -304,7 +320,12 @@ function EventRow({ item, pending, onRespond }: { readonly onRespond: (decision: case "notice": return {block.text}; case "tool": - return {`${block.icon} ${block.label}`}; + return ( + + {block.icon} + {` ${block.label}`} + + ); case "approval": return {`Approval requested: ${block.title}`}; case "question": @@ -329,10 +350,10 @@ function eventRequestId(row: Extract): s } /** A folded turn or work group: a click opens or closes just this one. */ -function Toggle({ onPress, border, children }: { readonly onPress: () => void; readonly border?: boolean; readonly children: (hover: boolean) => React.ReactNode }) { +function Toggle({ onPress, children }: { readonly onPress: () => void; readonly children: (hover: boolean) => React.ReactNode }) { const [hover, hoverProps] = useHover(); return ( - isLeftClick(event) && onPress()}> + isLeftClick(event) && onPress()}> {children(hover)} );