Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Simplify chat actions and saved conversation chrome

justrach859c51b7ff91
diff --git a/apps/native/components/primitives/ActionMenu.tsx b/apps/native/components/primitives/ActionMenu.tsx
new file mode 100644
index 00000000..4d564631
--- /dev/null
+++ b/apps/native/components/primitives/ActionMenu.tsx
@@ -0,0 +1,37 @@
+"use client";
+import { useId, useRef, useState, type ReactNode } from "react";
+
+/** Native popover: top-layer placement, outside dismissal, Escape and focus return. */
+export default function ActionMenu({ label, text = "…", children, className = "" }: {
+ label: string; text?: string; children: ReactNode; className?: string;
+}) {
+ const id = useId();
+ const trigger = useRef<HTMLButtonElement>(null);
+ const panel = useRef<HTMLDivElement>(null);
+ const [open, setOpen] = useState(false);
+ const position = () => {
+ if (!panel.current || !trigger.current) return;
+ const anchor = trigger.current.getBoundingClientRect();
+ const box = panel.current.getBoundingClientRect();
+ panel.current.style.left = `${Math.max(8, Math.min(anchor.right - box.width, window.innerWidth - box.width - 8))}px`;
+ panel.current.style.top = `${Math.max(8, Math.min(anchor.bottom + 6, window.innerHeight - box.height - 8))}px`;
+ };
+ return <span className={className}>
+ <button ref={trigger} type="button" popoverTarget={id} aria-label={label} aria-expanded={open} aria-haspopup="dialog"
+ className="flex h-7 min-w-7 items-center justify-center rounded-md px-2 text-xs text-ink-2 hover:bg-hover focus-visible:outline-auto">{text}</button>
+ <div ref={panel} id={id} popover="auto" role="dialog" aria-label={label}
+ onToggle={event => { const opened = event.newState === "open"; setOpen(opened); if (opened) { position(); panel.current?.querySelector<HTMLButtonElement>("button:not(:disabled)")?.focus(); } }}
+ onClick={event => { if ((event.target as Element).closest("button:not(:disabled)")) panel.current?.hidePopover(); }}
+ className="fixed m-0 max-h-[calc(100dvh-16px)] w-52 overflow-y-auto rounded-lg border border-line bg-surface p-1.5 text-ink shadow-overlay [&>button]:flex [&>button]:w-full [&>button]:justify-start [&>button]:rounded-md [&>button]:px-3 [&>button]:py-2 [&>button]:text-left [&>button]:text-xs [&>button:hover]:bg-hover">
+ {children}
+ </div>
+ </span>;
+}
+
+/** Dialogs launched from a menu return focus to its visible trigger. */
+export function restoreActionFocus(trigger: HTMLButtonElement | null) {
+ const menu = trigger?.closest<HTMLElement>("[popover]");
+ if (menu && !menu.matches(":popover-open")) {
+ document.querySelector<HTMLButtonElement>(`[popovertarget="${CSS.escape(menu.id)}"]`)?.focus();
+ } else trigger?.focus();
+}
diff --git a/apps/native/components/primitives/SidebarNav.tsx b/apps/native/components/primitives/SidebarNav.tsx
index 9e787891..b4b9b112 100644
--- a/apps/native/components/primitives/SidebarNav.tsx
+++ b/apps/native/components/primitives/SidebarNav.tsx
@@ -19,6 +19,7 @@ import {
} from "@/lib/icons";
import CodeGraffMark from "./CodeGraffMark";
import GlideMenu from "@/components/primitives/GlideMenu";
+import ActionMenu from "./ActionMenu";
import WorkspaceMenu from "./WorkspaceMenu";
/* ─────────────────────────────────────────────────────────
@@ -446,7 +447,7 @@ export default function SidebarNav({
active ? "bg-hover-2 group-hover/glide:bg-transparent" : ""
}`}
>
- <span className={`sidebar-copy flex min-w-0 flex-1 flex-col ${onArchiveRecent || onDeleteRecent ? "pr-14" : ""}`}>
+ <span className={`sidebar-copy flex min-w-0 flex-1 flex-col ${onArchiveRecent || onDeleteRecent ? "pr-6" : ""}`}>
<span className={`truncate text-[13.5px] font-medium ${active ? "text-ink" : "text-ink-2"}`}>
{item.label}
</span>
@@ -455,42 +456,11 @@ export default function SidebarNav({
)}
</span>
</button>
- {(onArchiveRecent || onDeleteRecent) && (
- <span className="sidebar-copy absolute inset-y-0 right-3 z-20 flex items-center gap-0.5 opacity-0 transition-opacity group-focus-within/row:opacity-100 group-hover/row:opacity-100">
- {onArchiveRecent && (
- <button
- type="button"
- aria-label={`Archive ${item.label}`}
- title="Archive this chat — it leaves the list but stays on disk"
- onClick={(event) => {
- event.stopPropagation();
- onArchiveRecent(item.id);
- }}
- className="flex size-6 items-center justify-center rounded-[6px] text-ink-3 transition-colors hover:bg-hover-2 hover:text-ink"
- >
- <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden>
- <rect x="3" y="4" width="18" height="4" rx="1" />
- <path d="M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M10 12h4" />
- </svg>
- </button>
- )}
- {onDeleteRecent && (
- <button
- type="button"
- aria-label={`Delete ${item.label}`}
- title="Delete this chat for good"
- onClick={(event) => {
- event.stopPropagation();
- onDeleteRecent(item.id);
- }}
- className="flex size-6 items-center justify-center rounded-[6px] text-ink-3 transition-colors hover:bg-hover-2 hover:text-red"
- >
- <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden>
- <path d="M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3" />
- </svg>
- </button>
- )}
- </span>
+ {!collapsed && (onArchiveRecent || onDeleteRecent) && (
+ <ActionMenu label={`Actions for ${item.label}`} className="absolute right-3 top-2 z-20 opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100">
+ {onArchiveRecent && <button type="button" aria-label={`Archive ${item.label}`} onClick={() => onArchiveRecent(item.id)}>Archive chat</button>}
+ {onDeleteRecent && <button type="button" aria-label={`Delete ${item.label}`} className="text-red" onClick={() => onDeleteRecent(item.id)}>Delete chat…</button>}
+ </ActionMenu>
)}
</div>
</Fragment>
diff --git a/apps/native/components/site/ChatBubbles.tsx b/apps/native/components/site/ChatBubbles.tsx
index b4d87d9a..076ceb85 100644
--- a/apps/native/components/site/ChatBubbles.tsx
+++ b/apps/native/components/site/ChatBubbles.tsx
@@ -144,7 +144,7 @@ export const AssistantBody = memo(function AssistantBody({
</div>
),
)}
- <TurnActivity turn={turn} snapshot={snapshot} />
+ {!snapshot && <TurnActivity turn={turn} />}
{turn.error && (
<p role="alert" className="mt-4 max-w-[620px] text-[13.5px] leading-[1.65] text-red">{turn.error}</p>
)}
diff --git a/apps/native/components/site/ChatTranscript.tsx b/apps/native/components/site/ChatTranscript.tsx
index e5abb69a..e15500e1 100644
--- a/apps/native/components/site/ChatTranscript.tsx
+++ b/apps/native/components/site/ChatTranscript.tsx
@@ -51,11 +51,6 @@ export default memo(function ChatTranscript({ messages, register, following, onO
}, []);
return <div ref={registerScroller} data-chat-transcript data-following={following}
className="min-h-0 min-w-0 max-w-full flex-1 overflow-x-hidden overflow-y-auto overscroll-contain" style={{ overflowAnchor: "none" }}>
- {snapshot && (
- <p role="status" data-session-snapshot className="mx-auto max-w-[720px] px-4 pt-4 text-[12.5px] leading-relaxed text-ink-2 sm:px-8">
- Saved snapshot — this view is not attached to a live REPL run. A follow-up continues here in the GUI.
- </p>
- )}
<div data-transcript-content className="mx-auto flex w-full max-w-[720px] flex-col gap-8 px-4 py-8 sm:px-8">
{start > 0 && <button type="button" className="self-center rounded-lg bg-field px-3 py-2 text-xs text-ink-2 hover:bg-hover" onClick={() => {
const el = scroller.current;
diff --git a/apps/native/components/site/DesktopSettings.tsx b/apps/native/components/site/DesktopSettings.tsx
index 48c3dcb1..474cd300 100644
--- a/apps/native/components/site/DesktopSettings.tsx
+++ b/apps/native/components/site/DesktopSettings.tsx
@@ -1,9 +1,10 @@
"use client";
import { useEffect, useRef, useState } from "react";
import { createPortal } from "react-dom";
+import { restoreActionFocus } from "../primitives/ActionMenu";
import { desktop, type LinkDestination } from "@/lib/desktop";
-export default function DesktopSettings() {
+export default function DesktopSettings({ labeled = false }: { labeled?: boolean }) {
const [available, setAvailable] = useState(false);
const [open, setOpen] = useState(false);
const [destination, setDestination] = useState<LinkDestination | null>(null);
@@ -20,7 +21,7 @@ export default function DesktopSettings() {
.catch(() => { if (alive) setError("Could not load link settings. Close Settings and try again."); });
panel.current?.querySelector<HTMLButtonElement>("button")?.focus();
const keys = (event: KeyboardEvent) => {
- if (event.key === "Escape") { event.stopPropagation(); setOpen(false); trigger.current?.focus(); }
+ if (event.key === "Escape") { event.stopPropagation(); setOpen(false); restoreActionFocus(trigger.current); }
if (event.key === "Tab") {
const buttons = Array.from(panel.current?.querySelectorAll<HTMLButtonElement>("button:not(:disabled)") ?? []);
if (!buttons.length) return;
@@ -42,13 +43,13 @@ export default function DesktopSettings() {
return <>
<button ref={trigger} aria-label="Settings" title="Settings" aria-haspopup="dialog" aria-expanded={open}
onClick={() => setOpen(value => !value)} className="flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-3 hover:bg-hover hover:text-ink">
- <svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7"><path d="m9 3-1 3-3 1 1 3-2 2 2 2-1 3 3 1 1 3h6l1-3 3-1-1-3 2-2-2-2 1-3-3-1-1-3Z"/><circle cx="12" cy="12" r="3"/></svg>
+ {labeled ? "Settings" : <svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7"><path d="m9 3-1 3-3 1 1 3-2 2 2 2-1 3 3 1 1 3h6l1-3 3-1-1-3 2-2-2-2 1-3-3-1-1-3Z"/><circle cx="12" cy="12" r="3"/></svg>}
</button>
{open && createPortal(<div className="fixed inset-0 z-[200] flex items-center justify-center bg-black/20 p-4" onPointerDown={event => {
- if (event.target === event.currentTarget) { setOpen(false); trigger.current?.focus(); }
+ if (event.target === event.currentTarget) { setOpen(false); restoreActionFocus(trigger.current); }
}}>
<div ref={panel} role="dialog" aria-label="Settings" aria-modal="true" className="w-[380px] max-w-full rounded-xl border border-line bg-surface p-4 shadow-overlay">
- <div className="mb-4 flex items-center justify-between"><strong className="text-sm font-medium">Settings</strong><button aria-label="Close settings" onClick={() => { setOpen(false); trigger.current?.focus(); }} className="rounded px-1.5 text-ink-3 hover:bg-hover">×</button></div>
+ <div className="mb-4 flex items-center justify-between"><strong className="text-sm font-medium">Settings</strong><button aria-label="Close settings" onClick={() => { setOpen(false); restoreActionFocus(trigger.current); }} className="rounded px-1.5 text-ink-3 hover:bg-hover">×</button></div>
<fieldset disabled={destination === null || saving}>
<legend className="mb-1 text-xs font-medium">Open web links in</legend>
<p className="mb-3 text-xs text-ink-3">Choose where links from conversations open. Graff keeps pages beside your chat.</p>
diff --git a/apps/native/components/site/HarnessChrome.tsx b/apps/native/components/site/HarnessChrome.tsx
index eb1594d8..ffd7ff04 100644
--- a/apps/native/components/site/HarnessChrome.tsx
+++ b/apps/native/components/site/HarnessChrome.tsx
@@ -1,6 +1,6 @@
import SplitLayoutIcon from "./SplitLayoutIcon";
import type {SplitTree} from "@/lib/split-tree";
-import { IconChat, IconFolder, IconGlobe } from "@/lib/icons";
+import ActionMenu from "@/components/primitives/ActionMenu";
import { useEffect, useRef } from "react";
import { ThemeToggle } from "./ThemeToggle";
import DesktopSettings from "./DesktopSettings";
@@ -88,81 +88,20 @@ export default function HarnessChrome({chats, activeId, busyIds, focusChat, clos
</svg>
</button>
</div>
- <div className={`${reviewStyles.actions} flex min-h-10 shrink-0 items-center gap-2 overflow-x-auto border-t border-line px-2 py-1`}>
- <button
- type="button"
- aria-pressed={conversationsOpen}
- onClick={openConversations}
- title="All conversations"
- className={`flex h-7 items-center gap-1.5 rounded-[7px] px-2 text-[12px] font-medium transition-colors duration-100 ${
- conversationsOpen ? "bg-hover-2 text-ink" : "text-ink-2 hover:bg-hover hover:text-ink"
- }`}
- >
- <IconChat size={14} />
- <span data-toolbar-label className="hidden sm:inline">Chats</span>
- </button>
- <button
- type="button"
- aria-pressed={split}
- onClick={toggleSplit}
- title={split ? "Close the splits (⌘\\)" : "Split the view: another chat beside this one (⌘D adds one)"}
- className={`flex size-7 items-center justify-center rounded-[7px] transition-colors duration-100 ${
- split ? "bg-hover-2 text-ink" : "text-ink-2 hover:bg-hover hover:text-ink"
- }`}
- >
- <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden>
- <rect x="3" y="4" width="18" height="16" rx="2" />
- <path d="M12 4v16" />
- </svg>
- </button>
- <button
- type="button"
- aria-pressed={filesOpen}
- onClick={onFiles}
- title={`${chatCwd ?? "Workspace"}\nShow this chat's files`}
- className={`flex h-7 items-center gap-1.5 rounded-l-[7px] pl-2 pr-1.5 text-[12px] font-medium transition-colors duration-100 ${
- filesOpen ? "bg-hover-2 text-ink" : "text-ink-2 hover:bg-hover hover:text-ink"
- }`}
- >
- <IconFolder size={14} />
- <span data-toolbar-label className="max-w-40 truncate font-mono text-[11.5px]">{workspaceName}</span>
- </button>
- <button
- type="button"
- aria-label="Open a folder"
- onClick={onFolder}
- title="Open another folder to work in"
- className="-ml-2 flex h-7 items-center rounded-r-[7px] pl-0.5 pr-1.5 text-ink-3 transition-colors duration-100 hover:bg-hover hover:text-ink"
- >
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" aria-hidden>
- <path d="M6 9l6 6 6-6" />
- </svg>
- </button>
- <button type="button" onClick={openChanges} className="flex items-center gap-1.5 rounded-lg px-2 py-1 text-xs text-ink-2 hover:bg-hover" aria-label="Review workspace changes" title="Review workspace changes"><svg aria-hidden="true" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7"><path d="M5 5h14v14H5zM8 9h8M8 12h8M8 15h4" /></svg><span data-toolbar-label>Changes</span></button>
- <button
- type="button"
- aria-pressed={browserOpen}
- onClick={onBrowser}
- title="Sidecar browser — a Chrome tab this chat and its agent share"
- className={`flex h-7 items-center gap-1.5 rounded-[7px] px-2 text-[12px] font-medium transition-colors duration-100 ${
- browserOpen ? "bg-hover-2 text-ink" : "text-ink-2 hover:bg-hover hover:text-ink"
- }`}
- >
- <IconGlobe size={14} />
- <span data-toolbar-label className="text-[11.5px]">Browser</span>
- {pinCount > 0 && (
- <span className="rounded-full bg-accent px-1.5 text-[10px] font-semibold text-white tabular-nums">{pinCount}</span>
- )}
- </button>
- <button aria-label="Toggle terminal" aria-pressed={terminalVisible} title="Terminal (⌘J)" onClick={toggleTerminal} className="rounded-lg px-2 py-1 text-xs text-ink-2 hover:bg-hover"><svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7"><rect x="3" y="4" width="18" height="16" rx="3"/><path d="m7 9 3 3-3 3m6 0h4"/></svg></button>
- {onTasks && (
- <button type="button" aria-pressed={tasksOpen} aria-label="Show tasks" title="Tasks — open on demand, not when a chat has a list" disabled={taskCount === 0 && !tasksOpen} onClick={onTasks}
- className={`flex items-center gap-1.5 rounded-lg px-2 py-1 text-xs hover:bg-hover disabled:opacity-40 ${tasksOpen ? "bg-hover-2 text-ink" : "text-ink-2"}`}>
- <span data-toolbar-label>Tasks{taskCount > 0 ? ` (${taskCount})` : ""}</span>
- </button>
- )}
- <ThemeToggle />
- <DesktopSettings />
+ <div className={`${reviewStyles.actions} flex min-h-10 shrink-0 items-center gap-2 border-t border-line px-3 py-1`}>
+ <button type="button" aria-pressed={filesOpen} onClick={onFiles} title={`${chatCwd ?? "Workspace"}\nShow this chat's files`}
+ className="max-w-48 truncate rounded-md px-2 py-1 text-xs font-medium text-ink-2 hover:bg-hover">{workspaceName}</button>
+ <button type="button" onClick={openChanges} aria-label="Review workspace changes" className="rounded-md px-2 py-1 text-xs text-ink-2 hover:bg-hover">Changes</button>
+ {(taskCount > 0 || tasksOpen) && onTasks && <button type="button" aria-label="Show tasks" aria-pressed={tasksOpen} onClick={onTasks} className="rounded-md px-2 py-1 text-xs text-ink-2 hover:bg-hover">Tasks{taskCount ? ` (${taskCount})` : ""}</button>}
+ <ActionMenu label="More workspace actions" text="More" className="ml-auto shrink-0">
+ <button type="button" aria-pressed={conversationsOpen} onClick={openConversations} title="All conversations">Conversations</button>
+ <button type="button" aria-pressed={split} onClick={toggleSplit}>{split ? "Close splits" : "Split view"} <span className="ml-auto text-ink-3">⌘\</span></button>
+ <button type="button" onClick={onFolder}>Open a folder…</button>
+ <button type="button" aria-pressed={browserOpen} onClick={onBrowser} title="Sidecar browser — a Chrome tab this chat and its agent share">Browser{pinCount > 0 ? ` (${pinCount} pins)` : ""}</button>
+ <button type="button" aria-label="Toggle terminal" aria-pressed={terminalVisible} onClick={toggleTerminal}>Terminal <span className="ml-auto text-ink-3">⌘J</span></button>
+ <ThemeToggle labeled />
+ <DesktopSettings labeled />
+ </ActionMenu>
</div>
{splitNotice && <p role="status" data-split-limit className="border-t border-line px-3 py-1.5 text-[12px] text-ink-2">{splitNotice}</p>}
</div>
diff --git a/apps/native/components/site/SavedCacheCheck.tsx b/apps/native/components/site/SavedCacheCheck.tsx
index 5dd16760..69cd13fe 100644
--- a/apps/native/components/site/SavedCacheCheck.tsx
+++ b/apps/native/components/site/SavedCacheCheck.tsx
@@ -28,7 +28,7 @@ export default function SavedCacheCheck({ name, cwd, model, disabled, onContinue
return () => pending.current?.abort();
}, [key]);
const current = state.key === key ? state : { key, busy: true };
- return <div data-saved-cache-check className="mt-3 border-t border-line pt-3">
+ return <div data-saved-cache-check className="mt-1">
<p role="status" className="font-medium text-ink">{current.busy ? "Checking saved cache compatibility…" : current.error ? "Prompt cache check unavailable" : current.result?.summary}</p>
{current.result && <details className="mt-1">
<summary className="cursor-pointer">Check details</summary>
diff --git a/apps/native/components/site/SavedSnapshot.tsx b/apps/native/components/site/SavedSnapshot.tsx
index 7af88966..c8d1fd8b 100644
--- a/apps/native/components/site/SavedSnapshot.tsx
+++ b/apps/native/components/site/SavedSnapshot.tsx
@@ -25,12 +25,11 @@ export default function SavedSnapshot({ name, cwd, model, onRefresh, onContinue
if (!controller.signal.aborted) setRefreshing(false);
}
};
- return <section data-saved-snapshot aria-label="Saved conversation snapshot" className="rounded-[12px] border border-line bg-surface p-4 text-[13px] text-ink-2">
- <p role="status" className="font-medium text-ink">Saved snapshot · Live status unknown</p>
- <p className="mt-1">Work may still be running in another window. Refresh to read the latest save.</p>
- <p className="mt-1">Stop work in the other window before choosing Continue here.</p>
+ return <section data-saved-snapshot data-session-snapshot aria-label="Saved conversation snapshot" className="border-t border-line px-1 py-2 text-[12px] text-ink-2">
+ <p role="status" className="font-medium text-ink">Saved conversation · Live REPL status unknown</p>
+ <p className="mt-1">This view is not attached to a live REPL. Continue here uses this save without stopping it.</p>
{error && <p role="alert" className="mt-2 text-red">Could not refresh the snapshot. Try again.</p>}
- <div className="mt-3 flex flex-wrap gap-2">
+ <div className="mt-1 flex flex-wrap gap-2">
<button type="button" data-refresh-snapshot disabled={refreshing} onClick={() => void refresh()} className="rounded-control px-3 py-1.5 hover:bg-hover disabled:opacity-50">{refreshing ? "Refreshing…" : "Refresh snapshot"}</button>
</div>
<SavedCacheCheck name={name} cwd={cwd} model={model} disabled={refreshing} onContinue={onContinue} />
diff --git a/apps/native/components/site/ThemeToggle.tsx b/apps/native/components/site/ThemeToggle.tsx
index bd81442d..304f6764 100644
--- a/apps/native/components/site/ThemeToggle.tsx
+++ b/apps/native/components/site/ThemeToggle.tsx
@@ -1,6 +1,7 @@
"use client";
import { useEffect, useRef, useState } from "react";
import { createPortal } from "react-dom";
+import { restoreActionFocus } from "../primitives/ActionMenu";
import CustomThemes from "./CustomThemes";
import { appearanceEvent, appearanceKey, applyAppearance, readAppearance, type Appearance } from "@/lib/appearance";
@@ -11,7 +12,7 @@ const themes = [
{ id: "website", name: "Website", detail: "CodeGraff emerald", bg: "#fafaf8", surface: "#ffffff", ink: "#18231e", accent: "#059669" },
] as const;
-export function ThemeToggle() {
+export function ThemeToggle({ labeled = false }: { labeled?: boolean }) {
const [theme, setTheme] = useState<Appearance>("dark");
const [position, setPosition] = useState<{ top: number; right: number } | null>(null);
const trigger = useRef<HTMLButtonElement>(null);
@@ -26,7 +27,7 @@ export function ThemeToggle() {
panel.current?.querySelector<HTMLButtonElement>('[aria-pressed="true"]')?.focus();
const outside = (event: PointerEvent) => { if (!panel.current?.contains(event.target as Node) && !trigger.current?.contains(event.target as Node)) setPosition(null); };
const keys = (event: KeyboardEvent) => {
- if (event.key === "Escape") { event.stopPropagation(); setPosition(null); trigger.current?.focus(); }
+ if (event.key === "Escape") { event.stopPropagation(); setPosition(null); restoreActionFocus(trigger.current); }
if (event.key === "Tab") {
const buttons = Array.from(panel.current?.querySelectorAll<HTMLButtonElement>("button") ?? []);
const index = buttons.indexOf(document.activeElement as HTMLButtonElement);
@@ -50,10 +51,10 @@ export function ThemeToggle() {
const rect = trigger.current!.getBoundingClientRect();
setPosition(position ? null : { top: Math.max(48, Math.min(rect.bottom + 8, window.innerHeight - 420)), right: Math.max(8, window.innerWidth - rect.right) });
}} className="flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-3 hover:bg-hover hover:text-ink">
- <svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7"><circle cx="12" cy="12" r="8" /><path d="M12 4a8 8 0 0 1 0 16Z" fill="currentColor" stroke="none" /></svg>
+ {labeled ? "Appearance" : <svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7"><circle cx="12" cy="12" r="8" /><path d="M12 4a8 8 0 0 1 0 16Z" fill="currentColor" stroke="none" /></svg>}
</button>
{position && createPortal(<div ref={panel} role="dialog" aria-label="Appearance" aria-modal="true" className="fixed z-[200] w-[310px] max-w-[calc(100vw-16px)] overflow-y-auto rounded-xl border border-line bg-surface p-3 shadow-overlay" style={{ ...position, maxHeight: `calc(100dvh - ${position.top + 12}px)` }}>
- <div className="mb-3 flex items-center justify-between"><strong className="text-xs font-medium">Appearance</strong><button aria-label="Close appearance" onClick={() => { setPosition(null); trigger.current?.focus(); }} className="rounded px-1.5 text-ink-3 hover:bg-hover">×</button></div>
+ <div className="mb-3 flex items-center justify-between"><strong className="text-xs font-medium">Appearance</strong><button aria-label="Close appearance" onClick={() => { setPosition(null); restoreActionFocus(trigger.current); }} className="rounded px-1.5 text-ink-3 hover:bg-hover">×</button></div>
<div className="grid grid-cols-2 gap-2">{themes.map(option => <button key={option.id} aria-pressed={theme === option.id} onClick={() => choose(option.id)} className={`rounded-lg border p-1.5 text-left focus-visible:outline-2 focus-visible:outline-accent ${theme === option.id ? "border-accent bg-accent-tint" : "border-line hover:bg-hover"}`}>
<span aria-hidden="true" className="mb-2 flex h-14 gap-1 overflow-hidden rounded p-1.5" style={{ background: option.bg }}><span className="w-3 rounded-sm" style={{ background: option.id === "codegraff" ? "#d45a43" : option.accent, opacity: .35 }} /><span className="flex flex-1 flex-col gap-1 rounded p-1" style={{ background: option.surface }}><span className="h-1 w-5 rounded" style={{ background: option.ink, opacity: .45 }} /><span className="h-1 w-8 rounded" style={{ background: option.ink, opacity: .15 }} /><span className="mt-auto h-1.5 w-4 rounded" style={{ background: option.accent }} /></span></span>
<span className="block text-[11px] font-medium text-ink">{option.name}</span><span className="block text-[9px] leading-4 text-ink-3">{option.detail}</span>
diff --git a/apps/native/electron/saved-session-visual.cjs b/apps/native/electron/saved-session-visual.cjs
index 9bfd9c33..2b649c60 100644
--- a/apps/native/electron/saved-session-visual.cjs
+++ b/apps/native/electron/saved-session-visual.cjs
@@ -57,10 +57,10 @@ async function runSavedSessionVisuals({ win, origin, output }) {
await wait(`(()=>{const row=Array.from(document.querySelectorAll('[data-conversation-library] li button')).find(e=>e.textContent.includes('active-repl'));if(!row)return false;row.click();return true;})()`);
await wait(`document.body.textContent.includes('I am checking the remaining files.')`);
await wait(`!!document.querySelector('[data-saved-snapshot]')`);
- assert.match(await js(`document.querySelector('[data-saved-snapshot]').textContent`), /Live status unknown/);
+ assert.match(await js(`document.querySelector('[data-saved-snapshot]').textContent`), /Live (?:REPL )?status unknown/);
assert.equal(await js(`document.querySelector('[data-chat] textarea[aria-label="Prompt"]')`), null, 'Snapshot cannot accept follow-ups');
assert.equal(await js(`document.querySelector('article')?.dataset.turnStatus`), 'snapshot', 'Intermediate prose is not a completed turn');
- assert.equal(await js(`document.querySelector('[data-turn-activity]')?.textContent.includes('Turn finished')`), false);
+ assert.equal(await js(`!!document.querySelector('[data-turn-activity]')?.textContent.includes('Turn finished')`), false);
const resumed = () => js(`window.savedFixture.requests.filter(r=>r.method==='bootstrap'&&r.params?.resume==='active-repl').length`);
assert.equal(await resumed(), 0, 'Opening shared history must not resume its writer');
assert.equal(await js(`window.savedFixture.requests.some(r=>r.method==='session/prompt')`), false);
@@ -69,7 +69,7 @@ async function runSavedSessionVisuals({ win, origin, output }) {
assert.ok(await js(`document.body.textContent.includes('I am checking the remaining files.')`), 'Refresh failure preserves history');
await js(`window.savedFixture.fail=false;window.savedFixture.completed=true;document.querySelector('[data-refresh-snapshot]').click()`);
await wait(`document.body.textContent.includes('All files checked.')`);
- assert.match(await js(`document.querySelector('[data-saved-snapshot]').textContent`), /Live status unknown/, 'Successful refresh is still a snapshot');
+ assert.match(await js(`document.querySelector('[data-saved-snapshot]').textContent`), /Live (?:REPL )?status unknown/, 'Successful refresh is still a snapshot');
assert.equal(await resumed(), 0);
await js('document.fonts.ready.then(()=>true)');
await js(`Promise.all(document.getAnimations().filter(a=>a.effect?.getTiming().iterations!==Infinity).map(a=>a.finished.catch(()=>{}))).then(()=>true)`);
diff --git a/apps/native/electron/workspace-layout-visual.cjs b/apps/native/electron/workspace-layout-visual.cjs
index e63c33f0..8e286a8b 100644
--- a/apps/native/electron/workspace-layout-visual.cjs
+++ b/apps/native/electron/workspace-layout-visual.cjs
@@ -111,8 +111,9 @@ app.whenReady().then(async () => {
await wait(`!!document.querySelector('[aria-label="Agents panel"]')`);
fs.writeFileSync(path.join(output, 'agents-workspace.png'), (await wc.capturePage()).toPNG());
await wc.reload();
- await wait(`!!document.querySelector('[aria-label="Show tasks"]')`);
- assert.equal(await js(`document.querySelector('[aria-label="Show tasks"]').getAttribute('aria-pressed')`), 'false');
+ await wait(`!!document.querySelector('[data-workspace-ready="true"] [data-workspace-toolbar]')`);
+ assert.equal(await js(`document.querySelector('[aria-label="Show tasks"]')?.getAttribute('aria-pressed') === 'true'`), false);
+ assert.equal(await js(`!!document.querySelector('[data-tasks-sidebar]')`), false);
assert.deepEqual(unexpected, [], 'Synthetic checks must never reach real agent APIs');
console.log('PASS: shared toolbar above horizontal/vertical splits; full-width Agents; Tasks close persists across navigation/reload. No engine calls.');
}).then(() => finish(0)).catch(error => { console.error(error); finish(1); });
diff --git a/apps/native/electron/yxlyx-regressions-visual.cjs b/apps/native/electron/yxlyx-regressions-visual.cjs
index c7b4760b..bcda944a 100644
--- a/apps/native/electron/yxlyx-regressions-visual.cjs
+++ b/apps/native/electron/yxlyx-regressions-visual.cjs
@@ -41,7 +41,7 @@ async function runYxlyxRegressions({ win, origin }) {
assert.match(await js(`document.querySelector('[data-session-snapshot]').textContent`), /not attached to a live REPL/);
await wait(`!!document.querySelector('[data-saved-snapshot]')`);
assert.equal(await js(`document.querySelector('[data-chat][data-focused="true"] textarea')`), null, 'A saved snapshot cannot accept input before explicit continuation');
- assert.match(await js(`document.querySelector('[data-saved-snapshot]').textContent`), /Live status unknown/);
+ assert.match(await js(`document.querySelector('[data-saved-snapshot]').textContent`), /Live (?:REPL )?status unknown/);
assert.equal(await js(`document.querySelector('[data-chat][data-focused="true"]').textContent.includes('Turn finished')`), false);
assert.equal(await js(`window.snapshotPrompts.some(r=>r.method==='session/prompt')`), false, 'Opening a snapshot never sends a prompt');
diff --git a/docs/adr/0099-gui-saved-sessions-are-snapshots.md b/docs/adr/0099-gui-saved-sessions-are-snapshots.md
index 0d5ae1a8..31733931 100644
--- a/docs/adr/0099-gui-saved-sessions-are-snapshots.md
+++ b/docs/adr/0099-gui-saved-sessions-are-snapshots.md
@@ -40,6 +40,10 @@ the selected model and workspace. Changes flag cache reuse as at risk; matching
metadata remains unverified. No agent or model request is started by this check.
Saved settings cannot establish prefix equality or provider cache retention.
+The saved view shows one compact status notice beside its continuation controls;
+transcript headers and individual turns do not repeat it. Saved turn status remains
+unknown after continuation.
+
## Consequences
Opening and refreshing history never bootstrap an ACP session. The composer