diff --git a/src/ui/ThreadView.tsx b/src/ui/ThreadView.tsx
index 0a16f54..5cc5d61 100644
--- a/src/ui/ThreadView.tsx
+++ b/src/ui/ThreadView.tsx
@@ -2,6 +2,7 @@ import type { MouseEvent, ScrollBoxRenderable } from "@opentui/core";
import type { ThreadId, TurnItemId } from "@t3tools/contracts";
import { liveThoughtLine, workEntryDisplayIndicatesToolFailure, type ToolGroupSummaryKind } from "@t3tools/client-runtime/work-log/presentation";
import { memo, useEffect, useState, type RefObject } from "react";
+import * as DateTime from "effect/DateTime";
import { findTextSegments } from "../model/search.ts";
import { findThreadSearchOccurrences } from "@t3tools/shared/threadSearch";
import type { OrchestrationV2SearchThreadResult } from "@t3tools/contracts";
@@ -69,6 +70,8 @@ export function ThreadView(props: {
) : null}
{props.error ? {props.error} : null}
+ {/* Prose stops at reading width on wide terminals; the composer below stays full width. */}
+
{props.loading && !timeline ? Loading… : null}
{history?.hasMore || history?.error ? : null}
{timeline?.rows.filter((row) => !isPendingApprovalRow(row, pendingIds)).map((row) => (
@@ -87,6 +90,7 @@ export function ThreadView(props: {
mouse={props.mouse}
/>
))}
+
);
@@ -181,21 +185,16 @@ const Row = memo(function Row(props: {
return props.footer ? {props.footer} : null;
case "turn-fold":
case "attempt-fold":
- // The finished turn's work, folded: the web's turn separator.
+ // The finished turn's work, folded: the web's turn separator, in the work rows' columns.
return (
mouse.toggleFold(row.kind === "turn-fold" ? row.runId : row.attemptId)}>
- {(hover) => {`${row.label} ${row.expanded ? "⌄" : "›"}`}}
+ {(hover) => }
);
case "work-toggle":
return (
mouse.toggleFold(row.groupId)}>
- {(hover) => (
-
- {SUMMARY_GLYPH[row.summaryKind] ?? "•"}
- {` ${row.summary} ${row.expanded ? "⌄" : "›"}`}
-
- )}
+ {(hover) => }
);
case "work":
@@ -312,7 +311,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}
@@ -341,6 +340,35 @@ function OmittedOutput({ session, source }: { readonly session: T3Session; reado
return {state.text || "No output."};
}
+/** One work/tool line, everywhere the same: glyph, label, result details right-aligned. */
+function WorkLine(props: { readonly glyph: string; readonly glyphColor: string; readonly label: string; readonly labelColor: string; readonly detail?: string; readonly selectable?: boolean }) {
+ return (
+
+ {`${props.glyph} `}
+ {props.label}
+ {props.detail ? (
+ <>
+
+ {` ${props.detail}`}
+ >
+ ) : null}
+
+ );
+}
+
+/** What a finished entry can say on the right: a failed exit, an edit's counts, its duration. */
+function workEntryDetail(entry: WorkLogEntry): string {
+ const item = entry.structuredPayload;
+ const parts: string[] = [];
+ if (item?.type === "command_execution" && item.exitCode !== undefined && item.exitCode !== 0) parts.push(`exit ${item.exitCode}`);
+ if (item?.type === "file_change" && (item.additions || item.deletions)) parts.push(`+${item.additions ?? 0} −${item.deletions ?? 0}`);
+ if (item?.startedAt && item.completedAt) {
+ const ms = DateTime.toEpochMillis(item.completedAt) - DateTime.toEpochMillis(item.startedAt);
+ if (ms >= 1_000) parts.push(formatDuration(ms));
+ }
+ return parts.join(" · ");
+}
+
function WorkEntry({ entry, expanded: groupExpanded, label, onOpenThread, onMenu, session, streamCommandOutput, scrollRef }: { readonly entry: WorkLogEntry; readonly expanded: boolean; readonly label: string; readonly onOpenThread: (threadId: ThreadId) => void; readonly onMenu: (target: ConversationTarget) => void; readonly session: T3Session; readonly streamCommandOutput: boolean; readonly scrollRef: RefObject }) {
const [open, setExpanded] = useState(null);
const [hover, hoverProps] = useHover();
@@ -350,19 +378,15 @@ function WorkEntry({ entry, expanded: groupExpanded, label, onOpenThread, onMenu
const projected = entry.projectedItem;
const failed = workEntryDisplayIndicatesToolFailure(entry);
const child = childThreadOf(entry);
- const glyphColor = failed || entry.tone === "error" ? colors.bad : child ? colors.accent : colors.faint;
+ const glyphColor = failed || entry.tone === "error" ? colors.bad : entry.toolLifecycleStatus === "inProgress" ? colors.info : colors.faint;
const clickable = Boolean(command || child);
const labelColor = clickable && hover ? colors.text : entry.tone === "thinking" ? colors.faint : colors.muted;
- const text = (
-
- {failed ? "✕" : glyphFor(entry)}
- {` ${firstLine(label)}${child ? " ↗" : ""}`}
-
- );
+ const detail = workEntryDetail(entry);
+ const line = (text: string) => ;
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}
+ (isRightClick(event) ? onMenu({ kind: "command", command: command.input, output: command.output ?? "", omitted: command.outputOmitted === true, source }) : isLeftClick(event) ? setExpanded(!expanded) : undefined)}>{line(`${firstLine(label)} ${expanded ? "⌄" : "›"}`)}
{expanded ? (
{`$ ${command.input}`}
@@ -374,7 +398,7 @@ function WorkEntry({ entry, expanded: groupExpanded, label, onOpenThread, onMenu
) : null}
;
- return child ? isLeftClick(event) && onOpenThread(child)}>{text} : text;
+ return child ? isLeftClick(event) && onOpenThread(child)}>{line(`${firstLine(label)} ↗`)} : line(firstLine(label));
}
/** The thread a subagent work row ran in, when it has its own. */
@@ -391,10 +415,9 @@ function EventRow({ item }: { readonly item: MessagesTimelineRow extends infer R
return {block.text};
case "tool":
return (
-
- {block.icon}
- {` ${block.label}`}
-
+
+
+
);
case "approval":
return {`Approval requested: ${block.title}`};