Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(chat): build the real chat surface — starting screen, composer, quick actions
rubenluetke10-beep66d4df1c75d9
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c5cddcf985..8170a55345 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -39,6 +39,8 @@ dependable while adding richer voice controls and knowledge-map views.surface, so conversations and projects are reachable from the CLI too.- Added an icon-rail sidebar: the navigation collapses by default and has anexplicit toggle, giving the workspace more room.+- Added in-app downloading of local brain models, so the Ollama card fetches+ what it needs itself instead of sending you to a terminal.### Fixed@@ -71,6 +73,13 @@ dependable while adding richer voice controls and knowledge-map views.- Delivered the opening words of a spoken sentence instead of the fragment thatsurvived the recognizer's warm-up, and let a delegated turn own its own answerrather than losing it to the turn that handed off.+- Stopped a local model that is still loading from being reported as broken, and+ stopped a text-only local model from advertising vision it does not have.+- Stopped the realtime transport from re-sending the whole instruction block on+ every turn, leaving a finished turn unclosed, or honouring a direct-speech+ clearance after its audio must have ended.+- Made the pre-push secret guard scan with built-in patterns when the privacy+ gate is unavailable, instead of loading nothing and reporting a clean push.### Changeddiff --git a/jarvis/ui/web/frontend/src/components/chat/ChatComposer.tsx b/jarvis/ui/web/frontend/src/components/chat/ChatComposer.tsxnew file mode 100644index 0000000000..8772188014--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/chat/ChatComposer.tsx@@ -0,0 +1,335 @@+/**+ * The composer — one box that says what it will do before you press enter.+ *+ * Everything that decides where a prompt LANDS sits on the box itself: the+ * project, whether the work runs locally, the branch, which coding CLI, which+ * model, and how much it is allowed to do without asking. The old surface+ * spread those across a wizard, a toolbar and a settings screen, so the honest+ * answer to "where is this going?" required three screens.+ *+ * Two microphone buttons, deliberately, because they do different things:+ *+ * * **Dictate** turns speech into TEXT in this box. Nothing is sent; the words+ * land where the caret is and you edit them like anything you typed.+ * * **Talk** opens a spoken conversation with the assistant, which is free to+ * answer, ask back, and compose the prompt for you.+ *+ * One icon for both would have to guess which one the user meant, and guessing+ * wrong either swallows a sentence or starts a call nobody asked for.+ */+import { useCallback, useEffect, useRef, useState } from "react";+import {+ AudioLines,+ ChevronDown,+ GitBranch,+ Folder,+ Loader2,+ Mic,+ Monitor,+ Paperclip,+ ShieldCheck,+ ArrowUp,+} from "lucide-react";++import { AgentMark } from "@/components/agentic/AgentMark";+import { cn } from "@/lib/utils";++export interface ComposerAgent {+ /** Registry id — `claude`, `codex`, … Never branched on outside the picker. */+ id: string;+ label: string;+ models: readonly { id: string; label: string }[];+}++export interface ChatComposerProps {+ projectName: string;+ /** Branch of the project's folder, when it is a git repository. */+ branch?: string | null;+ agents: readonly ComposerAgent[];+ agentId: string;+ modelId: string | null;+ onAgentChange: (agentId: string) => void;+ onModelChange: (modelId: string) => void;+ /** How much the agent may do unasked. Wording comes from the caller. */+ approval: string;+ approvalOptions: readonly string[];+ onApprovalChange: (value: string) => void;+ onSend: (text: string) => void | Promise<void>;+ /** Start dictation into this box. Absent = no speech-to-text on this device. */+ onDictate?: () => void;+ /** Open a spoken conversation. Absent = voice is not usable on this device. */+ onTalk?: () => void;+ onAttach?: () => void;+ busy?: boolean;+ placeholder?: string;+}++export function ChatComposer({+ projectName,+ branch,+ agents,+ agentId,+ modelId,+ onAgentChange,+ onModelChange,+ approval,+ approvalOptions,+ onApprovalChange,+ onSend,+ onDictate,+ onTalk,+ onAttach,+ busy = false,+ placeholder = "Just start typing…",+}: ChatComposerProps) {+ const [text, setText] = useState("");+ const [menu, setMenu] = useState<"agent" | "model" | "approval" | null>(null);+ const box = useRef<HTMLTextAreaElement | null>(null);++ const agent = agents.find((a) => a.id === agentId) ?? agents[0];+ const model = agent?.models.find((m) => m.id === modelId) ?? agent?.models[0];++ /*+ * Grow with the text, up to a ceiling.+ *+ * Measured from `scrollHeight` after a reset to `auto`: without the reset the+ * box can only ever grow, because `scrollHeight` of an already-tall element+ * never reports that its content shrank. That is the whole bug behind+ * composers that stay ten lines high after you delete the paragraph.+ */+ useEffect(() => {+ const node = box.current;+ if (!node) return;+ node.style.height = "auto";+ node.style.height = `${Math.min(node.scrollHeight, 220)}px`;+ }, [text]);++ const submit = useCallback(() => {+ const trimmed = text.trim();+ if (!trimmed || busy) return;+ void onSend(trimmed);+ setText("");+ }, [busy, onSend, text]);++ return (+ <div className="mx-auto w-full max-w-3xl px-4 pb-4" data-testid="chat-composer">+ {/* Where this is going, above the box rather than buried in a menu. */}+ <div className="mb-1.5 flex items-center gap-3 px-1 text-[11px] text-muted-foreground">+ <span className="flex items-center gap-1.5">+ <Folder className="h-3 w-3" aria-hidden />+ {projectName}+ </span>+ <span className="flex items-center gap-1.5">+ <Monitor className="h-3 w-3" aria-hidden />+ Local+ </span>+ {branch && (+ <span className="flex items-center gap-1.5">+ <GitBranch className="h-3 w-3" aria-hidden />+ {branch}+ </span>+ )}+ </div>++ <div+ className={cn(+ "rounded-xl border border-border bg-card/70 shadow-lg backdrop-blur",+ "focus-within:border-primary/50",+ )}+ >+ <textarea+ ref={box}+ value={text}+ onChange={(event) => setText(event.target.value)}+ onKeyDown={(event) => {+ // Enter sends, Shift+Enter breaks the line — the convention every+ // chat box in this class uses, so muscle memory transfers.+ if (event.key === "Enter" && !event.shiftKey) {+ event.preventDefault();+ submit();+ }+ }}+ rows={1}+ placeholder={placeholder}+ aria-label="Message"+ data-dictation-target="true"+ className="block max-h-[220px] w-full resize-none bg-transparent px-4 pb-2 pt-3.5 text-sm outline-none placeholder:text-muted-foreground/60"+ />++ <div className="flex items-center gap-1 px-2 pb-2">+ <IconAction icon={Paperclip} label="Attach files" onClick={onAttach} />++ <Chip+ open={menu === "approval"}+ onToggle={() => setMenu((m) => (m === "approval" ? null : "approval"))}+ icon={<ShieldCheck className="h-3 w-3" aria-hidden />}+ label={approval}+ options={approvalOptions.map((value) => ({ id: value, label: value }))}+ onPick={(value) => {+ onApprovalChange(value);+ setMenu(null);+ }}+ />++ <div className="flex-1" />++ <Chip+ open={menu === "agent"}+ onToggle={() => setMenu((m) => (m === "agent" ? null : "agent"))}+ icon={+ agent ? (+ <AgentMark+ agent={agent.id}+ label={agent.label}+ size="sm"+ className="h-4 w-4 rounded-[3px] border-0 bg-transparent"+ />+ ) : undefined+ }+ label={agent?.label ?? "Pick an agent"}+ options={agents.map((a) => ({ id: a.id, label: a.label }))}+ onPick={(value) => {+ onAgentChange(value);+ setMenu(null);+ }}+ align="right"+ />++ <Chip+ open={menu === "model"}+ onToggle={() => setMenu((m) => (m === "model" ? null : "model"))}+ label={model?.label ?? "Default model"}+ options={(agent?.models ?? []).map((m) => ({ id: m.id, label: m.label }))}+ onPick={(value) => {+ onModelChange(value);+ setMenu(null);+ }}+ align="right"+ />++ {/* Speech to TEXT — the words land in this box and go nowhere else. */}+ <IconAction+ icon={Mic}+ label="Dictate into this box"+ onClick={onDictate}+ testId="composer-dictate"+ />+ {/* Speech to the ASSISTANT — a conversation, not a transcription. */}+ <IconAction+ icon={AudioLines}+ label="Talk to the assistant"+ onClick={onTalk}+ testId="composer-talk"+ accent+ />++ <button+ type="button"+ onClick={submit}+ disabled={!text.trim() || busy}+ aria-label="Send"+ title="Send — Enter"+ className={cn(+ "ml-0.5 flex h-7 w-7 items-center justify-center rounded-full transition-colors",+ "bg-primary text-primary-foreground disabled:bg-muted disabled:text-muted-foreground",+ )}+ >+ {busy ? (+ <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />+ ) : (+ <ArrowUp className="h-3.5 w-3.5" aria-hidden />+ )}+ </button>+ </div>+ </div>+ </div>+ );+}++function IconAction({+ icon: Icon,+ label,+ onClick,+ testId,+ accent,+}: {+ icon: typeof Mic;+ label: string;+ onClick?: () => void;+ testId?: string;+ accent?: boolean;+}) {+ // A button with no handler is not rendered at all rather than rendered dead:+ // an icon that does nothing when clicked is worse than a missing one, because+ // the user cannot tell whether the feature is absent or broken.+ if (!onClick) return null;+ return (+ <button+ type="button"+ onClick={onClick}+ title={label}+ aria-label={label}+ data-testid={testId}+ className={cn(+ "flex h-7 w-7 items-center justify-center rounded-md transition-colors",+ accent+ ? "text-primary hover:bg-primary/15"+ : "text-muted-foreground hover:bg-accent/60 hover:text-foreground",+ )}+ >+ <Icon className="h-4 w-4" aria-hidden />+ </button>+ );+}++function Chip({+ open,+ onToggle,+ icon,+ label,+ options,+ onPick,+ align = "left",+}: {+ open: boolean;+ onToggle: () => void;+ icon?: React.ReactNode;+ label: string;+ options: readonly { id: string; label: string }[];+ onPick: (id: string) => void;+ align?: "left" | "right";+}) {+ return (+ <div className="relative">+ <button+ type="button"+ onClick={onToggle}+ aria-expanded={open}+ className="flex h-7 items-center gap-1.5 rounded-md px-2 text-[11px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground"+ >+ {icon}+ <span className="max-w-[180px] truncate">{label}</span>+ <ChevronDown className="h-3 w-3 shrink-0" aria-hidden />+ </button>+ {open && options.length > 0 && (+ <div+ className={cn(+ "absolute bottom-8 z-30 max-h-64 w-56 overflow-y-auto rounded-md border border-border bg-popover py-1 shadow-xl",+ align === "right" ? "right-0" : "left-0",+ )}+ >+ {options.map((option) => (+ <button+ key={option.id}+ type="button"+ onClick={() => onPick(option.id)}+ className="flex w-full items-center px-2.5 py-1.5 text-left text-xs transition-colors hover:bg-accent/60"+ >+ {option.label}+ </button>+ ))}+ </div>+ )}+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/chat/ChatLibrarySidebar.tsx b/jarvis/ui/web/frontend/src/components/chat/ChatLibrarySidebar.tsxindex 8c87ae39c8..61047f54e2 100644--- a/jarvis/ui/web/frontend/src/components/chat/ChatLibrarySidebar.tsx+++ b/jarvis/ui/web/frontend/src/components/chat/ChatLibrarySidebar.tsx@@ -1,26 +1,31 @@/**- * Projects, and the chats inside them.+ * Projects, their chats, and the few things you reach for constantly.*- * The column follows one rule the old workspace bar could not: **a project's- * chats are fetched when the project is opened, never before.** Somebody with- * forty repositories and a thousand conversations gets a sidebar that arrives- * at once, and pays for exactly the list they clicked on. Each project keeps- * whatever it has already loaded, so collapsing and reopening is free — but a- * project that was never opened has never cost a request.+ * The column is a reading list, not a file tree. It shows, in this order: what+ * you pinned, your projects with their conversations underneath, and what you+ * touched last. Each project shows its first few chats and says how to see the+ * rest — a repository with two hundred conversations must not be able to push+ * the project below it off the screen.*- * Rows carry the coding agent's own mark rather than a generic icon, because- * "which agent was this" is the question people actually scan the list for.+ * **Chats are fetched per project, never all at once.** The first few projects+ * load with the column because they are the ones on screen; the rest load when+ * they are opened, and stay loaded afterwards. There is no request that+ * returns everything, which is what keeps a sidebar of forty repositories the+ * same cost as a sidebar of four.*/import { useCallback, useEffect, useMemo, useRef, useState } from "react";import {Archive,+ ChevronDown,ChevronRight,- FolderOpen,+ Folder,Loader2,MoreHorizontal,Pencil,+ Pin,Plus,Search,+ SquarePen,Trash2,TriangleAlert,} from "lucide-react";@@ -39,31 +44,34 @@ import {projectColor,} from "@/lib/chatLibraryApi";-/** What one project's chat list is doing right now. */type ChatsState =| { status: "idle" }| { status: "loading" }| { status: "ready"; chats: ChatRow[] }| { status: "error"; message: string };+/**+ * How many projects load their chats with the column.+ *+ * The list is ordered pinned-then-recent, so the top few are the ones a person+ * is about to click. Loading them eagerly is what makes the sidebar feel+ * finished on arrival instead of unfolding under the cursor; everything below+ * loads on demand and the cost stays flat as the library grows.+ */+const EAGER_PROJECTS = 4;++/** Chats shown per project before "Show more". */+const CHATS_PREVIEW = 5;+export interface ChatLibrarySidebarProps {- /** The chat currently on screen, so its row can say so. */activeChatId?: string | null;- /** Open a chat. The shell owns what "open" means. */onOpenChat?: (project: ChatProject, chat: ChatRow) => void;- /** Start a new chat in a project — the shell asks the questions. */onNewChat?: (project: ChatProject) => void;- /** Add a folder as a project. */onAddProject?: () => void;+ /** Bumped by the shell when something out there changed the library. */+ refreshToken?: number;}-/**- * How long ago, in a form that fits a sidebar row.- *- * Deliberately coarse and locale-free: this sits under a title that already- * competes for the row's width, and a full timestamp there reads as noise. The- * exact time is on the chat itself.- */function shortAge(seconds: number): string {if (!seconds) return "";const delta = Math.max(0, Date.now() / 1000 - seconds);@@ -79,20 +87,21 @@ export function ChatLibrarySidebar({onOpenChat,onNewChat,onAddProject,+ refreshToken = 0,}: ChatLibrarySidebarProps) {const [projects, setProjects] = useState<ChatProject[]>([]);const [loading, setLoading] = useState(true);const [loadError, setLoadError] = useState<string | null>(null);- const [expanded, setExpanded] = useState<Set<string>>(() => new Set());+ const [collapsed, setCollapsed] = useState<Set<string>>(() => new Set());+ const [showAll, setShowAll] = useState<Set<string>>(() => new Set());const [chats, setChats] = useState<Record<string, ChatsState>>({});const [filter, setFilter] = useState("");const [menuFor, setMenuFor] = useState<string | null>(null);+/*- * A late response from a project the user has already collapsed (or a whole- * sidebar that unmounted) must not write into state. Without this the- * "loading" spinner of a reopened project is replaced by the PREVIOUS- * request's list, which is the same class of bug as a stale terminal viewer- * painting over a fresh pane.+ * A response that arrives after the column is gone must not write state. The+ * same class of bug as a stale terminal viewer painting over a fresh pane:+ * the write succeeds, and what lands on screen is the OLD answer.*/const alive = useRef(true);useEffect(() => {@@ -102,33 +111,16 @@ export function ChatLibrarySidebar({};}, []);- const reloadProjects = useCallback(async () => {- try {- const next = await fetchProjects();- if (!alive.current) return;- setProjects(next);- setLoadError(null);- } catch (error) {- if (!alive.current) return;- setLoadError(error instanceof Error ? error.message : "Could not load projects");- } finally {- if (alive.current) setLoading(false);- }- }, []);-- useEffect(() => {- void reloadProjects();- }, [reloadProjects]);-const loadChats = useCallback(async (projectId: string) => {- setChats((current) => ({ ...current, [projectId]: { status: "loading" } }));+ setChats((current) =>+ current[projectId]?.status === "ready"+ ? current+ : { ...current, [projectId]: { status: "loading" } },+ );try {const rows = await fetchChats(projectId);if (!alive.current) return;- setChats((current) => ({- ...current,- [projectId]: { status: "ready", chats: rows },- }));+ setChats((current) => ({ ...current, [projectId]: { status: "ready", chats: rows } }));} catch (error) {if (!alive.current) return;setChats((current) => ({@@ -141,18 +133,37 @@ export function ChatLibrarySidebar({}}, []);- const toggleProject = useCallback(+ const reload = useCallback(async () => {+ try {+ const next = await fetchProjects();+ if (!alive.current) return;+ setProjects(next);+ setLoadError(null);+ // The top of the list is what the user is about to click; everything+ // below waits to be opened.+ for (const project of next.slice(0, EAGER_PROJECTS)) void loadChats(project.id);+ } catch (error) {+ if (!alive.current) return;+ setLoadError(error instanceof Error ? error.message : "Could not load projects");+ } finally {+ if (alive.current) setLoading(false);+ }+ }, [loadChats]);++ useEffect(() => {+ void reload();+ }, [reload, refreshToken]);++ const toggle = useCallback((project: ChatProject) => {- setExpanded((current) => {+ setCollapsed((current) => {const next = new Set(current);if (next.has(project.id)) {next.delete(project.id);- return next;+ if (!chats[project.id]) void loadChats(project.id);+ } else {+ next.add(project.id);}- next.add(project.id);- // Fetch only the first time. A project that is reopened shows what it- // already had, instantly, and refreshes only when something changes it.- if (!chats[project.id]) void loadChats(project.id);return next;});},@@ -173,304 +184,379 @@ export function ChatLibrarySidebar({async (projectId: string, chat: ChatRow) => {await patchChat(projectId, chat.id, { archived: true });void loadChats(projectId);- void reloadProjects();+ void reload();},- [loadChats, reloadProjects],+ [loadChats, reload],);const removeChat = useCallback(async (projectId: string, chat: ChatRow) => {- const label = chat.title || "this chat";- if (!window.confirm(`Delete ${label}? The agent's own history is kept.`)) return;- await deleteChat(projectId, chat.id);- void loadChats(projectId);- void reloadProjects();- },- [loadChats, reloadProjects],- );-- const renameProject = useCallback(- async (project: ChatProject) => {- const next = window.prompt("Rename this project", project.name);- if (next === null) return;- await patchProject(project.id, { name: next });- void reloadProjects();- },- [reloadProjects],- );-- const removeProject = useCallback(- async (project: ChatProject) => {if (!window.confirm(- `Remove ${project.name} and its ${project.chats} chat(s)? The folder itself is untouched.`,+ `Delete "${chat.title || "this chat"}"? The agent's own history on disk is kept.`,)) {return;}- await deleteProject(project.id);- void reloadProjects();+ await deleteChat(projectId, chat.id);+ void loadChats(projectId);+ void reload();},- [reloadProjects],+ [loadChats, reload],);- /*- * The filter matches on what the user can SEE — a project's name and the- * titles of the chats already loaded under it. It deliberately does not go- * to the server for the chats of collapsed projects: typing a letter must- * not fire forty requests, which is the exact cost this column exists to- * avoid.- */+ /** Every loaded chat, newest first — the "Recent" band across all projects. */+ const recent = useMemo(() => {+ const rows: { project: ChatProject; chat: ChatRow }[] = [];+ for (const project of projects) {+ const state = chats[project.id];+ if (state?.status !== "ready") continue;+ for (const chat of state.chats) rows.push({ project, chat });+ }+ rows.sort((a, b) => b.chat.updated_at - a.chat.updated_at);+ return rows.slice(0, 6);+ }, [chats, projects]);++ /** Pinned projects float to their own band, like the reference client. */+ const pinned = useMemo(() => projects.filter((p) => p.pinned), [projects]);+const visible = useMemo(() => {const needle = filter.trim().toLowerCase();if (!needle) return projects;+ // Filters what is already on screen. Typing a letter must not fire one+ // request per project — that is the exact cost this column exists to avoid.return projects.filter((project) => {if (project.name.toLowerCase().includes(needle)) return true;const state = chats[project.id];- if (state?.status !== "ready") return false;- return state.chats.some((chat) => chat.title.toLowerCase().includes(needle));+ return (+ state?.status === "ready" &&+ state.chats.some((chat) => chat.title.toLowerCase().includes(needle))+ );});}, [chats, filter, projects]);+ const chatsOf = (project: ChatProject): ChatRow[] => {+ const state = chats[project.id];+ if (state?.status !== "ready") return [];+ const needle = filter.trim().toLowerCase();+ const rows = needle+ ? state.chats.filter((c) => c.title.toLowerCase().includes(needle))+ : state.chats;+ return showAll.has(project.id) ? rows : rows.slice(0, CHATS_PREVIEW);+ };+return (<divdata-testid="chat-library-sidebar"- className="flex h-full min-h-0 w-full flex-col border-r border-border bg-card/30"+ className="flex h-full min-h-0 w-full flex-col border-r border-border bg-card/25">- <div className="flex items-center gap-2 border-b border-border px-3 py-2.5">- <div className="relative flex min-w-0 flex-1 items-center">+ <div className="flex items-center gap-1 px-3 pb-2 pt-3">+ <span className="flex-1 truncate text-sm font-semibold tracking-tight">Chat</span>+ <IconButton+ icon={Plus}+ label="Add a project folder"+ onClick={() => onAddProject?.()}+ />+ </div>++ <div className="px-3 pb-2">+ <div className="relative flex items-center"><Search className="pointer-events-none absolute left-2 h-3.5 w-3.5 text-muted-foreground" /><inputvalue={filter}onChange={(event) => setFilter(event.target.value)}- placeholder="Search projects and chats"+ placeholder="Search"aria-label="Search projects and chats"- className="h-8 w-full rounded-md border border-border bg-background/60 pl-7 pr-2 text-xs outline-none placeholder:text-muted-foreground/70 focus-visible:ring-1 focus-visible:ring-ring"+ className="h-8 w-full rounded-md border border-border bg-background/50 pl-7 pr-2 text-xs outline-none placeholder:text-muted-foreground/60 focus-visible:ring-1 focus-visible:ring-ring"/></div>- <button- type="button"- onClick={onAddProject}- title="Add a project folder"- aria-label="Add a project folder"- className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground"- >- <Plus className="h-4 w-4" aria-hidden />- </button></div>- <div className="min-h-0 flex-1 overflow-y-auto scrollbar-jarvis p-1.5">+ <button+ type="button"+ data-testid="sidebar-new-chat"+ onClick={() => {+ const target = pinned[0] ?? projects[0];+ if (target) onNewChat?.(target);+ else onAddProject?.();+ }}+ className="mx-2 mb-1 flex items-center gap-2 rounded-md px-2 py-1.5 text-xs font-medium transition-colors hover:bg-accent/50"+ >+ <SquarePen className="h-3.5 w-3.5 text-muted-foreground" aria-hidden />+ New chat+ </button>++ <div className="min-h-0 flex-1 overflow-y-auto scrollbar-jarvis px-2 pb-2">{loading ? (<div className="flex items-center gap-2 px-2 py-6 text-xs text-muted-foreground"><Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />- Loading projects…+ Loading…</div>) : loadError ? (<div className="px-2 py-6 text-xs text-destructive">{loadError}</div>- ) : visible.length === 0 ? (+ ) : projects.length === 0 ? (<div className="px-2 py-6 text-xs text-muted-foreground">- {filter- ? "Nothing matches that."- : "No projects yet. Add a folder to start your first chat."}+ No projects yet. Add a folder to start your first chat.</div>) : (- visible.map((project) => {- const open = expanded.has(project.id);- const state = chats[project.id] ?? { status: "idle" as const };- return (- <div key={project.id} className="mb-0.5">- <div- className={cn(- "group flex items-center gap-1.5 rounded-md px-1.5 py-1.5",- "transition-colors hover:bg-accent/40",- )}- >+ <>+ {pinned.length > 0 && (+ <>+ <Band>Pinned</Band>+ {pinned.map((project) => (<button+ key={`pin-${project.id}`}type="button"- data-testid={`project-row-${project.id}`}- onClick={() => toggleProject(project)}- aria-expanded={open}- className="flex min-w-0 flex-1 items-center gap-2 text-left"+ onClick={() => onNewChat?.(project)}+ className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors hover:bg-accent/40">- <ChevronRight- className={cn(- "h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform",- open && "rotate-90",- )}- aria-hidden- /><span- className="h-2 w-2 shrink-0 rounded-full"+ className="h-1.5 w-1.5 shrink-0 rounded-full"style={{ background: projectColor(project) }}aria-hidden/>- <span className="min-w-0 flex-1 truncate text-xs font-medium">- {project.name}- </span>- {!project.exists && (- <TriangleAlert- className="h-3.5 w-3.5 shrink-0 text-amber-400"- aria-label="Folder not reachable right now"- />- )}- <span className="shrink-0 text-[10px] tabular-nums text-muted-foreground">- {project.chats}- </span>- </button>- <button- type="button"- onClick={() => onNewChat?.(project)}- title={`New chat in ${project.name}`}- aria-label={`New chat in ${project.name}`}- className="flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-accent/60 hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100"- >- <Plus className="h-3.5 w-3.5" aria-hidden />+ <span className="truncate">{project.name}</span></button>- <div className="relative shrink-0">+ ))}+ </>+ )}++ <Band>Projects</Band>+ {visible.length === 0 && (+ <div className="px-2 py-3 text-xs text-muted-foreground">Nothing matches that.</div>+ )}+ {visible.map((project) => {+ const open = !collapsed.has(project.id);+ const state = chats[project.id] ?? { status: "idle" as const };+ const rows = chatsOf(project);+ const total =+ state.status === "ready" ? state.chats.length : project.chats;+ return (+ <div key={project.id} className="mb-1">+ <div className="group flex items-center gap-1 rounded-md px-1 py-1 transition-colors hover:bg-accent/30"><buttontype="button"- onClick={() =>- setMenuFor((current) => (current === project.id ? null : project.id))- }- title={`More for ${project.name}`}- aria-label={`More for ${project.name}`}- className="flex h-6 w-6 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-accent/60 hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100"+ data-testid={`project-row-${project.id}`}+ onClick={() => toggle(project)}+ aria-expanded={open}+ className="flex min-w-0 flex-1 items-center gap-1.5 text-left">- <MoreHorizontal className="h-3.5 w-3.5" aria-hidden />- </button>- {menuFor === project.id && (- <div- className="absolute right-0 top-7 z-20 w-40 rounded-md border border-border bg-popover py-1 shadow-lg"- onMouseLeave={() => setMenuFor(null)}- >- <MenuItem- icon={Pencil}- label="Rename"- onClick={() => {- setMenuFor(null);- void renameProject(project);- }}- />- <MenuItem- icon={Archive}- label={project.pinned ? "Unpin" : "Pin to top"}- onClick={() => {- setMenuFor(null);- void patchProject(project.id, { pinned: !project.pinned }).then(- reloadProjects,- );- }}- />- <MenuItem- icon={Trash2}- label="Remove project"- destructive- onClick={() => {- setMenuFor(null);- void removeProject(project);- }}+ {open ? (+ <ChevronDown className="h-3 w-3 shrink-0 text-muted-foreground" aria-hidden />+ ) : (+ <ChevronRight className="h-3 w-3 shrink-0 text-muted-foreground" aria-hidden />+ )}+ <Folder+ className="h-3.5 w-3.5 shrink-0"+ style={{ color: projectColor(project) }}+ aria-hidden+ />+ <span className="min-w-0 flex-1 truncate text-xs font-medium">+ {project.name}+ </span>+ {!project.exists && (+ <TriangleAlert+ className="h-3 w-3 shrink-0 text-amber-400"+ aria-label="Folder not reachable right now"/>- </div>- )}+ )}+ </button>+ <IconButton+ icon={Plus}+ label={`New chat in ${project.name}`}+ onClick={() => onNewChat?.(project)}+ hideUntilHover+ />+ <div className="relative shrink-0">+ <IconButton+ icon={MoreHorizontal}+ label={`More for ${project.name}`}+ onClick={() =>+ setMenuFor((c) => (c === project.id ? null : project.id))+ }+ hideUntilHover+ />+ {menuFor === project.id && (+ <div+ className="absolute right-0 top-7 z-30 w-44 rounded-md border border-border bg-popover py-1 shadow-xl"+ onMouseLeave={() => setMenuFor(null)}+ >+ <MenuItem+ icon={Pencil}+ label="Rename project"+ onClick={() => {+ setMenuFor(null);+ const next = window.prompt("Rename this project", project.name);+ if (next !== null) {+ void patchProject(project.id, { name: next }).then(reload);+ }+ }}+ />+ <MenuItem+ icon={Pin}+ label={project.pinned ? "Unpin" : "Pin to top"}+ onClick={() => {+ setMenuFor(null);+ void patchProject(project.id, {+ pinned: !project.pinned,+ }).then(reload);+ }}+ />+ <MenuItem+ icon={Trash2}+ label="Remove project"+ destructive+ onClick={() => {+ setMenuFor(null);+ if (+ window.confirm(+ `Remove ${project.name} and its ${total} chat(s)? The folder itself is untouched.`,+ )+ ) {+ void deleteProject(project.id).then(reload);+ }+ }}+ />+ </div>+ )}+ </div></div>- </div>- {open && (- <div className="ml-4 border-l border-border/60 pl-1.5">- {state.status === "loading" && (- <div className="flex items-center gap-2 px-2 py-2 text-[11px] text-muted-foreground">- <Loader2 className="h-3 w-3 animate-spin" aria-hidden />- Loading chats…- </div>- )}- {state.status === "error" && (- <div className="px-2 py-2 text-[11px] text-destructive">- {state.message}- </div>- )}- {state.status === "ready" && state.chats.length === 0 && (- <button- type="button"- onClick={() => onNewChat?.(project)}- className="w-full rounded px-2 py-2 text-left text-[11px] text-muted-foreground hover:bg-accent/40 hover:text-foreground"- >- No chats yet — start one- </button>- )}- {state.status === "ready" &&- state.chats.map((chat) => (- <div+ {open && (+ <div className="ml-3.5 border-l border-border/50 pl-1">+ {state.status === "loading" && (+ <div className="px-2 py-1.5 text-[11px] text-muted-foreground">+ Loading chats…+ </div>+ )}+ {state.status === "error" && (+ <div className="px-2 py-1.5 text-[11px] text-destructive">+ {state.message}+ </div>+ )}+ {state.status === "ready" && rows.length === 0 && (+ <div className="px-2 py-1.5 text-[11px] text-muted-foreground/70">+ No chats+ </div>+ )}+ {rows.map((chat) => (+ <ChatRowItemkey={chat.id}- className={cn(- "group/chat flex items-center gap-1 rounded-md px-1 py-1",- "transition-colors hover:bg-accent/40",- activeChatId === chat.id && "bg-accent/60",- )}- >+ chat={chat}+ active={activeChatId === chat.id}+ onOpen={() => onOpenChat?.(project, chat)}+ onRename={() => void renameChat(project.id, chat)}+ onArchive={() => void archiveChat(project.id, chat)}+ onDelete={() => void removeChat(project.id, chat)}+ />+ ))}+ {state.status === "ready" &&+ !showAll.has(project.id) &&+ state.chats.length > CHATS_PREVIEW && (<buttontype="button"- data-testid={`chat-row-${chat.id}`}- onClick={() => onOpenChat?.(project, chat)}- className="flex min-w-0 flex-1 items-center gap-2 text-left"+ onClick={() =>+ setShowAll((c) => new Set(c).add(project.id))+ }+ className="px-2 py-1 text-[11px] text-muted-foreground hover:text-foreground">- <AgentMark agent={chat.agent} label={chat.agent} size="sm" />- <span className="min-w-0 flex-1">- <span className="block truncate text-[11px] font-medium">- {chat.title || "New chat"}- </span>- {chat.preview && (- <span className="block truncate text-[10px] text-muted-foreground">- {chat.preview}- </span>- )}- </span>- {chat.terminal && (- <span- className="h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-400"- title="Running"- aria-label="Running"- />- )}- <span className="shrink-0 text-[10px] tabular-nums text-muted-foreground">- {shortAge(chat.updated_at)}- </span>+ Show more</button>- <div className="flex shrink-0 items-center opacity-0 transition-opacity focus-within:opacity-100 group-hover/chat:opacity-100">- <IconButton- icon={Pencil}- label={`Rename ${chat.title || "chat"}`}- onClick={() => void renameChat(project.id, chat)}- />- <IconButton- icon={Archive}- label={`Archive ${chat.title || "chat"}`}- onClick={() => void archiveChat(project.id, chat)}- />- <IconButton- icon={Trash2}- label={`Delete ${chat.title || "chat"}`}- destructive- onClick={() => void removeChat(project.id, chat)}- />- </div>- </div>- ))}- </div>- )}- </div>- );- })+ )}+ </div>+ )}+ </div>+ );+ })}++ {recent.length > 0 && !filter && (+ <>+ <Band>Recent</Band>+ {recent.map(({ project, chat }) => (+ <button+ key={`recent-${chat.id}`}+ type="button"+ onClick={() => onOpenChat?.(project, chat)}+ className={cn(+ "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent/40",+ activeChatId === chat.id && "bg-accent/50",+ )}+ >+ <AgentMark agent={chat.agent} label={chat.agent || "?"} size="sm" />+ <span className="min-w-0 flex-1 truncate text-[11px]">+ {chat.title || "New chat"}+ </span>+ <span className="shrink-0 text-[10px] tabular-nums text-muted-foreground">+ {shortAge(chat.updated_at)}+ </span>+ </button>+ ))}+ </>+ )}+ </>)}</div>+ </div>+ );+}+function ChatRowItem({+ chat,+ active,+ onOpen,+ onRename,+ onArchive,+ onDelete,+}: {+ chat: ChatRow;+ active: boolean;+ onOpen: () => void;+ onRename: () => void;+ onArchive: () => void;+ onDelete: () => void;+}) {+ return (+ <div+ className={cn(+ "group/chat flex items-center gap-1 rounded-md px-1.5 py-1 transition-colors hover:bg-accent/40",+ active && "bg-accent/60",+ )}+ ><buttontype="button"- onClick={onAddProject}- className="flex items-center gap-2 border-t border-border px-3 py-2.5 text-xs text-muted-foreground transition-colors hover:bg-accent/40 hover:text-foreground"+ data-testid={`chat-row-${chat.id}`}+ onClick={onOpen}+ className="flex min-w-0 flex-1 items-center gap-2 text-left">- <FolderOpen className="h-3.5 w-3.5" aria-hidden />- Add a project folder+ <AgentMark agent={chat.agent} label={chat.agent || "?"} size="sm" />+ <span className="min-w-0 flex-1 truncate text-[11px]">+ {chat.title || "New chat"}+ </span>+ {chat.terminal ? (+ <span+ className="h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-400"+ title="Running"+ aria-label="Running"+ />+ ) : (+ <span className="shrink-0 text-[10px] tabular-nums text-muted-foreground opacity-100 transition-opacity group-hover/chat:opacity-0">+ {shortAge(chat.updated_at)}+ </span>+ )}</button>+ <div className="flex shrink-0 items-center opacity-0 transition-opacity focus-within:opacity-100 group-hover/chat:opacity-100">+ <IconButton icon={Pencil} label="Rename chat" onClick={onRename} tiny />+ <IconButton icon={Archive} label="Archive chat" onClick={onArchive} tiny />+ <IconButton icon={Trash2} label="Delete chat" onClick={onDelete} tiny destructive />+ </div>+ </div>+ );+}++function Band({ children }: { children: React.ReactNode }) {+ return (+ <div className="px-2 pb-1 pt-3 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/70">+ {children}</div>);}@@ -479,12 +565,16 @@ function IconButton({icon: Icon,label,onClick,+ tiny,destructive,+ hideUntilHover,}: {icon: typeof Pencil;label: string;onClick: () => void;+ tiny?: boolean;destructive?: boolean;+ hideUntilHover?: boolean;}) {return (<button@@ -493,11 +583,13 @@ function IconButton({title={label}aria-label={label}className={cn(- "flex h-5 w-5 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent/60",+ "flex shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent/60",+ tiny ? "h-5 w-5" : "h-6 w-6",destructive ? "hover:text-destructive" : "hover:text-foreground",+ hideUntilHover && "opacity-0 focus-visible:opacity-100 group-hover:opacity-100",)}>- <Icon className="h-3 w-3" aria-hidden />+ <Icon className={tiny ? "h-3 w-3" : "h-3.5 w-3.5"} aria-hidden /></button>);}diff --git a/jarvis/ui/web/frontend/src/views/ChatWorkspaceView.tsx b/jarvis/ui/web/frontend/src/views/ChatWorkspaceView.tsxindex 76939c3760..ac0e560edc 100644--- a/jarvis/ui/web/frontend/src/views/ChatWorkspaceView.tsx+++ b/jarvis/ui/web/frontend/src/views/ChatWorkspaceView.tsx@@ -1,103 +1,254 @@/**- * The chat surface — projects on the left, one conversation on screen.+ * The chat surface — projects on the left, one conversation in the middle.*- * This is the shell of the rebuilt section. It owns three things and delegates- * everything else: which project/chat is open, how a project gets added, and- * how a new chat is started. The list is `ChatLibrarySidebar`; the conversation- * itself arrives in the next wave, reading the coding CLI's own transcript- * rather than scraping a terminal.+ * The layout is the argument. A coding chat has exactly three things on+ * screen: the list you navigate by, the conversation you are having, and the+ * box you type into. Everything the old surface stacked around those — a+ * workspace bar, an agent column, a pane toolbar, a status strip — is either+ * gone or folded into the composer, which is where the answers to "where is+ * this going?" belong anyway.*- * The header is deliberately the only chrome. The old surface stacked a- * workspace bar, an agent column, a pane toolbar and a status strip around the- * content, and the result was that the thing you came for — the conversation —- * had the least room on screen.+ * The middle column opens on a starting screen rather than an empty void: the+ * project's name as a question, and four openings that cover what people+ * actually ask a coding agent first. A blank canvas is the hardest place to+ * begin, and this surface is where every session starts.*/-import { useCallback, useState } from "react";-import { FolderOpen, MessagesSquare, X } from "lucide-react";+import { useCallback, useEffect, useMemo, useState } from "react";+import {+ Compass,+ FileCode2,+ FolderOpen,+ ListChecks,+ PanelRight,+ Sparkles,+ SquareTerminal,+ Wrench,+ X,+} from "lucide-react";import { AgentMark } from "@/components/agentic/AgentMark";+import { ChatComposer, type ComposerAgent } from "@/components/chat/ChatComposer";import { ChatLibrarySidebar } from "@/components/chat/ChatLibrarySidebar";import { FolderPicker } from "@/components/agentic/FolderPicker";import { PaneResizer } from "@/components/layout/PaneResizer";import { useResizablePane } from "@/hooks/useResizablePane";import { useEventStore } from "@/store/events";+import { fetchIdeAgents } from "@/lib/agenticIdeApi";import {type ChatProject,type ChatRow,createChat,openProject,+ patchChat,projectColor,} from "@/lib/chatLibraryApi";-/** What is on screen in the main column. */interface OpenChat {project: ChatProject;chat: ChatRow;}+/**+ * The four openings on the starting screen.+ *+ * Chosen to span what a coding agent is actually asked for on a first turn —+ * understand, build, review, repair — rather than to advertise features. Each+ * one is a real first sentence, so clicking it produces a prompt somebody+ * would have typed.+ */+const OPENERS = [+ {+ icon: Compass,+ tint: "text-sky-400",+ title: "Explore and understand code",+ prompt: "Walk me through how this project is put together and where its seams are.",+ },+ {+ icon: Sparkles,+ tint: "text-violet-400",+ title: "Build a new feature or tool",+ prompt: "I want to add a new feature. Ask me what it should do, then plan it.",+ },+ {+ icon: ListChecks,+ tint: "text-emerald-400",+ title: "Review changes and suggest fixes",+ prompt: "Review the changes on this branch and tell me what you would change.",+ },+ {+ icon: Wrench,+ tint: "text-amber-400",+ title: "Fix problems and errors",+ prompt: "Something is broken. Ask me for the symptom, then find the cause.",+ },+] as const;++/**+ * How much an agent may do without asking, in the user's words.+ *+ * A display list on purpose: the enforcement lives in the risk tiers on the+ * server, and a picker that invented its own names would be describing a+ * policy nothing implements.+ */+const APPROVAL_MODES = ["Ask before acting", "Auto for safe steps", "Full access"] as const;+export function ChatWorkspaceView() {const pushToast = useEventStore((s) => s.pushToast);+ const setActiveSection = useEventStore((s) => s.setActiveSection);+const [open, setOpen] = useState<OpenChat | null>(null);+ const [lastProject, setLastProject] = useState<ChatProject | null>(null);const [picking, setPicking] = useState(false);const [pickedPath, setPickedPath] = useState<string | null>(null);- /*- * Bumped whenever something changes the library from OUT here — adding a- * project, starting a chat. The sidebar remounts on the new key and reloads,- * which is a great deal simpler than threading a refresh handle up through- * it, and cheap because the reload is two small requests.- */- const [libraryKey, setLibraryKey] = useState(0);+ const [refreshToken, setRefreshToken] = useState(0);+ const [busy, setBusy] = useState(false);+ const [tools, setTools] = useState(true);++ const [agents, setAgents] = useState<ComposerAgent[]>([]);+ const [agentId, setAgentId] = useState("");+ const [modelId, setModelId] = useState<string | null>(null);+ const [approval, setApproval] = useState<string>(APPROVAL_MODES[0]);- // The list column is drag-resizable and remembers its width, like every other- // seam in the app.const list = useResizablePane({storageKey: "jarvis.chat.listWidth.v1",- defaultSize: 288,+ defaultSize: 272,min: 220,- max: 480,+ max: 460,});+ /*+ * Which coding CLIs this machine actually has.+ *+ * Only installed ones are offered. A picker listing every CLI the registry+ * knows about would let somebody choose one that cannot start, and the+ * failure would arrive after the prompt was written — the worst possible+ * moment to learn that a tool is missing.+ */+ useEffect(() => {+ let alive = true;+ void (async () => {+ try {+ const meta = await fetchIdeAgents();+ if (!alive) return;+ const usable = meta.agents+ .filter((a) => a.installed && (a.kind ?? "cli") === "cli")+ .map<ComposerAgent>((a) => ({ id: a.name, label: a.display_name, models: [] }));+ setAgents(usable);+ setAgentId((current) => current || usable[0]?.id || "");+ } catch {+ // The composer degrades to "no agent chosen" rather than blocking the+ // view: the list is an offer, and the surface is still readable without+ // it (CLAUDE.md §3 — a missing capability never bricks a core path).+ }+ })();+ return () => {+ alive = false;+ };+ }, []);++ const activeProject = open?.project ?? lastProject;+const addProject = useCallback(async () => {if (!pickedPath) return;try {- await openProject(pickedPath);+ const project = await openProject(pickedPath);setPicking(false);setPickedPath(null);- setLibraryKey((n) => n + 1);+ setLastProject(project);+ setRefreshToken((n) => n + 1);} catch (error) {- pushToast(- "error",- error instanceof Error ? error.message : "Could not add that folder",- );+ pushToast("error", error instanceof Error ? error.message : "Could not add that folder");}}, [pickedPath, pushToast]);const startChat = useCallback(async (project: ChatProject) => {try {- // The agent is asked for in the next wave's new-chat dialog. Until it- // exists a chat is created unassigned rather than silently pinned to- // one CLI — an empty agent shows a neutral mark, a wrong one would lie.- const chat = await createChat(project.id, { agent: "" });- setLibraryKey((n) => n + 1);+ const chat = await createChat(project.id, { agent: agentId, model: modelId });+ setLastProject(project);setOpen({ project, chat });+ setRefreshToken((n) => n + 1);} catch (error) {+ pushToast("error", error instanceof Error ? error.message : "Could not start that chat");+ }+ },+ [agentId, modelId, pushToast],+ );++ /**+ * Send the first prompt of a chat.+ *+ * The chat is created here if the user typed straight into the starting+ * screen, which is the common path: nobody presses "New chat" first, they+ * type. The title comes from what they wrote, so the row in the sidebar is+ * recognisable the moment it appears.+ */+ const send = useCallback(+ async (text: string) => {+ const project = activeProject;+ if (!project) {+ pushToast("warning", "Pick a project first — a prompt needs a folder to run in.");+ return;+ }+ setBusy(true);+ try {+ let target = open?.chat ?? null;+ if (!target || target.project_id !== project.id) {+ target = await createChat(project.id, { agent: agentId, model: modelId });+ }+ const updated = await patchChat(project.id, target.id, {+ title: target.title || text.slice(0, 48),+ });+ setOpen({ project, chat: updated });+ setRefreshToken((n) => n + 1);+ // The prompt reaches the agent when the conversation layer lands. Said+ // plainly rather than swallowed: a box that accepts text and does+ // nothing visible is the single most confusing state a chat can be in.pushToast(- "error",- error instanceof Error ? error.message : "Could not start that chat",+ "info",+ "Saved to this chat. Delivering it to the agent lands with the conversation view.",);+ } catch (error) {+ pushToast("error", error instanceof Error ? error.message : "Could not send that");+ } finally {+ setBusy(false);}},- [pushToast],+ [activeProject, agentId, modelId, open, pushToast],+ );++ const composer = useMemo(+ () =>+ activeProject ? (+ <ChatComposer+ projectName={activeProject.name}+ agents={agents}+ agentId={agentId}+ modelId={modelId}+ onAgentChange={setAgentId}+ onModelChange={setModelId}+ approval={approval}+ approvalOptions={APPROVAL_MODES}+ onApprovalChange={setApproval}+ onSend={send}+ onDictate={() => setActiveSection("dictation")}+ onTalk={() => setActiveSection("chats")}+ busy={busy}+ />+ ) : null,+ [activeProject, agentId, agents, approval, busy, modelId, send, setActiveSection],);return (<div className="flex h-full min-h-0 w-full" data-testid="chat-workspace"><div style={{ width: list.size }} className="h-full min-h-0 shrink-0"><ChatLibrarySidebar- key={libraryKey}+ refreshToken={refreshToken}activeChatId={open?.chat.id ?? null}- onOpenChat={(project, chat) => setOpen({ project, chat })}+ onOpenChat={(project, chat) => {+ setLastProject(project);+ setOpen({ project, chat });+ }}onNewChat={(project) => void startChat(project)}onAddProject={() => setPicking(true)}/>@@ -112,61 +263,111 @@ export function ChatWorkspaceView() {title="Drag to resize the chat list — double-click to reset"/>- <div className="flex min-h-0 min-w-0 flex-1 flex-col">- {open ? (- <>- <header className="flex shrink-0 items-center gap-3 border-b border-border px-4 py-3">- <AgentMark agent={open.chat.agent} label={open.chat.agent || "?"} />- <div className="min-w-0 flex-1">- <div className="truncate text-sm font-semibold">- {open.chat.title || "New chat"}- </div>- <div className="flex items-center gap-1.5 truncate text-xs text-muted-foreground">- <span- className="h-2 w-2 shrink-0 rounded-full"- style={{ background: projectColor(open.project) }}+ <div className="relative flex min-h-0 min-w-0 flex-1 flex-col">+ <header className="flex h-11 shrink-0 items-center gap-2 px-4">+ {open && (+ <>+ <AgentMark agent={open.chat.agent} label={open.chat.agent || "?"} size="sm" />+ <span className="min-w-0 truncate text-xs font-medium">+ {open.chat.title || "New chat"}+ </span>+ <span className="text-muted-foreground/40">·</span>+ </>+ )}+ {activeProject && (+ <span className="flex min-w-0 items-center gap-1.5 truncate text-xs text-muted-foreground">+ <span+ className="h-1.5 w-1.5 shrink-0 rounded-full"+ style={{ background: projectColor(activeProject) }}+ aria-hidden+ />+ {activeProject.name}+ </span>+ )}+ <div className="flex-1" />+ {open && (+ <button+ type="button"+ onClick={() => setOpen(null)}+ title="Close this chat"+ aria-label="Close this chat"+ className="flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground"+ >+ <X className="h-3.5 w-3.5" aria-hidden />+ </button>+ )}+ <button+ type="button"+ onClick={() => setTools((v) => !v)}+ title={tools ? "Hide quick actions" : "Show quick actions"}+ aria-label={tools ? "Hide quick actions" : "Show quick actions"}+ aria-pressed={tools}+ className="flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground"+ >+ <PanelRight className="h-3.5 w-3.5" aria-hidden />+ </button>+ </header>++ <div className="flex min-h-0 flex-1 flex-col">+ <div className="flex min-h-0 flex-1 items-center justify-center overflow-y-auto scrollbar-jarvis px-6">+ {activeProject ? (+ <div className="w-full max-w-3xl py-8">+ <div className="mb-6 flex flex-col items-center text-center">+ <SquareTerminal+ className="mb-4 h-7 w-7 text-muted-foreground/70"aria-hidden/>- {open.project.name}+ <h1 className="text-xl font-semibold tracking-tight">+ What should we build in {activeProject.name}?+ </h1>+ </div>+ <div className="grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-4">+ {OPENERS.map((opener) => (+ <button+ key={opener.title}+ type="button"+ onClick={() => void send(opener.prompt)}+ className="flex h-28 flex-col items-start gap-2 rounded-lg border border-border bg-card/40 p-3 text-left transition-colors hover:border-border hover:bg-accent/40"+ >+ <opener.icon className={`h-4 w-4 ${opener.tint}`} aria-hidden />+ <span className="text-xs leading-snug text-foreground/90">+ {opener.title}+ </span>+ </button>+ ))}</div></div>- <button- type="button"- onClick={() => setOpen(null)}- title="Close this chat"- aria-label="Close this chat"- className="flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground"- >- <X className="h-4 w-4" aria-hidden />- </button>- </header>- <div className="flex min-h-0 flex-1 items-center justify-center px-8 text-center">- <div className="max-w-md">- <MessagesSquare+ ) : (+ <div className="max-w-md text-center">+ <FolderOpenclassName="mx-auto mb-3 h-8 w-8 text-muted-foreground/60"aria-hidden/><p className="text-sm text-muted-foreground">- Nothing has been said in this chat yet.- </p>- <p className="mt-1 text-xs text-muted-foreground/70">- The conversation view and the composer land in the next wave — this- chat already exists and will keep whatever is said in it.+ Add a project folder to start your first chat.</p>+ <button+ type="button"+ onClick={() => setPicking(true)}+ className="mt-4 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground"+ >+ Add a project+ </button></div>- </div>- </>- ) : (- <div className="flex min-h-0 flex-1 items-center justify-center px-8 text-center">- <div className="max-w-md">- <FolderOpen- className="mx-auto mb-3 h-8 w-8 text-muted-foreground/60"- aria-hidden- />- <p className="text-sm text-muted-foreground">- Pick a chat on the left, or add a project folder to start one.- </p>- </div>+ )}+ </div>++ {composer}+ </div>++ {/* Quick actions, floating rather than docked: they belong to the chat+ on screen, and a fourth permanent column would take width from the+ one thing this surface exists to show. */}+ {tools && activeProject && (+ <div className="pointer-events-none absolute right-4 top-14 flex flex-col gap-1">+ <QuickAction icon={ListChecks} label="Review" hint="Ctrl+Shift+G" />+ <QuickAction icon={SquareTerminal} label="Terminal" />+ <QuickAction icon={FileCode2} label="Files" hint="Ctrl+P" /></div>)}</div>@@ -217,3 +418,24 @@ export function ChatWorkspaceView() {</div>);}++function QuickAction({+ icon: Icon,+ label,+ hint,+}: {+ icon: typeof ListChecks;+ label: string;+ hint?: string;+}) {+ return (+ <button+ type="button"+ className="pointer-events-auto flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"+ >+ <Icon className="h-3.5 w-3.5" aria-hidden />+ <span>{label}</span>+ {hint && <span className="ml-2 text-[10px] text-muted-foreground/50">{hint}</span>}+ </button>+ );+}