graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Organize workspace tools and keep settings discoverable
justrach5528b63c5ed2
diff --git a/apps/native/components/primitives/ActionMenu.tsx b/apps/native/components/primitives/ActionMenu.tsxindex 4d564631..54c46a28 100644--- a/apps/native/components/primitives/ActionMenu.tsx+++ b/apps/native/components/primitives/ActionMenu.tsx@@ -2,8 +2,8 @@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;+export default function ActionMenu({ label, text = "…", children, className = "", wide = false }: {+ label: string; text?: ReactNode; wide?: boolean; children: ReactNode; className?: string;}) {const id = useId();const trigger = useRef<HTMLButtonElement>(null);@@ -19,10 +19,10 @@ export default function ActionMenu({ label, text = "…", children, className =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}+ <div ref={panel} id={id} popover="auto" role={open ? "dialog" : undefined} 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">+ className={`fixed m-0 max-h-[calc(100dvh-16px)] ${wide ? "w-80 max-w-[calc(100vw-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>;diff --git a/apps/native/components/primitives/SidebarNav.tsx b/apps/native/components/primitives/SidebarNav.tsxindex b4b9b112..164eaca6 100644--- a/apps/native/components/primitives/SidebarNav.tsx+++ b/apps/native/components/primitives/SidebarNav.tsx@@ -71,6 +71,7 @@ type SidebarNavProps = {/** footer call-to-action — defaults to the demo "Upgrade" button */footerLabel?: string;footerIcon?: ReactNode;+ footerControls?: ReactNode;onFooterClick?: () => void;/** Tooltip on the footer control. */footerTitle?: string;@@ -178,6 +179,7 @@ export default function SidebarNav({onNavigate,footerLabel = "Upgrade",footerIcon,+ footerControls,onFooterClick,footerTitle,recents = DEFAULT_RECENTS,@@ -333,7 +335,7 @@ export default function SidebarNav({onNewChat?.();}}/>- {NAV_ITEMS.map((item) => (+ {NAV_ITEMS.filter(item => !footerControls || !["workspace", "changes", "browser"].includes(item.key)).map((item) => (<RailButtonkey={item.key}icon={item.icon}@@ -457,7 +459,7 @@ export default function SidebarNav({</span></button>{!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">+ <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 [@media(hover:none)]: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>@@ -488,12 +490,13 @@ export default function SidebarNav({</div></div>+ {footerControls}<div inert={collapsed} aria-hidden={collapsed} className="sidebar-copy mx-2 mt-3 w-[232px] border-t border-line pt-3"><buttontype="button"onClick={onFooterClick ?? onNewChat}title={footerTitle}- className="flex h-8 w-full items-center justify-center gap-1.5 rounded-control bg-hover-2 px-2 text-[12.5px] font-medium text-ink transition-[background-color,transform] duration-150 hover:bg-line-strong active:scale-[0.98]"+ className="flex h-8 w-full items-center justify-center gap-1.5 rounded-control px-2 text-[11px] font-medium text-ink-3 transition-[background-color,transform] duration-150 hover:bg-line-strong active:scale-[0.98]">{footerIcon}<span className="min-w-0 flex-1 truncate text-center">{footerLabel}</span>diff --git a/apps/native/components/site/AppSettings.tsx b/apps/native/components/site/AppSettings.tsxnew file mode 100644index 00000000..99cf6535--- /dev/null+++ b/apps/native/components/site/AppSettings.tsx@@ -0,0 +1,14 @@+"use client";+import ActionMenu from "../primitives/ActionMenu";+import { IconSettingsGear1 } from "@/lib/icons";+import { ThemeToggle } from "./ThemeToggle";+import DesktopSettings from "./DesktopSettings";++export default function AppSettings({ sidebar = false }: { sidebar?: boolean }) {+ return <ActionMenu label="Settings" text={<><IconSettingsGear1 size={16} /><span className={sidebar ? "sidebar-copy ml-2" : "ml-2"}>Settings</span></>}+ className={sidebar ? "mx-2 block border-t border-line pt-3 [&>button]:h-8 [&>button]:w-full [&>button]:justify-start" : "shrink-0"}>+ <p className="px-3 py-2 text-[11px] font-medium text-ink-3">Personalize your workspace</p>+ <ThemeToggle labeled />+ <DesktopSettings labeled />+ </ActionMenu>;+}diff --git a/apps/native/components/site/DesktopSettings.tsx b/apps/native/components/site/DesktopSettings.tsxindex 474cd300..4fb7e958 100644--- a/apps/native/components/site/DesktopSettings.tsx+++ b/apps/native/components/site/DesktopSettings.tsx@@ -41,9 +41,9 @@ export default function DesktopSettings({ labeled = false }: { labeled?: boolean};if (!available) return null;return <>- <button ref={trigger} aria-label="Settings" title="Settings" aria-haspopup="dialog" aria-expanded={open}+ <button ref={trigger} aria-label={labeled ? "Link settings" : "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">- {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>}+ {labeled ? "Link 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); restoreActionFocus(trigger.current); }diff --git a/apps/native/components/site/GraffHarness.tsx b/apps/native/components/site/GraffHarness.tsxindex 2ed6ef6f..f9b144b0 100644--- a/apps/native/components/site/GraffHarness.tsx+++ b/apps/native/components/site/GraffHarness.tsx@@ -11,6 +11,7 @@ import { useQuietSettings } from "./useQuietSettings";import { useTabDrag } from "./useTabDrag";import { mergeChatGroups, reorderChatGroups } from "@/lib/chat-groups";import { useChatGroups } from "./useChatGroups";+import AppSettings from "./AppSettings";import HarnessChrome from "./HarnessChrome";import ChatSplitLayout from "./ChatSplitLayout";import TerminalPane from "./TerminalPane";@@ -498,7 +499,8 @@ export default function GraffHarness() {onDeleteRecent={(id) => dropStored(id, false)}onNewWorkspace={() => setDialog({ mode: "new" })}onWorkspaceSettings={() => setDialog(sidebarWorkspace ? { mode: "settings" } : { mode: "new" })}- footerLabel={copiedResume ? "Copied resume command" : (chatThread.session ?? "Connecting…")}+ footerLabel={copiedResume ? "Copied resume command" : "Copy terminal resume command"}+ footerControls={<AppSettings sidebar />}footerTitle={footerTitle}onFooterClick={copyResume}/>diff --git a/apps/native/components/site/HarnessChrome.tsx b/apps/native/components/site/HarnessChrome.tsxindex ffd7ff04..24c1219d 100644--- a/apps/native/components/site/HarnessChrome.tsx+++ b/apps/native/components/site/HarnessChrome.tsx@@ -2,8 +2,7 @@ import SplitLayoutIcon from "./SplitLayoutIcon";import type {SplitTree} from "@/lib/split-tree";import ActionMenu from "@/components/primitives/ActionMenu";import { useEffect, useRef } from "react";-import { ThemeToggle } from "./ThemeToggle";-import DesktopSettings from "./DesktopSettings";+import AppSettings from "./AppSettings";import type { PointerEvent, MouseEvent } from "react";import type { Chat } from "./harness-types";import reviewStyles from "./ChangesPane.module.css";@@ -93,15 +92,19 @@ export default function HarnessChrome({chats, activeId, busyIds, focusChat, closclassName="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>+ <ActionMenu label="Workspace tools" text="Workspace tools" wide className="ml-auto shrink-0">+ <p className="px-3 py-2 text-[11px] font-medium text-ink-3">Tools for this workspace</p>+ <button type="button" aria-label="Files" aria-pressed={filesOpen} onClick={onFiles}><span>Files<span className="mt-1 block text-ink-3">Explore the current project folder</span></span></button>+ <button type="button" aria-label="Browser" aria-pressed={browserOpen} onClick={onBrowser}><span>Browser{pinCount > 0 ? ` (${pinCount} pins)` : ""}<span className="mt-1 block text-ink-3">Keep a web page beside your conversation</span></span></button>+ <button type="button" aria-label="Toggle terminal" aria-pressed={terminalVisible} onClick={toggleTerminal}><span>Terminal<span className="mt-1 block text-ink-3">Run commands in this workspace · ⌘J</span></span></button>+ <button type="button" onClick={onFolder}><span>Open a folder…<span className="mt-1 block text-ink-3">Choose another workspace</span></span></button>+ </ActionMenu>+ <ActionMenu label="Chat actions" text="More" className="shrink-0">+ <button type="button" onClick={newChat}>New chat <span className="ml-auto text-ink-3">⌘T</span></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 />+ <button type="button" aria-pressed={conversationsOpen} onClick={openConversations}>All conversations</button></ActionMenu>+ <span className="lg:hidden"><AppSettings /></span></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/chat-pane.module.css b/apps/native/components/site/chat-pane.module.cssindex 68b09181..4ed43d87 100644--- a/apps/native/components/site/chat-pane.module.css+++ b/apps/native/components/site/chat-pane.module.css@@ -1,5 +1,5 @@.pane {- container: chat-pane / inline-size;+ container: chat-pane / size;}/* A split is measured by its own width, not by the desktop window. */@@ -23,3 +23,14 @@font-size: 12px;}}++/* Short horizontal splits need the same breathing room as narrow columns. */+@container chat-pane (max-height: 420px) {+ .pane [data-transcript-content] { padding: 12px; gap: 16px; }+ .pane [data-chat-composer], .pane [data-chat-empty] { padding: 8px; }+ .pane [data-chat-composer] { max-height: 70%; overflow-y: auto; }+ .pane [data-chat-empty] h1 { font-size: 18px; }+ .pane [data-project-context] { display: none; }+ .pane [data-chat-empty] > div:last-child { margin-top: 10px; }+ .pane [data-saved-snapshot] { padding: 6px 10px; }+}diff --git a/docs/adr/0081-desktop-split-focus-and-layout.md b/docs/adr/0081-desktop-split-focus-and-layout.mdindex 7c75cd07..09cdcc59 100644--- a/docs/adr/0081-desktop-split-focus-and-layout.md+++ b/docs/adr/0081-desktop-split-focus-and-layout.md@@ -21,6 +21,10 @@ the whole group. The split toggle returns group members to individual tabs.Pane content responds to its own container width: narrow splits reducetranscript padding and user-message indentation even on a wide desktop.+Short panes also reduce spacing and omit the optional home project card; input,+errors and saved-session ownership controls stay available. App Settings lives+in the sidebar footer (toolbar on small windows); Workspace tools groups file,+browser and terminal access, while More holds conversation actions.Empty split composers sit at the bottom, matching populated panes.Tabs and workspace controls live in a shared toolbar above all panes. A combined