feat(renderer): simplify thread UI and reduce work-log noise

- remove model picker when creating projects and default to the project model

- add Cmd+Shift+O shortcut to open a new thread in the active project

- remove project/status pills from chat chrome for a cleaner layout

- only surface actionable item lifecycle events (tool/command/file change)

- add tests covering reasoning and agent-message filtering
This commit is contained in:
Theo Browne committed 2026-02-08 23:09:54 -08:00
1 parent 1bd823cd20
commit de5df2690d
6 files changed
+235 -136

No files matched your search

+4 -7
View File
@@ -1,9 +1,6 @@
## TODO
- [x] Fix sort order for threads (newest first)
- [x] Indicate in thread list which threads are currently working
- [x] Logs should be per-thread, not a single events.txt
- [x] Audit the logs to identify which events are (and aren't) worth showing to the user, i.e. drop "preamble" and "work" events
- [x] Make the "end message" stand out from the work done prior (maybe just a bar between the two that says "worked for 10 minutes 31 seconds" or however long it was)
- [x] Better logging of "time to complete" (I want this more than the timestamps tbh)
- [x] Remove the left bars on messages to make UI feel "flatter"
- [x] Remove model picker from new project menu
- [x] CMD+Shift+O to create new thread in current project
- [x] Remove project title pill from input box and topnav
- [x] Remove connection status from topnav
+6 -56
View File
@@ -32,13 +32,6 @@ function formatMessageMeta(createdAt: string, duration: string | null): string {
return `${formatTimestamp(createdAt)} • ${duration}`;
}
function statusLabel(phase: string): string {
if (phase === "running") return "Thinking / working";
if (phase === "connecting") return "Connecting";
if (phase === "ready") return "Ready";
return "Disconnected";
}
function workToneClass(tone: "thinking" | "tool" | "info" | "error"): string {
if (tone === "error") return "text-rose-300/50";
if (tone === "tool") return "text-[#8a8a8a]";
@@ -69,13 +62,11 @@ export default function ChatView() {
);
const phase = derivePhase(activeThread?.session ?? null);
const isWorking = phase === "running" || isSending || isConnecting;
const workLogTurnId =
activeThread?.latestTurnId ?? activeThread?.session?.activeTurnId;
const nowIso = new Date(nowTick).toISOString();
const modelOptions = MODEL_OPTIONS;
const workLogEntries = useMemo(
() => deriveWorkLogEntries(activeThread?.events ?? [], workLogTurnId),
[activeThread?.events, workLogTurnId],
() => deriveWorkLogEntries(activeThread?.events ?? [], undefined),
[activeThread?.events],
);
const assistantCompletionByItemId = useMemo(() => {
const map = new Map<string, string>();
@@ -320,47 +311,8 @@ export default function ChatView() {
<h2 className="text-sm font-medium text-[#e0e0e0]">
{activeThread.title}
</h2>
{activeProject && (
<span className="rounded-full bg-white/[0.06] px-2 py-0.5 text-[10px] text-[#a0a0a0]/50">
{activeProject.name}
</span>
)}
</div>
<div className="flex items-center gap-3">
{/* Status indicator */}
<div
className={`inline-flex items-center gap-2 rounded-full border px-2.5 py-1 text-[10px] ${
phase === "running"
? "border-sky-400/35 bg-sky-500/[0.08] text-sky-100"
: phase === "connecting"
? "border-amber-400/35 bg-amber-500/[0.08] text-amber-100"
: phase === "ready"
? "border-emerald-400/35 bg-emerald-500/[0.08] text-emerald-100"
: "border-white/[0.08] bg-white/[0.04] text-[#a0a0a0]/70"
}`}
>
<span className="relative inline-flex h-2.5 w-2.5">
{(phase === "running" || phase === "connecting") && (
<span
className={`absolute inline-flex h-full w-full animate-ping rounded-full ${
phase === "running" ? "bg-sky-300/70" : "bg-amber-300/70"
}`}
/>
)}
<span
className={`relative inline-flex h-2.5 w-2.5 rounded-full ${
phase === "running"
? "bg-sky-200"
: phase === "connecting"
? "bg-amber-200"
: phase === "ready"
? "bg-emerald-200"
: "bg-[#a0a0a0]/40"
}`}
/>
</span>
<span>{statusLabel(phase)}</span>
</div>
{/* Diff toggle */}
<button
type="button"
@@ -418,7 +370,10 @@ export default function ChatView() {
{timelineEntry.entry.detail ? (
<>
{timelineEntry.entry.label}
<span className="ml-1.5 font-mono text-[11px] opacity-60">
<span
className="ml-1.5 inline-block max-w-[70ch] truncate align-bottom font-mono text-[11px] opacity-60"
title={timelineEntry.entry.detail}
>
{timelineEntry.entry.detail}
</span>
</>
@@ -634,11 +589,6 @@ export default function ChatView() {
{/* Right side: send / stop button */}
<div className="flex items-center gap-2">
{activeProject && (
<span className="text-[11px] text-[#a0a0a0]/25">
{activeProject.name}
</span>
)}
{phase === "running" ? (
<button
type="button"
+63 -39
View File
@@ -1,5 +1,5 @@
import { useMemo, useState } from "react";
import { DEFAULT_MODEL, MODEL_OPTIONS, resolveModelSlug } from "../model-logic";
import { useCallback, useEffect, useMemo, useState } from "react";
import { DEFAULT_MODEL } from "../model-logic";
import { readNativeApi } from "../session-logic";
import { useStore } from "../store";
import type { Project } from "../types";
@@ -27,45 +27,45 @@ export default function Sidebar() {
const api = useMemo(() => readNativeApi(), []);
const [addingProject, setAddingProject] = useState(false);
const [newCwd, setNewCwd] = useState("");
const [newModel, setNewModel] = useState(DEFAULT_MODEL);
const [isPickingFolder, setIsPickingFolder] = useState(false);
const handleAddProject = () => {
const cwd = newCwd.trim();
if (!cwd) return;
const name = cwd.split("/").filter(Boolean).pop() ?? "project";
const normalizedModel = resolveModelSlug(newModel);
const project: Project = {
id: crypto.randomUUID(),
name,
cwd,
model: normalizedModel,
model: DEFAULT_MODEL,
expanded: true,
};
dispatch({ type: "ADD_PROJECT", project });
setNewCwd("");
setNewModel(DEFAULT_MODEL);
setAddingProject(false);
};
const handleNewThread = (projectId: string) => {
dispatch({
type: "ADD_THREAD",
thread: {
id: crypto.randomUUID(),
projectId,
title: "New thread",
model:
state.projects.find((p) => p.id === projectId)?.model ??
DEFAULT_MODEL,
session: null,
messages: [],
events: [],
error: null,
createdAt: new Date().toISOString(),
},
});
};
const handleNewThread = useCallback(
(projectId: string) => {
dispatch({
type: "ADD_THREAD",
thread: {
id: crypto.randomUUID(),
projectId,
title: "New thread",
model:
state.projects.find((p) => p.id === projectId)?.model ??
DEFAULT_MODEL,
session: null,
messages: [],
events: [],
error: null,
createdAt: new Date().toISOString(),
},
});
},
[dispatch, state.projects],
);
const handlePickFolder = async () => {
if (!api || isPickingFolder) return;
@@ -79,6 +79,45 @@ export default function Sidebar() {
}
};
useEffect(() => {
const onWindowKeyDown = (event: KeyboardEvent) => {
const isNewThreadShortcut =
event.metaKey &&
event.shiftKey &&
!event.ctrlKey &&
!event.altKey &&
event.key.toLowerCase() === "o";
if (!isNewThreadShortcut) return;
const target = event.target;
if (target instanceof HTMLElement) {
const tagName = target.tagName;
if (
target.isContentEditable ||
tagName === "INPUT" ||
tagName === "TEXTAREA" ||
tagName === "SELECT"
) {
return;
}
}
const activeThread = state.threads.find(
(t) => t.id === state.activeThreadId,
);
const projectId = activeThread?.projectId ?? state.projects[0]?.id;
if (!projectId) return;
event.preventDefault();
handleNewThread(projectId);
};
window.addEventListener("keydown", onWindowKeyDown);
return () => {
window.removeEventListener("keydown", onWindowKeyDown);
};
}, [handleNewThread, state.activeThreadId, state.projects, state.threads]);
return (
<aside className="sidebar flex h-full w-[260px] shrink-0 flex-col border-r border-white/[0.08] bg-[#141414]">
{/* Drag region / traffic light space */}
@@ -238,21 +277,6 @@ export default function Sidebar() {
{isPickingFolder ? "Picking folder..." : "Browse for folder"}
</button>
)}
<select
className="mb-2 w-full rounded-md border border-white/[0.1] bg-white/[0.04] px-2 py-1.5 font-mono text-xs text-[#e0e0e0] placeholder:text-[#a0a0a0]/30 focus:border-white/30 focus:outline-none"
value={newModel}
onChange={(e) => setNewModel(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Enter") handleAddProject();
if (e.key === "Escape") setAddingProject(false);
}}
>
{MODEL_OPTIONS.map((model) => (
<option key={model} value={model} className="bg-[#141414]">
{model}
</option>
))}
</select>
<div className="flex gap-2">
<button
type="button"
+125
View File
@@ -161,6 +161,131 @@ describe("deriveWorkLogEntries", () => {
expect(entries[0]?.label).toBe("Turn complete in 10s");
});
it("hides reasoning and agent-message noise from the visible work log", () => {
const entries = deriveWorkLogEntries(
[
makeEvent({
id: "evt-turn-start",
method: "turn/started",
turnId: "turn-1",
createdAt: "2026-02-08T10:00:00.000Z",
}),
makeEvent({
id: "evt-summary-part",
method: "item/reasoning/summaryPartAdded",
turnId: "turn-1",
createdAt: "2026-02-08T10:00:01.000Z",
}),
makeEvent({
id: "evt-summary-delta",
method: "item/reasoning/summaryTextDelta",
turnId: "turn-1",
createdAt: "2026-02-08T10:00:02.000Z",
}),
makeEvent({
id: "evt-agent-start",
method: "item/started",
turnId: "turn-1",
createdAt: "2026-02-08T10:00:03.000Z",
payload: {
item: { id: "item-msg", type: "agentMessage", text: "Working..." },
},
}),
makeEvent({
id: "evt-agent-complete",
method: "item/completed",
turnId: "turn-1",
createdAt: "2026-02-08T10:00:04.000Z",
payload: {
item: {
id: "item-msg",
type: "agentMessage",
text: "Done response",
},
},
}),
makeEvent({
id: "evt-tool-start",
method: "item/started",
turnId: "turn-1",
createdAt: "2026-02-08T10:00:05.000Z",
payload: {
item: { id: "item-tool", type: "tool_call", command: "ls -la" },
},
}),
makeEvent({
id: "evt-tool-complete",
method: "item/completed",
turnId: "turn-1",
createdAt: "2026-02-08T10:00:06.000Z",
payload: {
item: { id: "item-tool", type: "tool_call", command: "ls -la" },
},
}),
makeEvent({
id: "evt-turn-complete",
method: "turn/completed",
turnId: "turn-1",
createdAt: "2026-02-08T10:00:08.000Z",
payload: { turn: { id: "turn-1", status: "completed" } },
}),
],
"turn-1",
);
expect(entries.map((entry) => entry.label)).toEqual([
"Turn complete in 8.0s",
"Tool call complete",
"Tool call",
]);
});
it("preserves full tool-call detail text without data truncation", () => {
const longCommand =
'node ./scripts/sync.js --project ct-round-5 --mode dry-run --include "very long argument with lots of detail and metadata to verify there is no hard truncation in session logic"';
const entries = deriveWorkLogEntries(
[
makeEvent({
id: "evt-tool-start",
method: "item/started",
turnId: "turn-1",
createdAt: "2026-02-08T10:00:05.000Z",
payload: {
item: { id: "item-tool", type: "tool_call", command: longCommand },
},
}),
],
"turn-1",
);
expect(entries[0]?.detail).toBe(longCommand);
});
it("can derive work-log entries across all turns when not scoped", () => {
const entries = deriveWorkLogEntries(
[
makeEvent({
id: "evt-turn-1-tool",
method: "item/started",
turnId: "turn-1",
createdAt: "2026-02-08T10:00:01.000Z",
payload: { item: { type: "tool_call", command: "ls -la" } },
}),
makeEvent({
id: "evt-turn-2-tool",
method: "item/started",
turnId: "turn-2",
createdAt: "2026-02-08T10:00:02.000Z",
payload: { item: { type: "tool_call", command: "pwd" } },
}),
],
undefined,
);
expect(entries).toHaveLength(2);
expect(entries.map((entry) => entry.detail)).toEqual(["pwd", "ls -la"]);
});
});
describe("evolveSession", () => {
+36 -33
View File
@@ -86,14 +86,20 @@ export type TimelineEntry =
entry: WorkLogEntry;
};
function truncateLine(value: string, limit = 140): string {
if (value.length <= limit) return value;
return `${value.slice(0, limit - 1)}…`;
function normalizeDetail(value: string | undefined): string | undefined {
if (!value) return undefined;
const trimmed = value.trim();
return trimmed.length > 0 ? trimmed : undefined;
}
function normalizeItemType(raw: string | undefined): string {
if (!raw) return "item";
return raw.replace(/[_-]/g, " ").replace(/\s+/g, " ").trim().toLowerCase();
return raw
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
.replace(/[._/-]/g, " ")
.replace(/\s+/g, " ")
.trim()
.toLowerCase();
}
function shouldDropItemType(type: string): boolean {
@@ -108,23 +114,30 @@ function shouldDropItemType(type: string): boolean {
return type === "work" || type.startsWith("work ");
}
function shouldShowItemLifecycle(type: string): boolean {
return (
type.includes("tool") ||
type.includes("command") ||
type.includes("file change")
);
}
function shouldDropMethod(method: string): boolean {
return /(^|\/)(preamble|work)(\/|$)/i.test(method);
return /(^|\/)(preamble|work|reasoning|thought)(\/|$)/i.test(method);
}
function itemTypeMeta(type: string): {
label: string;
tone: WorkLogEntry["tone"];
} {
if (
type.includes("tool") ||
type.includes("command") ||
type.includes("file change")
) {
return { label: "Tool call", tone: "tool" };
if (type.includes("command")) {
return { label: "Command run", tone: "tool" };
}
if (type.includes("agent message")) {
return { label: "Drafting response", tone: "thinking" };
if (type.includes("file change")) {
return { label: "File change", tone: "tool" };
}
if (type.includes("tool")) {
return { label: "Tool call", tone: "tool" };
}
return { label: "Work item", tone: "info" };
}
@@ -144,9 +157,8 @@ function extractDetail(
];
for (const candidate of candidates) {
if (candidate && candidate.trim().length > 0) {
return truncateLine(candidate.trim());
}
const detail = normalizeDetail(candidate);
if (detail) return detail;
}
return undefined;
}
@@ -158,6 +170,9 @@ function entryFromItemLifecycle(event: ProviderEvent): WorkLogEntry | null {
if (shouldDropItemType(normalizedType) || shouldDropMethod(event.method)) {
return null;
}
if (!shouldShowItemLifecycle(normalizedType)) {
return null;
}
const meta = itemTypeMeta(normalizedType);
const isStarted = event.method === "item/started";
@@ -234,6 +249,7 @@ function entryFromNotification(
const status = asString(turn?.status);
const turnError = asObject(turn?.error);
const turnErrorMessage = asString(turnError?.message);
const turnErrorDetail = normalizeDetail(turnErrorMessage);
const eventAt = Date.parse(event.createdAt);
const durationMs =
Number.isNaN(turnStartedAt) ||
@@ -251,7 +267,7 @@ function entryFromNotification(
: durationMs !== undefined
? `Turn complete in ${formatDuration(durationMs)}`
: "Turn complete",
...(turnErrorMessage ? { detail: truncateLine(turnErrorMessage) } : {}),
...(turnErrorDetail ? { detail: turnErrorDetail } : {}),
tone: status === "failed" ? "error" : "info",
};
}
@@ -259,21 +275,7 @@ function entryFromNotification(
const lifecycleEntry = entryFromItemLifecycle(event);
if (lifecycleEntry) return lifecycleEntry;
if (event.method.startsWith("item/")) {
const payload = asObject(event.payload);
const item = asObject(payload?.item);
const normalizedType = normalizeItemType(asString(item?.type));
if (shouldDropItemType(normalizedType)) {
return null;
}
return {
id: event.id,
createdAt: event.createdAt,
label: `Event: ${event.method.replace(/^item\//, "")}`,
tone: "info",
};
}
if (event.method.startsWith("item/")) return null;
return null;
}
@@ -281,12 +283,13 @@ function entryFromNotification(
function entryFromError(event: ProviderEvent): WorkLogEntry | null {
if (event.kind !== "error") return null;
if (shouldDropMethod(event.method)) return null;
const detail = normalizeDetail(event.message);
return {
id: event.id,
createdAt: event.createdAt,
label: "Runtime error",
...(event.message ? { detail: truncateLine(event.message) } : {}),
...(detail ? { detail } : {}),
tone: "error",
};
}
+1 -1
View File
@@ -217,7 +217,7 @@ function reducer(state: AppState, action: Action): AppState {
event,
activeAssistantItemRef,
),
events: [event, ...t.events].slice(0, 200),
events: [event, ...t.events],
error:
event.kind === "error" && event.message ? event.message : t.error,
...updateTurnFields(t, event),