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(agentic-ide): give the thread composer its toolbar and strip, start new threads on the last pick
rubenluetke10-beep76eaa7ab070a
diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadBranchBar.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadBranchBar.tsxindex 77f53fb7db..24b3f4187b 100644--- a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadBranchBar.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadBranchBar.tsx@@ -1,5 +1,5 @@import { useCallback, useEffect, useRef, useState } from "react";-import { Check, ChevronDown, FolderGit2, GitBranch, Laptop, Loader2 } from "lucide-react";+import { Check, ChevronDown, Folder, FolderGit2, GitBranch, Loader2 } from "lucide-react";import { inspectGit, prepareGit, type GitRepoInfo } from "@/lib/gitApi";import { cn } from "@/lib/utils";import { useEventStore } from "@/store/events";@@ -9,7 +9,7 @@ import { folderLabel } from "./threadModel";/** Where a new thread's agent works: the project's own checkout, or a worktree of its own. */export type ThreadCheckout = "current" | "worktree";-const BUTTON = "flex h-7 min-w-0 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50";+const BUTTON = "flex h-6 min-w-0 items-center gap-1.5 rounded-md px-1.5 text-xs text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50";/** The repository state behind a folder, refreshed when the folder changes and on demand. */export function useGitInfo(folder: string): { info: GitRepoInfo | null; loading: boolean; refresh: () => void } {@@ -83,16 +83,18 @@ export function ThreadBranchBar({}};- return <div className="mx-auto flex w-full max-w-3xl items-center justify-between gap-2 px-3 pt-1.5" data-testid="thread-branch-bar">+ // Hangs under the composer card: tucked 16 px beneath it, narrower by the+ // card's corner radius on each side, its own corners rounded at the bottom.+ return <div className="relative mx-auto -mt-4 flex w-[calc(100%-2.75rem)] items-center justify-between gap-2 rounded-b-2xl border border-t-0 border-border bg-sidebar pb-1 pe-2 ps-1 pt-5" data-testid="thread-branch-bar">{draft? <button ref={checkoutAnchor} type="button" className={BUTTON} disabled={!repo} aria-haspopup="menu" aria-expanded={menu === "checkout"}onClick={() => setMenu(menu === "checkout" ? null : "checkout")} title={repo ? "Where the agent works" : "Not a git repository"}>- {checkout === "worktree" ? <FolderGit2 aria-hidden className="h-3.5 w-3.5 shrink-0" /> : <Laptop aria-hidden className="h-3.5 w-3.5 shrink-0" />}+ {checkout === "worktree" ? <FolderGit2 aria-hidden className="h-3.5 w-3.5 shrink-0" /> : <Folder aria-hidden className="h-3.5 w-3.5 shrink-0" />}<span className="truncate">{checkout === "worktree" ? "New worktree" : "Current checkout"}</span>{repo && <ChevronDown aria-hidden className="h-3 w-3 shrink-0" />}</button>: <span className={cn(BUTTON, "hover:bg-transparent hover:text-muted-foreground")} title={folder}>- {info?.is_worktree ? <FolderGit2 aria-hidden className="h-3.5 w-3.5 shrink-0" /> : <Laptop aria-hidden className="h-3.5 w-3.5 shrink-0" />}+ {info?.is_worktree ? <FolderGit2 aria-hidden className="h-3.5 w-3.5 shrink-0" /> : <Folder aria-hidden className="h-3.5 w-3.5 shrink-0" />}<span className="truncate">{info?.is_worktree ? `Worktree · ${folderLabel(folder)}` : "Current checkout"}</span></span>}{repo && <button ref={branchAnchor} type="button" className={BUTTON} disabled={switching || (!draft && locked)}@@ -107,7 +109,7 @@ export function ThreadBranchBar({<ThreadPopover anchor={checkoutAnchor} open={menu === "checkout"} onClose={() => setMenu(null)} label="Where the agent works" side="top" width={280}><div role="menu">- <ThreadMenuItem icon={<Laptop className="h-3.5 w-3.5" />} selected={checkout === "current"}+ <ThreadMenuItem icon={<Folder className="h-3.5 w-3.5" />} selected={checkout === "current"}label="Current checkout" hint={checkout === "current" ? <Check className="h-3.5 w-3.5" /> : undefined}onSelect={() => { onCheckout("current"); setMenu(null); }} /><ThreadMenuItem icon={<FolderGit2 className="h-3.5 w-3.5" />} selected={checkout === "worktree"}diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadComposer.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadComposer.tsxindex 09097c7ed1..546f7aef96 100644--- a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadComposer.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadComposer.tsx@@ -1,14 +1,15 @@-import { useCallback, useEffect, useMemo, useRef, useState, type KeyboardEvent } from "react";-import { ArrowUp, FileText, Image as ImageIcon, Loader2, MessageCircleQuestion, Paperclip, ShieldAlert, Square, X } from "lucide-react";+import { useCallback, useEffect, useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from "react";+import { ArrowUp, Loader2, MessageCircleQuestion, Paperclip, ShieldAlert, Square, X } from "lucide-react";+import { ChatAttachmentStrip } from "@/components/agentchat/ChatAttachmentStrip";import { ComposerTypeahead } from "@/components/agentchat/ComposerTypeahead";import { runningTurn, type QuestionState, type Timeline, type ToolBlock } from "@/components/agentchat/reduce";import { useChatAttachments } from "@/components/agentchat/useChatAttachments";import { useComposerTypeahead } from "@/components/agentchat/useComposerTypeahead";import type { ChatAttachment } from "@/lib/agentChatApi";-import { joinProviderOptions } from "@/store/agentChat";+import { joinProviderOptions, type ComposerDraft } from "@/store/agentChat";import { cn } from "@/lib/utils";import { AccessPicker, AgentModelPicker, EffortPicker } from "./ThreadPickers";-import { threadAgents, useThreadChatStore } from "./threadModel";+import { rememberSeat, rememberedSeat, threadAgents, useThreadChatStore } from "./threadModel";/** A message typed while the agent was still working, sent when it is free. */interface QueuedMessage {@@ -125,12 +126,15 @@ export function ThreadComposer({prepareDraft,placeholder = "Ask for changes, send follow-ups, or attach images",autoFocusNonce,+ strip,}: {/** Which thread the box is typing for — the session id, or `draft:<project>`. */threadKey: string;prepareDraft: () => Promise<string | null>;placeholder?: string;autoFocusNonce: number;+ /** The strip that hangs under the card — where the agent works and on which branch. */+ strip?: ReactNode;}) {const draft = useThreadChatStore((state) => state.draft);const timeline = useThreadChatStore((state) => state.timeline);@@ -175,8 +179,11 @@ export function ThreadComposer({useEffect(() => {if (activeSessionId || providers.length === 0) return;if (providers.some((option) => option.id === draft.provider && option.connected)) return;- const pick = providers.find((option) => option.connected) ?? providers[0];- if (pick && pick.id !== draft.provider) void useThreadChatStore.getState().setDraft({ provider: pick.id });+ const seat = rememberedSeat();+ const remembered = seat && providers.find((option) => option.id === seat.provider && option.connected);+ if (remembered && seat) { void useThreadChatStore.getState().setDraft(seat); return; }+ const first = providers.find((option) => option.connected) ?? providers[0];+ if (first && first.id !== draft.provider) void useThreadChatStore.getState().setDraft({ provider: first.id });}, [activeSessionId, providers, draft.provider]);const setValue = useCallback((next: string) => {@@ -284,6 +291,13 @@ export function ThreadComposer({}};+ // A pick the person made is the seat every new thread starts on.+ const pick = async (patch: Partial<Pick<ComposerDraft, "provider" | "model" | "effort" | "permissionMode">>) => {+ const store = useThreadChatStore.getState();+ await store.setDraft(patch);+ rememberSeat(useThreadChatStore.getState().draft);+ };+const decide = (approvalId: string, decision: "allow" | "allow_always" | "deny") => {void useThreadChatStore.getState().decide(approvalId, decision);};@@ -304,20 +318,17 @@ export function ThreadComposer({className="rounded p-0.5 text-muted-foreground hover:text-foreground"><X className="h-3.5 w-3.5" /></button></div>)}</div>}+ {error && <p role="alert" className="mb-2 px-4 text-xs text-destructive">{error}</p>}<div ref={cardRef} {...files.dragHandlers}className={cn(- "relative overflow-hidden rounded-3xl border border-border bg-card shadow-rim transition-colors focus-within:border-border-strong",+ "relative z-10 overflow-hidden rounded-3xl border border-border bg-card shadow-[0_8px_24px_-12px_rgb(var(--scrim-rgb)/0.5)] transition-colors focus-within:border-border-strong",files.dragging && "border-accent ring-2 ring-accent/40",)}><ApprovalPanel timeline={timeline} onDecide={decide} /><QuestionPanel timeline={timeline} />- {(files.attachments.length > 0 || files.analyzing > 0) && <div className="flex flex-wrap gap-1.5 px-4 pt-3">- {files.attachments.map((file) => <span key={file.name} className="inline-flex max-w-[220px] items-center gap-1.5 rounded-lg border border-border bg-background px-2 py-1 text-xs text-foreground" title={file.note || file.name}>- {file.kind === "image" ? <ImageIcon aria-hidden className="h-3.5 w-3.5 shrink-0 text-muted-foreground" /> : <FileText aria-hidden className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />}- <span className="truncate">{file.name}</span>- <button type="button" aria-label={`Remove ${file.name}`} onClick={() => files.remove(file.name)} className="rounded text-muted-foreground hover:text-foreground"><X className="h-3 w-3" /></button>- </span>)}- {files.analyzing > 0 && <span className="inline-flex items-center gap-1.5 px-1 text-xs text-muted-foreground"><Loader2 className="h-3 w-3 animate-spin" />Reading {files.analyzing} file{files.analyzing === 1 ? "" : "s"}…</span>}+ {(files.attachments.length > 0 || files.analyzing > 0) && <div className="px-3 pt-3 sm:px-4">+ <ChatAttachmentStrip attachments={files.attachments} analyzing={files.analyzing}+ onRemove={files.remove} previews={files.previews} /></div>}<textarea ref={textareaRef} value={value} rows={2} data-testid="thread-composer-input"aria-label="Message the coding agent"@@ -328,43 +339,42 @@ export function ThreadComposer({onClick={() => typeahead.refresh()}onBlur={() => typeahead.blur()}onPaste={files.onPaste}- className="block max-h-[40vh] min-h-[56px] w-full resize-none bg-transparent px-4 pb-1 pt-3.5 text-base leading-6 text-foreground outline-none placeholder:text-faint-foreground" />- <div className="flex items-center gap-1 px-2 pb-2 pt-1">+ className="block max-h-[40vh] min-h-[84px] w-full resize-none bg-transparent px-4 pb-2 pt-4 text-base leading-6 text-foreground outline-none placeholder:text-faint-foreground sm:px-5" />+ <div className="flex min-w-0 items-center justify-between gap-2 px-3 pb-3 sm:px-4 sm:pb-4">+ <div className="-ms-1 flex min-w-0 flex-1 items-center gap-1 overflow-x-auto [scrollbar-width:none]"><AgentModelPicker providers={providers} liveModels={liveModels} draft={draft}lockedProvider={started && activeSessionId ? draft.provider : null}- onPick={(nextProvider, model) => {- const store = useThreadChatStore.getState();- void store.setDraft(nextProvider !== draft.provider ? { provider: nextProvider, model } : { model });- }} />- <EffortPicker provider={provider} draft={draft} liveModels={liveModels}- onPick={(effort) => void useThreadChatStore.getState().setDraft({ effort })} />- <AccessPicker provider={provider} draft={draft}- onPick={(permissionMode) => void useThreadChatStore.getState().setDraft({ permissionMode })} />- <div className="ml-auto flex items-center gap-1">+ onPick={(nextProvider, model) => void pick(nextProvider !== draft.provider ? { provider: nextProvider, model } : { model })} />+ <EffortPicker provider={provider} draft={draft} liveModels={liveModels} separated+ onPick={(effort) => void pick({ effort })} />+ <AccessPicker provider={provider} draft={draft} separated+ onPick={(permissionMode) => void pick({ permissionMode })} />+ </div>+ <div className="flex shrink-0 items-center gap-1.5"><input ref={fileInput} type="file" multiple hidden onChange={(event) => {const picked = Array.from(event.target.files ?? []);if (picked.length) files.attachFiles(picked);event.target.value = "";}} /><button type="button" aria-label="Attach files" title="Attach files or images" onClick={() => fileInput.current?.click()}- className="flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">- <Paperclip className="h-4 w-4" />+ className="flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">+ <Paperclip className="h-[18px] w-[18px]" /></button>{running && !canSend? <button type="button" aria-label="Stop the agent" title="Stop" data-testid="thread-stop"onClick={() => { setPaused(true); void useThreadChatStore.getState().cancel(); }}- className="flex h-8 w-8 items-center justify-center rounded-full bg-foreground text-background hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">+ className="flex h-8 w-8 items-center justify-center rounded-full bg-foreground text-background transition-transform duration-150 hover:scale-105 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"><Square className="h-3 w-3 fill-current" /></button>: <button type="button" aria-label={running ? "Queue message" : "Send message"} title={running ? "Queue for when the agent is done" : "Send"}data-testid="thread-send" disabled={!canSend} onClick={() => void submit()}- className="flex h-8 w-8 items-center justify-center rounded-full bg-accent text-accent-foreground transition-opacity hover:opacity-90 disabled:opacity-35 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">+ className="flex h-8 w-8 items-center justify-center rounded-full bg-accent text-accent-foreground shadow-[0_1px_2px_rgb(var(--accent-rgb)/0.3)] transition-[opacity,transform] duration-150 hover:scale-105 hover:opacity-95 disabled:opacity-40 disabled:hover:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">{starting || busy ? <Loader2 className="h-4 w-4 animate-spin" /> : <ArrowUp className="h-4 w-4" />}</button>}</div></div></div>- {error && <p role="alert" className="mt-2 px-3 text-xs text-destructive">{error}</p>}+ {strip}<ComposerTypeahead anchorRef={cardRef} open={typeahead.open} trigger={typeahead.token?.trigger ?? null}items={typeahead.items} loading={typeahead.loading} activeIndex={typeahead.activeIndex}onHover={typeahead.setActiveIndex} onPick={typeahead.pick} />diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadDiffPanel.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadDiffPanel.tsxdeleted file mode 100644index 0be5db5cf6..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadDiffPanel.tsx+++ /dev/null@@ -1,125 +0,0 @@-import { useEffect, useState } from "react";-import { ChevronLeft, FileDiff, Loader2, RefreshCw, X } from "lucide-react";-import { DiffView } from "@/components/agentic/sidePanel/explorer/DiffView";-import { fetchFolderChanges, fetchFolderDiff, type FolderChange, type FolderChanges, type FolderDiff } from "@/lib/gitApi";-import { cn } from "@/lib/utils";--const STATUS_MARK: Record<FolderChange["status"], { letter: string; className: string }> = {- modified: { letter: "M", className: "text-warning" },- added: { letter: "A", className: "text-success" },- untracked: { letter: "U", className: "text-success" },- deleted: { letter: "D", className: "text-destructive" },- conflicted: { letter: "!", className: "text-destructive" },-};--/** Rows drawn at once; a tree with thousands of changes stays responsive. */-const SHOWN_FILES = 300;--function splitPath(path: string): { name: string; dir: string } {- const parts = path.split("/");- const name = parts.pop() ?? path;- return { name, dir: parts.join("/") };-}--/**- * The thread's own diff panel: every file changed under the thread's folder,- * and one file's change against the last commit. It reads the thread's- * folder — a worktree no workspace has open included — and reads again when- * a turn ends (`version`).- */-export function ThreadDiffPanel({ folder, version, onClose }: { folder: string; version: number; onClose: () => void }) {- const [changes, setChanges] = useState<FolderChanges | null>(null);- const [error, setError] = useState("");- const [loading, setLoading] = useState(false);- const [nonce, setNonce] = useState(0);- const [openPath, setOpenPath] = useState<string | null>(null);- const [diff, setDiff] = useState<FolderDiff | null>(null);- const [diffError, setDiffError] = useState("");- const [showAll, setShowAll] = useState(false);-- useEffect(() => {- const controller = new AbortController();- setLoading(true);- setError("");- fetchFolderChanges(folder, controller.signal)- .then((next) => { if (!controller.signal.aborted) setChanges(next); })- .catch((err: unknown) => { if (!controller.signal.aborted) setError(err instanceof Error ? err.message : String(err)); })- .finally(() => { if (!controller.signal.aborted) setLoading(false); });- return () => controller.abort();- }, [folder, version, nonce]);-- // Another thread's folder: nothing of the last one may show under its name.- useEffect(() => {- setOpenPath(null);- setChanges(null);- setShowAll(false);- }, [folder]);-- useEffect(() => {- if (!openPath) { setDiff(null); return; }- const controller = new AbortController();- setDiff(null);- setDiffError("");- fetchFolderDiff(folder, openPath, controller.signal)- .then((next) => { if (!controller.signal.aborted) setDiff(next); })- .catch((err: unknown) => { if (!controller.signal.aborted) setDiffError(err instanceof Error ? err.message : String(err)); });- return () => controller.abort();- }, [folder, openPath, version]);-- const files = (changes?.files ?? []).filter((file) => !file.is_directory);- const added = files.reduce((sum, file) => sum + (file.added ?? 0), 0);- const removed = files.reduce((sum, file) => sum + (file.removed ?? 0), 0);-- return <aside aria-label="Changes" data-testid="thread-diff-panel" className="flex h-full min-h-0 flex-col border-l border-border bg-background">- <div className="flex h-12 shrink-0 items-center gap-2 border-b border-border px-3">- {openPath- ? <button type="button" aria-label="Back to the changed files" onClick={() => setOpenPath(null)}- className="rounded p-1 text-muted-foreground hover:bg-secondary hover:text-foreground"><ChevronLeft className="h-4 w-4" /></button>- : <FileDiff aria-hidden className="h-4 w-4 text-muted-foreground" />}- <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground-strong" title={openPath ?? undefined}>- {openPath ? splitPath(openPath).name : "Changes"}- </span>- {!openPath && (added > 0 || removed > 0) && <span className="shrink-0 font-mono text-xs tabular-nums">- <span className="text-success">+{added}</span> <span className="text-destructive">−{removed}</span>- </span>}- <button type="button" aria-label="Read the changes again" title="Refresh" onClick={() => setNonce((value) => value + 1)}- className="rounded p-1 text-muted-foreground hover:bg-secondary hover:text-foreground">- {loading ? <Loader2 className="h-3.5 w-3.5 animate-spin" /> : <RefreshCw className="h-3.5 w-3.5" />}- </button>- <button type="button" aria-label="Close changes" onClick={onClose} className="rounded p-1 text-muted-foreground hover:bg-secondary hover:text-foreground"><X className="h-4 w-4" /></button>- </div>- <div className="min-h-0 flex-1 overflow-auto scrollbar-jarvis">- {openPath- ? diffError ? <p className="px-4 py-3 text-sm text-destructive">{diffError}</p>- : !diff ? <p className="flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground"><Loader2 className="h-3.5 w-3.5 animate-spin" />Loading the diff…</p>- : diff.binary ? <p className="px-4 py-3 text-sm text-muted-foreground">A binary file — no line diff.</p>- : diff.hunks.length === 0 ? <p className="px-4 py-3 text-sm text-muted-foreground">No changes in this file.</p>- : <DiffView hunks={diff.hunks} />- : error ? <p className="px-4 py-3 text-sm text-destructive">{error}</p>- : changes && !changes.available ? <p className="px-4 py-3 text-sm text-muted-foreground">{changes.reason || "This folder is not a git repository."}</p>- : files.length === 0 ? <p className="px-4 py-3 text-sm text-muted-foreground">{loading ? "Reading the changes…" : "No changes yet."}</p>- : <ul className="py-1">- {(showAll ? files : files.slice(0, SHOWN_FILES)).map((file) => {- const { name, dir } = splitPath(file.path);- const mark = STATUS_MARK[file.status] ?? STATUS_MARK.modified;- return <li key={file.path}>- <button type="button" onClick={() => setOpenPath(file.path)} title={file.path}- className="flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring">- <span className={cn("w-3 shrink-0 text-center font-mono text-xs", mark.className)}>{mark.letter}</span>- <span className="min-w-0 flex-1 truncate"><span className="text-foreground">{name}</span>{dir && <span className="ml-1.5 text-xs text-muted-foreground">{dir}</span>}</span>- <span className="shrink-0 font-mono text-xs tabular-nums">- {file.added != null && file.added > 0 && <span className="text-success">+{file.added}</span>}- {file.removed != null && file.removed > 0 && <span className="ml-1 text-destructive">−{file.removed}</span>}- </span>- </button>- </li>;- })}- {!showAll && files.length > SHOWN_FILES && <li>- <button type="button" onClick={() => setShowAll(true)} className="px-3 py-2 text-xs text-muted-foreground hover:text-foreground">- Show {files.length - SHOWN_FILES} more files- </button>- </li>}- </ul>}- </div>- </aside>;-}diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadHeader.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadHeader.tsxdeleted file mode 100644index 295c061ea5..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadHeader.tsx+++ /dev/null@@ -1,289 +0,0 @@-import { useEffect, useRef, useState } from "react";-import {- ChevronDown, FileDiff, FolderOpen, GitCommitHorizontal, GitPullRequest, Globe, Loader2, Pencil, Play, Plus,- SquareCode, SquareTerminal, Trash2, Upload,-} from "lucide-react";-import { patchAgentChatSession } from "@/lib/agentChatApi";-import { fetchProjectLaunchers, openProjectIn, revealProject, type ProjectLaunchers } from "@/lib/chatLibraryApi";-import { commitAll, openPullRequest, pushBranch } from "@/lib/gitApi";-import { openExternalUrl } from "@/lib/openExternal";-import { cn } from "@/lib/utils";-import { useEventStore } from "@/store/events";-import { useGitInfo } from "./ThreadBranchBar";-import { ThreadMenuHeading, ThreadMenuItem, ThreadMenuSeparator, ThreadPopover } from "./ThreadPopover";-import { deleteProjectAction, readProjectActions, saveProjectAction, type ProjectAction } from "./projectActions";-import { useThreadChatStore } from "./threadModel";--const PILL = "flex h-7 items-center gap-1.5 rounded-md border border-border px-2 text-xs text-foreground transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50";-const ICON_BUTTON = "flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";--const FILE_MANAGER_LABEL = (() => {- const platform = typeof navigator === "undefined" ? "" : navigator.userAgent;- if (/Windows/i.test(platform)) return "Show in Explorer";- if (/Mac OS X|Macintosh/i.test(platform)) return "Show in Finder";- return "Show in file manager";-})();--const LAST_EDITOR_KEY = "jarvis.ide.threadOpenIn.v1";--function errorText(error: unknown): string {- return error instanceof Error ? error.message : String(error);-}--/** "Add action", or the project's first action with the rest behind a chevron. */-function ActionsControl({ projectId, onRun }: { projectId: string; onRun: (action: ProjectAction) => void }) {- const [actions, setActions] = useState<ProjectAction[]>(() => readProjectActions(projectId));- const [menu, setMenu] = useState(false);- const [editing, setEditing] = useState<ProjectAction | null>(null);- const anchor = useRef<HTMLDivElement | null>(null);- useEffect(() => { setActions(readProjectActions(projectId)); }, [projectId]);- const first = actions[0];- const startNew = () => { setEditing({ id: `action-${Date.now().toString(36)}`, name: "", command: "" }); setMenu(true); };- const save = () => {- if (!editing || !editing.name.trim() || !editing.command.trim()) return;- setActions(saveProjectAction(projectId, { ...editing, name: editing.name.trim(), command: editing.command.trim() }));- setEditing(null);- setMenu(false);- };- return <div ref={anchor} className="flex items-center">- {first- ? <div className="flex items-center">- <button type="button" className={cn(PILL, "rounded-r-none")} onClick={() => onRun(first)} title={first.command} data-testid="thread-action-run">- <Play aria-hidden className="h-3 w-3" />{first.name}- </button>- <button type="button" aria-label="More actions" aria-haspopup="menu" aria-expanded={menu}- className={cn(PILL, "rounded-l-none border-l-0 px-1")} onClick={() => { setEditing(null); setMenu(!menu); }}>- <ChevronDown aria-hidden className="h-3 w-3" />- </button>- </div>- : <button type="button" className={cn(PILL, "border-transparent text-muted-foreground hover:text-foreground")} onClick={startNew} data-testid="thread-add-action">- <Plus aria-hidden className="h-3 w-3" />Add action- </button>}- <ThreadPopover anchor={anchor} open={menu} onClose={() => { setMenu(false); setEditing(null); }} label="Project actions" align="end" width={320}>- {editing- ? <form className="space-y-2 p-2" onSubmit={(event) => { event.preventDefault(); save(); }}>- <p className="text-sm font-medium text-foreground-strong">{actions.some((row) => row.id === editing.id) ? "Edit action" : "New action"}</p>- <p className="text-xs text-muted-foreground">A command this project runs often. It opens in the terminal drawer.</p>- <label className="block text-xs text-muted-foreground">Name- <input autoFocus value={editing.name} onChange={(event) => setEditing({ ...editing, name: event.target.value })} placeholder="Dev server" maxLength={40}- className="mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring" />- </label>- <label className="block text-xs text-muted-foreground">Command- <input value={editing.command} onChange={(event) => setEditing({ ...editing, command: event.target.value })} placeholder="npm run dev"- className="mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 font-mono text-xs text-foreground outline-none focus:ring-2 focus:ring-ring" />- </label>- <div className="flex justify-end gap-2 pt-1">- <button type="button" onClick={() => setEditing(null)} className="rounded-md px-2.5 py-1 text-sm text-muted-foreground hover:bg-secondary">Cancel</button>- <button type="submit" disabled={!editing.name.trim() || !editing.command.trim()} className="rounded-md bg-accent px-2.5 py-1 text-sm text-accent-foreground disabled:opacity-40">Save</button>- </div>- </form>- : <div role="menu">- {actions.map((action) => <div key={action.id} className="group/action flex items-center">- <div className="min-w-0 flex-1"><ThreadMenuItem icon={<Play className="h-3.5 w-3.5" />} label={action.name}- hint={<span className="font-mono">{action.command.length > 22 ? `${action.command.slice(0, 21)}…` : action.command}</span>}- onSelect={() => { setMenu(false); onRun(action); }} /></div>- <button type="button" aria-label={`Edit ${action.name}`} onClick={() => setEditing(action)} className="rounded p-1 text-muted-foreground opacity-0 hover:text-foreground group-hover/action:opacity-100"><Pencil className="h-3.5 w-3.5" /></button>- <button type="button" aria-label={`Delete ${action.name}`} onClick={() => setActions(deleteProjectAction(projectId, action.id))} className="rounded p-1 text-muted-foreground opacity-0 hover:text-destructive group-hover/action:opacity-100"><Trash2 className="h-3.5 w-3.5" /></button>- </div>)}- <ThreadMenuSeparator />- <ThreadMenuItem icon={<Plus className="h-3.5 w-3.5" />} label="Add action" onSelect={startNew} />- </div>}- </ThreadPopover>- </div>;-}--/** "Open" in the editor last used, with every editor and the file manager behind the chevron. */-function OpenInControl({ projectId }: { projectId: string }) {- const pushToast = useEventStore((state) => state.pushToast);- const [launchers, setLaunchers] = useState<ProjectLaunchers | null>(null);- const [menu, setMenu] = useState(false);- const anchor = useRef<HTMLDivElement | null>(null);- useEffect(() => {- let live = true;- fetchProjectLaunchers(projectId).then((next) => { if (live) setLaunchers(next); }).catch(() => { if (live) setLaunchers(null); });- return () => { live = false; };- }, [projectId]);- const editors = launchers?.editors ?? [];- let remembered = "";- try { remembered = localStorage.getItem(LAST_EDITOR_KEY) ?? ""; } catch { /* blocked storage: the first editor leads */ }- const preferred = editors.find((editor) => editor.id === remembered) ?? editors[0];- const open = async (target: string) => {- setMenu(false);- try {- if (target === "files") { await revealProject(projectId); return; }- if (target === "remote" && launchers?.remote_url) { await openExternalUrl(launchers.remote_url); return; }- await openProjectIn(projectId, target);- try { localStorage.setItem(LAST_EDITOR_KEY, target); } catch { /* a convenience only */ }- } catch (error) {- pushToast("error", errorText(error));- }- };- if (!launchers) return null;- return <div ref={anchor} className="flex items-center">- <button type="button" className={cn(PILL, "rounded-r-none")} data-testid="thread-open-in"- onClick={() => void open(preferred ? preferred.id : "files")} title={preferred ? `Open in ${preferred.label}` : FILE_MANAGER_LABEL}>- {preferred ? <SquareCode aria-hidden className="h-3.5 w-3.5" /> : <FolderOpen aria-hidden className="h-3.5 w-3.5" />}Open- </button>- <button type="button" aria-label="Open in…" aria-haspopup="menu" aria-expanded={menu} className={cn(PILL, "rounded-l-none border-l-0 px-1")} onClick={() => setMenu(!menu)}>- <ChevronDown aria-hidden className="h-3 w-3" />- </button>- <ThreadPopover anchor={anchor} open={menu} onClose={() => setMenu(false)} label="Open in" align="end" width={240}>- <div role="menu">- {editors.map((editor) => <ThreadMenuItem key={editor.id} icon={<SquareCode className="h-3.5 w-3.5" />} label={editor.label}- selected={editor.id === preferred?.id} onSelect={() => void open(editor.id)} />)}- {launchers.file_manager && <ThreadMenuItem icon={<FolderOpen className="h-3.5 w-3.5" />} label={FILE_MANAGER_LABEL} onSelect={() => void open("files")} />}- {launchers.remote_url && <ThreadMenuItem icon={<Globe className="h-3.5 w-3.5" />} label={launchers.remote_label ? `Open on ${launchers.remote_label}` : "Open the remote"} onSelect={() => void open("remote")} />}- </div>- </ThreadPopover>- </div>;-}--/** Commit, push and open a pull request for the thread's folder. */-function GitControl({ folder, version, defaultMessage }: { folder: string; version: number; defaultMessage: string }) {- const pushToast = useEventStore((state) => state.pushToast);- const { info, refresh } = useGitInfo(folder);- const [menu, setMenu] = useState(false);- const [message, setMessage] = useState("");- const [working, setWorking] = useState<string | null>(null);- const anchor = useRef<HTMLButtonElement | null>(null);- useEffect(() => { if (menu) { refresh(); setMessage((current) => current || defaultMessage); } }, [menu, refresh, defaultMessage]);- useEffect(() => { if (version > 0) refresh(); }, [version, refresh]);- if (!info?.is_repo) return null;- const changed = info.changes.length;- const hasRemote = info.remotes.length > 0;- const label = info.dirty ? (hasRemote ? "Commit & push" : "Commit") : info.ahead > 0 ? "Push" : "Create PR";- const run = async (what: string, work: () => Promise<void>) => {- setWorking(what);- try { await work(); }- catch (error) { pushToast("error", errorText(error)); }- finally { setWorking(null); refresh(); }- };- const commit = (push: boolean) => run(push ? "commit-push" : "commit", async () => {- const text = message.trim();- if (!text) throw new Error("Write a commit message first.");- const result = await commitAll(folder, text);- if (push) await pushBranch(folder);- pushToast("success", push ? `Committed ${result.commit.slice(0, 7)} and pushed.` : `Committed ${result.commit.slice(0, 7)}.`);- setMessage("");- setMenu(false);- });- const push = () => run("push", async () => {- const result = await pushBranch(folder);- pushToast("success", `Pushed to ${result.upstream}.`);- setMenu(false);- });- const pullRequest = () => run("pr", async () => {- const result = await openPullRequest(folder, { title: message.trim() || defaultMessage });- pushToast("success", "Pull request opened.");- setMenu(false);- if (result.url) void openExternalUrl(result.url);- });- return <>- <button ref={anchor} type="button" className={PILL} aria-haspopup="dialog" aria-expanded={menu} onClick={() => setMenu(!menu)} data-testid="thread-git">- {working ? <Loader2 aria-hidden className="h-3.5 w-3.5 animate-spin" /> : <GitCommitHorizontal aria-hidden className="h-3.5 w-3.5" />}- {label}- <ChevronDown aria-hidden className="h-3 w-3" />- </button>- <ThreadPopover anchor={anchor} open={menu} onClose={() => setMenu(false)} label="Git" align="end" width={340}>- <div className="space-y-2 p-2">- <div className="flex items-center justify-between gap-2 text-xs text-muted-foreground">- <span className="truncate font-mono">{info.branch || "detached"}</span>- <span className="shrink-0 tabular-nums">- {changed > 0 ? `${changed} changed` : "clean"}- {(info.insertions > 0 || info.deletions > 0) && <> · <span className="text-success">+{info.insertions}</span> <span className="text-destructive">−{info.deletions}</span></>}- {info.ahead > 0 && ` · ${info.ahead} ahead`}- {info.behind > 0 && ` · ${info.behind} behind`}- </span>- </div>- {info.dirty && <>- <textarea value={message} onChange={(event) => setMessage(event.target.value)} rows={3} aria-label="Commit message" placeholder="Commit message"- className="w-full resize-none rounded-md border border-input bg-background px-2 py-1.5 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring" />- <div className="flex justify-end gap-2">- <button type="button" disabled={working !== null} onClick={() => void commit(false)} className="rounded-md border border-border px-2.5 py-1 text-sm hover:bg-secondary disabled:opacity-50">Commit</button>- {hasRemote && <button type="button" disabled={working !== null} onClick={() => void commit(true)} className="rounded-md bg-accent px-2.5 py-1 text-sm text-accent-foreground disabled:opacity-50">Commit & push</button>}- </div>- </>}- {!info.dirty && <p className="text-sm text-muted-foreground">{info.ahead > 0 ? `${info.ahead} commit${info.ahead === 1 ? "" : "s"} not pushed yet.` : "Nothing to commit."}</p>}- <div role="menu" className="border-t border-border pt-1">- <ThreadMenuHeading>More</ThreadMenuHeading>- <ThreadMenuItem icon={<Upload className="h-3.5 w-3.5" />} label="Push" disabled={!hasRemote || working !== null || (info.ahead === 0 && Boolean(info.upstream))} onSelect={() => void push()} />- <ThreadMenuItem icon={<GitPullRequest className="h-3.5 w-3.5" />} label="Create pull request" hint={info.gh_available ? undefined : "needs gh"}- disabled={!hasRemote || !info.gh_available || working !== null || info.branch === info.default_branch} onSelect={() => void pullRequest()} />- </div>- </div>- </ThreadPopover>- </>;-}--/**- * The bar over a thread: where it lives and what it is called on the left,- * the project's actions, "Open", the git actions and the two drawer- * switches on the right.- */-export function ThreadHeader({- projectId,- projectName,- folder,- title,- sessionId,- terminalOpen,- onToggleTerminal,- diffOpen,- onToggleDiff,- gitVersion,- onRunAction,-}: {- projectId: string;- projectName: string;- folder: string;- title: string;- sessionId: string | null;- terminalOpen: boolean;- onToggleTerminal: () => void;- diffOpen: boolean;- onToggleDiff: () => void;- /** Changes when a turn ends, so the git button reads the folder again. */- gitVersion: number;- onRunAction: (action: ProjectAction) => void;-}) {- const pushToast = useEventStore((state) => state.pushToast);- const [renaming, setRenaming] = useState<string | null>(null);- const rename = async (next: string) => {- setRenaming(null);- const clean = next.trim();- if (!sessionId || !clean || clean === title) return;- try {- await patchAgentChatSession(sessionId, { title: clean });- await useThreadChatStore.getState().loadSessions();- } catch (error) {- pushToast("error", errorText(error));- }- };- return <header className="flex h-12 shrink-0 items-center gap-3 border-b border-border px-4" data-testid="thread-header">- <div className="flex min-w-0 flex-1 items-center gap-2 text-sm">- <span className="shrink-0 truncate text-muted-foreground">{projectName}</span>- <span aria-hidden className="text-faint-foreground">/</span>- {renaming !== null- ? <input autoFocus aria-label="Thread name" value={renaming} maxLength={120}- onChange={(event) => setRenaming(event.target.value)} onBlur={() => void rename(renaming)}- onKeyDown={(event) => { if (event.key === "Enter") void rename(renaming); if (event.key === "Escape") { event.stopPropagation(); setRenaming(null); } }}- className="min-w-0 flex-1 rounded border border-input bg-background px-2 py-0.5 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring" />- : <h1 className={cn("min-w-0 truncate font-medium text-foreground-strong", sessionId && "cursor-text")} title={sessionId ? `${title} — double-click to rename` : title}- onDoubleClick={() => { if (sessionId) setRenaming(title); }} data-testid="thread-title">{title}</h1>}- </div>- <div className="flex shrink-0 items-center gap-1.5">- <ActionsControl projectId={projectId} onRun={onRunAction} />- <OpenInControl projectId={projectId} />- <GitControl folder={folder} version={gitVersion} defaultMessage={title === "New thread" ? "" : title} />- <span aria-hidden className="mx-0.5 h-4 w-px bg-border" />- <button type="button" aria-label={terminalOpen ? "Hide terminal" : "Show terminal"} title="Terminal" aria-pressed={terminalOpen}- onClick={onToggleTerminal} className={cn(ICON_BUTTON, terminalOpen && "bg-secondary text-foreground")} data-testid="thread-terminal-toggle">- <SquareTerminal className="h-4 w-4" />- </button>- <button type="button" aria-label={diffOpen ? "Hide changes" : "Show changes"} title="Changes" aria-pressed={diffOpen}- onClick={onToggleDiff} className={cn(ICON_BUTTON, diffOpen && "bg-secondary text-foreground")} data-testid="thread-diff-toggle">- <FileDiff className="h-4 w-4" />- </button>- </div>- </header>;-}diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadPickers.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadPickers.tsxindex 06083a650b..ff484738da 100644--- a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadPickers.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadPickers.tsx@@ -1,9 +1,10 @@import { useMemo } from "react";import { AgentMark } from "@/components/agentic/AgentMark";-import { permissionModeIcon } from "@/components/agentchat/permissionIcons";+import { isUnguardedPermissionMode, permissionModeIcon } from "@/components/agentchat/permissionIcons";import { Combobox, type ComboboxGroup } from "@/components/ui/combobox";import { useT } from "@/i18n";import type { CuratedModel } from "@/lib/agentChatApi";+import { cn } from "@/lib/utils";import type { ComposerDraft, ProviderOption } from "@/store/agentChat";/**@@ -12,7 +13,13 @@ import type { ComposerDraft, ProviderOption } from "@/store/agentChat";* text buttons until opened; each opens the app's own searchable list.*/-const TRIGGER = "w-auto max-w-[220px] gap-1.5 bg-transparent px-2 py-1 text-sm text-muted-foreground hover:bg-secondary hover:text-foreground";+/** One quiet control in the composer's toolbar: 28 px, medium weight, a lift on hover. */+const TRIGGER = "h-7 w-auto max-w-[240px] gap-1.5 rounded-lg bg-transparent px-2.5 py-0 text-sm font-medium text-foreground-secondary hover:bg-secondary hover:text-foreground";++/** The hairline between two toolbar controls. */+function Separator() {+ return <span aria-hidden className="mx-0.5 hidden h-4 w-px shrink-0 bg-border sm:block" />;+}/** The name a coding agent goes by, not its API brand ("Claude Code", not "Anthropic Claude"). */export function agentName(provider: Pick<ProviderOption, "agent" | "label">): string {@@ -78,11 +85,12 @@ export function AgentModelPicker({return <Combobox ariaLabel="Coding agent and model" testId="thread-model-picker"value={`${draft.provider}${SEP}${draft.model}`} groups={groups}onChange={(value) => { const [provider, model = ""] = value.split(SEP); onPick(provider, model); }}- fallbackLabel={draft.model || "Choose an agent"} searchPlaceholder="Search agents and models"+ fallbackLabel={draft.model || (providers.length ? "Choose an agent" : "Loading agents…")} searchPlaceholder="Search agents and models"triggerHint={false} className={TRIGGER} />;}-export function EffortPicker({ provider, draft, liveModels, onPick }: {+export function EffortPicker({ provider, draft, liveModels, onPick, separated = false }: {+ separated?: boolean;provider: ProviderOption | null;draft: ComposerDraft;liveModels: Record<string, CuratedModel[]>;@@ -95,25 +103,43 @@ export function EffortPicker({ provider, draft, liveModels, onPick }: {return model?.efforts ?? provider.effort_levels;}, [provider, liveModels, draft.model]);if (levels.length === 0 || (levels.length === 1 && levels[0] === "")) return null;- return <Combobox ariaLabel="Reasoning effort" testId="thread-effort-picker" value={draft.effort}- groups={[{ id: "effort", options: levels.map((level) => ({ value: level, label: effortLabel(level, t) })) }]}- onChange={onPick} fallbackLabel={effortLabel(draft.effort, t)} triggerHint={false} className={TRIGGER} />;+ return <>+ {separated && <Separator />}+ <Combobox ariaLabel="Reasoning effort" testId="thread-effort-picker" value={draft.effort}+ groups={[{ id: "effort", options: levels.map((level) => ({ value: level, label: effortLabel(level, t) })) }]}+ onChange={onPick} fallbackLabel={effortLabel(draft.effort, t)} triggerHint={false} className={TRIGGER} />+ </>;}-export function AccessPicker({ provider, draft, onPick }: {+export function AccessPicker({ provider, draft, onPick, separated = false }: {+ separated?: boolean;provider: ProviderOption | null;draft: ComposerDraft;onPick: (mode: string) => void;}) {const modes = provider?.permission_modes ?? [];if (modes.length === 0) return null;- return <Combobox ariaLabel="What the agent may do without asking" testId="thread-access-picker" value={draft.permissionMode}- groups={[{- id: "access",- options: modes.map((mode) => {- const Icon = permissionModeIcon(mode.id);- return { value: mode.id, label: mode.label, hint: mode.description, icon: <Icon aria-hidden className="h-3.5 w-3.5" /> };- }),- }]}- onChange={onPick} fallbackLabel={draft.permissionMode || "Access"} triggerHint={false} className={TRIGGER} />;+ return <>+ {separated && <Separator />}+ <Combobox ariaLabel="What the agent may do without asking" testId="thread-access-picker" value={draft.permissionMode}+ groups={[{+ id: "access",+ label: "Permissions",+ options: modes.map((mode) => {+ const Icon = permissionModeIcon(mode.id);+ const unguarded = isUnguardedPermissionMode(mode.id);+ // The description is a second line under the name, never a right-hand+ // hint: a sentence-long hint pushed the name out of a narrow list.+ return {+ value: mode.id,+ label: mode.label,+ searchText: mode.description,+ description: mode.description,+ icon: <Icon aria-hidden className={cn("h-4 w-4 shrink-0", unguarded ? "text-warning" : "text-muted-foreground")} />,+ };+ }),+ }]}+ onChange={onPick} fallbackLabel={draft.permissionMode || "Access"} triggerHint={false} panelMinWidth={340}+ className={cn(TRIGGER, isUnguardedPermissionMode(draft.permissionMode) && "text-warning hover:text-warning")} />+ </>;}diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTerminalDrawer.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTerminalDrawer.tsxdeleted file mode 100644index e12eb798f1..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTerminalDrawer.tsx+++ /dev/null@@ -1,93 +0,0 @@-import { useCallback, useRef, type PointerEvent as ReactPointerEvent } from "react";-import { Plus, SquareTerminal, X } from "lucide-react";-import { WorkspaceTerminal } from "@/components/workspace/WorkspaceTerminal";-import { cn } from "@/lib/utils";--/** One shell in the drawer: plain, or started to run a project action. */-export interface DrawerTerminal {- id: string;- title: string;- folder: string;- /** Typed once when the shell is ready (an action's command plus Enter). */- input?: string;-}--const MIN_HEIGHT = 140;--/**- * A terminal drawer under the conversation: shells in the thread's own- * folder, one tab each. Project actions open here in a tab of their own. The- * top edge drags to resize; the height is the caller's to keep.- *- * Every shell stays mounted while the person moves between threads — a dev- * server keeps running — but only the open thread's folder has its tabs shown.- */-export function ThreadTerminalDrawer({- terminals,- folder,- open,- active,- height,- onSelect,- onAdd,- onCloseTab,- onClose,- onResize,-}: {- terminals: DrawerTerminal[];- /** The open thread's folder: only its shells are shown. */- folder: string;- open: boolean;- active: string;- height: number;- onSelect: (id: string) => void;- onAdd: () => void;- onCloseTab: (id: string) => void;- onClose: () => void;- onResize: (height: number) => void;-}) {- const drag = useRef<{ startY: number; startHeight: number } | null>(null);- const onPointerDown = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {- event.preventDefault();- drag.current = { startY: event.clientY, startHeight: height };- event.currentTarget.setPointerCapture(event.pointerId);- }, [height]);- const onPointerMove = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {- if (!drag.current) return;- const next = drag.current.startHeight + (drag.current.startY - event.clientY);- onResize(Math.max(MIN_HEIGHT, Math.min(next, Math.round(window.innerHeight * 0.75))));- }, [onResize]);- const onPointerUp = useCallback(() => { drag.current = null; }, []);- const shown = terminals.filter((terminal) => terminal.folder === folder);- const current = shown.some((terminal) => terminal.id === active) ? active : shown[shown.length - 1]?.id ?? "";-- return <section aria-label="Terminal" data-testid="thread-terminal-drawer" style={{ height }}- className={cn("relative shrink-0 flex-col border-t border-border bg-background", open && shown.length > 0 ? "flex" : "hidden")}>- <div role="separator" aria-orientation="horizontal" aria-label="Resize the terminal"- onPointerDown={onPointerDown} onPointerMove={onPointerMove} onPointerUp={onPointerUp} onPointerCancel={onPointerUp}- className="absolute inset-x-0 -top-1 z-10 h-2 cursor-row-resize" />- <div className="flex h-9 shrink-0 items-center gap-1 border-b border-border px-2">- <div role="tablist" aria-label="Terminals" className="flex min-w-0 flex-1 items-center gap-1 overflow-x-auto scrollbar-none">- {shown.map((terminal) => <div key={terminal.id} role="tab" aria-selected={terminal.id === current}- className={cn("group/tab flex h-7 shrink-0 items-center gap-1.5 rounded-md pl-2 pr-1 text-xs transition-colors",- terminal.id === current ? "bg-secondary text-foreground" : "text-muted-foreground hover:bg-secondary/60 hover:text-foreground")}>- <button type="button" onClick={() => onSelect(terminal.id)} className="flex items-center gap-1.5 focus-visible:outline-none">- <SquareTerminal aria-hidden className="h-3.5 w-3.5" /><span className="max-w-[160px] truncate">{terminal.title}</span>- </button>- <button type="button" aria-label={`Close ${terminal.title}`} onClick={() => onCloseTab(terminal.id)}- className="rounded p-0.5 opacity-60 hover:bg-background hover:opacity-100"><X className="h-3 w-3" /></button>- </div>)}- <button type="button" aria-label="New terminal" title="New terminal" onClick={onAdd}- className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-secondary hover:text-foreground"><Plus className="h-3.5 w-3.5" /></button>- </div>- <button type="button" aria-label="Hide terminal" onClick={onClose}- className="flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-secondary hover:text-foreground"><X className="h-4 w-4" /></button>- </div>- <div className="relative min-h-0 flex-1">- {terminals.map((terminal) => <div key={terminal.id} hidden={terminal.id !== current} className="absolute inset-0 p-1">- <WorkspaceTerminal paneKey={terminal.id} agentName="shell" folder={terminal.folder} initialInput={terminal.input}- title={terminal.title} bare active={open && terminal.id === current} />- </div>)}- </div>- </section>;-}diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTree.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTree.tsxindex c6e14dcfd0..4f57a758db 100644--- a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTree.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTree.tsx@@ -1,5 +1,5 @@import { useEffect, useMemo, useRef, useState } from "react";-import { Check, Folder, FolderOpen, Loader2, Mic, MoreHorizontal, Pencil, Plus, SquarePen, Trash2, X } from "lucide-react";+import { Check, Folder, FolderOpen, Loader2, Mic, MoreHorizontal, Pencil, Plus, SquarePlus, Trash2, X } from "lucide-react";import { AgentMark } from "@/components/agentic/AgentMark";import { patchAgentChatSession, type AgentChatSession } from "@/lib/agentChatApi";import type { IdeProject } from "@/lib/agenticIdeApi";@@ -138,16 +138,14 @@ export function ThreadTree() {? <FolderOpen aria-hidden className="h-4 w-4 shrink-0 text-muted-foreground" strokeWidth={1.75} />: <Folder aria-hidden className="h-4 w-4 shrink-0 text-muted-foreground" strokeWidth={1.75} />}<span className="min-w-0 flex-1 truncate">{project.name}</span>- {!open && running > 0 && <Loader2 aria-label={`${running} working`} className="h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground group-hover:opacity-0" />}+ {!open && running > 0 && <Loader2 aria-label={`${running} working`} className="h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground" />}+ </button>+ <button type="button" aria-label={`New thread in ${project.name}`} title="New thread"+ data-testid={`thread-new-${project.id}`}+ onClick={() => { setProjectOpen(project.id, true); newThread(project.id); }}+ className="mr-1 flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground/80 transition-colors hover:bg-background/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">+ <SquarePlus className="h-4 w-4" strokeWidth={1.75} /></button>- <div className="pointer-events-none absolute inset-y-0 right-0 flex items-center rounded-r-md bg-gradient-to-l from-muted from-60% to-transparent pl-5 pr-1 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 [@media(hover:none)]:pointer-events-auto [@media(hover:none)]:opacity-100">- <button type="button" aria-label={`New thread in ${project.name}`} title="New thread"- data-testid={`thread-new-${project.id}`}- onClick={() => { setProjectOpen(project.id, true); newThread(project.id); }}- className="rounded p-1 text-muted-foreground hover:bg-background/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">- <SquarePen className="h-3.5 w-3.5" />- </button>- </div></div>{open && <div className="mb-1 flex flex-col gap-px">{draftHere && <div aria-current="page"@@ -261,7 +259,7 @@ export function ThreadTree() {: <div role="menu"><ThreadMenuItem icon={<Pencil className="h-3.5 w-3.5" />} label="Rename"onSelect={() => { setRenaming({ sessionId: menuSession.session_id, title: threadTitle(menuSession) }); setMenu(null); }} />- <ThreadMenuItem icon={<SquarePen className="h-3.5 w-3.5" />} label="New thread in this project"+ <ThreadMenuItem icon={<SquarePlus className="h-3.5 w-3.5" />} label="New thread in this project"onSelect={() => { newThread(menu.projectId); setMenu(null); }} /><ThreadMenuSeparator /><ThreadMenuItem icon={<Trash2 className="h-3.5 w-3.5" />} label="Delete" danger disabled={Boolean(menuSession.running)}diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadView.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadView.test.tsxindex f0cd03bd29..4f526c13dc 100644--- a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadView.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadView.test.tsx@@ -100,6 +100,13 @@ describe("ThreadView", () => {expect(useIdeThreadsStore.getState().projectOf).toEqual({ s1: "p1" });});+ it("starts a new thread on the agent and model the person picked last", async () => {+ localStorage.setItem("jarvis.ide.threadSeat.v1", JSON.stringify({ provider: "claude-api", model: "claude-opus-5-5", effort: "low", permissionMode: "default" }));+ render(<ThreadView onScreen />);+ await waitFor(() => expect(useThreadChatStore.getState().draft).toEqual(expect.objectContaining({ provider: "claude-api", model: "claude-opus-5-5", effort: "low" })));+ await waitFor(() => expect(screen.getByTestId("thread-model-picker").textContent).toContain("Opus 5.5"));+ });+it("files a thread started in a draft under its project when the person moved on meanwhile", async () => {let finishCreate: (row: AgentChatSession) => void = () => {};api.createAgentChatSession.mockReturnValue(new Promise<AgentChatSession>((resolve) => { finishCreate = resolve; }));diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadView.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadView.tsxindex 9f356316cf..463006efac 100644--- a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadView.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadView.tsx@@ -6,33 +6,9 @@ import { useIdeProjectsStore } from "@/store/ideProjects";import { useIdeThreadsStore } from "@/store/ideThreads";import { ThreadBranchBar, type ThreadCheckout } from "./ThreadBranchBar";import { ThreadComposer } from "./ThreadComposer";-import { ThreadDiffPanel } from "./ThreadDiffPanel";-import { ThreadHeader } from "./ThreadHeader";import { ThreadMenuItem, ThreadPopover } from "./ThreadPopover";-import { ThreadTerminalDrawer, type DrawerTerminal } from "./ThreadTerminalDrawer";import { ThreadTimeline } from "./ThreadTimeline";-import { actionInput, type ProjectAction } from "./projectActions";-import { projectIdFor, threadTitle, useThreadChatStore } from "./threadModel";--const DRAWER_HEIGHT_KEY = "jarvis.ide.threadDrawerHeight.v1";-const DIFF_OPEN_KEY = "jarvis.ide.threadDiffOpen.v1";--function storedNumber(key: string, fallback: number): number {- try {- const value = Number(localStorage.getItem(key));- return Number.isFinite(value) && value > 0 ? value : fallback;- } catch { return fallback; }-}--function storedFlag(key: string): boolean {- try { return localStorage.getItem(key) === "1"; } catch { return false; }-}--function storeValue(key: string, value: string): void {- try { localStorage.setItem(key, value); } catch { /* a convenience only */ }-}--let terminalSerial = 0;+import { projectIdFor, rememberedSeat, useThreadChatStore } from "./threadModel";/*** The IDE's thread layout: one conversation with a coding agent at a time.@@ -55,15 +31,11 @@ export function ThreadView({ onScreen }: { onScreen: boolean }) {const activeSession = useThreadChatStore((state) => state.activeSession);const timeline = useThreadChatStore((state) => state.timeline);const draft = useThreadChatStore((state) => state.draft);+ const catalog = useThreadChatStore((state) => state.catalog);const lastError = useThreadChatStore((state) => state.lastError);const [checkout, setCheckout] = useState<ThreadCheckout>("current");const [base, setBase] = useState("");const [projectMenu, setProjectMenu] = useState(false);- const [terminals, setTerminals] = useState<DrawerTerminal[]>([]);- const [activeTerminal, setActiveTerminal] = useState("");- const [drawerOpen, setDrawerOpen] = useState(false);- const [drawerHeight, setDrawerHeight] = useState(() => storedNumber(DRAWER_HEIGHT_KEY, 280));- const [diffOpen, setDiffOpen] = useState(() => storedFlag(DIFF_OPEN_KEY));const [composerHeight, setComposerHeight] = useState(160);const composerBox = useRef<HTMLDivElement | null>(null);const projectAnchor = useRef<HTMLButtonElement | null>(null);@@ -106,12 +78,31 @@ export function ThreadView({ onScreen }: { onScreen: boolean }) {if (store.activeSessionId || store.timeline.items.length > 0) store.newChat();}, [selection.sessionId, selection.projectId, activeSessionId]);- // A new draft starts in its project's own checkout.+ // The agents are listed the moment the view opens, not when a menu is.+ useEffect(() => {+ const store = useThreadChatStore.getState();+ if (!store.catalog || store.catalogStale) void store.loadCatalog();+ }, []);++ // A new draft starts in its project's own checkout, on the agent and model+ // the person picked last — never on whatever thread happened to be open.useEffect(() => {if (!isDraft) return;setCheckout("current");setBase("");- }, [isDraft, selection.projectId]);+ // Never picked here yet: the seat of the newest thread is the last choice made.+ const store = useThreadChatStore.getState();+ const cli = new Set((store.catalog?.providers ?? []).filter((row) => row.agent).map((row) => row.id));+ const newest = [...store.sessions].filter((row) => cli.has(row.provider)).sort((x, y) => y.created_ms - x.created_ms)[0];+ const seat = rememberedSeat() ?? (newest+ ? { provider: newest.provider, model: newest.model, effort: newest.effort, permissionMode: newest.permission_mode }+ : null);+ const draftNow = useThreadChatStore.getState().draft;+ if (seat && (seat.provider !== draftNow.provider || seat.model !== draftNow.model+ || seat.effort !== draftNow.effort || seat.permissionMode !== draftNow.permissionMode)) {+ void useThreadChatStore.getState().setDraft(seat);+ }+ }, [isDraft, selection.projectId, sessions.length > 0, Boolean(catalog)]);// A draft runs in its project's folder.useEffect(() => {@@ -156,34 +147,8 @@ export function ThreadView({ onScreen }: { onScreen: boolean }) {if (isDraft && !activeSessionId && lastError) startingIn.current = null;}, [isDraft, activeSessionId, lastError]);- const finishedTurns = useMemo(() => timeline.items.filter((item) => item.type === "turn" && item.status !== "running").length, [timeline.items]);const running = timeline.items.some((item) => item.type === "turn" && item.status === "running");- const addTerminal = useCallback((title: string, input?: string) => {- if (!folder) return;- const id = `thread-term-${Date.now().toString(36)}-${++terminalSerial}`;- setTerminals((current) => [...current, { id, title, folder, ...(input ? { input } : {}) }]);- setActiveTerminal(id);- setDrawerOpen(true);- }, [folder]);-- const toggleTerminal = () => {- if (drawerOpen) { setDrawerOpen(false); return; }- if (!terminals.some((terminal) => terminal.folder === folder)) addTerminal("Terminal");- else setDrawerOpen(true);- };-- const runAction = (action: ProjectAction) => addTerminal(action.name, actionInput(action.command));-- const closeTerminal = (id: string) => {- setTerminals((current) => {- const next = current.filter((terminal) => terminal.id !== id);- if (id === activeTerminal) setActiveTerminal(next[next.length - 1]?.id ?? "");- if (!next.some((terminal) => terminal.folder === folder)) setDrawerOpen(false);- return next;- });- };-if (!project) {return <div className="flex h-full flex-col items-center justify-center gap-3 px-6 text-center" data-testid="thread-view-empty"><FolderPlus className="h-8 w-8 text-muted-foreground/70" />@@ -193,59 +158,42 @@ export function ThreadView({ onScreen }: { onScreen: boolean }) {</div>;}- // The list row carries the newest title (the CLI's own, or the first- // message's); the open session was read before its first message named it.- const listed = sessions.find((row) => row.session_id === selection.sessionId);- const title = isDraft ? "New thread" : threadTitle(listed ?? session);const threadKey = selection.sessionId ?? `draft:${project.id}`;const empty = isDraft && timeline.items.length === 0;- return <div className="flex h-full min-h-0" data-testid="thread-view">- <div className="flex min-w-0 flex-1 flex-col">- <ThreadHeader projectId={project.id} projectName={project.name} folder={folder} title={title}- sessionId={selection.sessionId} terminalOpen={drawerOpen && terminals.some((terminal) => terminal.folder === folder)} onToggleTerminal={toggleTerminal}- diffOpen={diffOpen} onToggleDiff={() => { const next = !diffOpen; setDiffOpen(next); storeValue(DIFF_OPEN_KEY, next ? "1" : "0"); }}- gitVersion={finishedTurns} onRunAction={runAction} />- <div className="relative flex min-h-0 flex-1 flex-col">- {empty- ? <div className="flex min-h-0 flex-1 flex-col items-center justify-center px-5 pb-6">- <h2 className="text-center text-2xl font-normal tracking-tight text-foreground">- What should we build in{" "}- <button ref={projectAnchor} type="button" aria-haspopup="menu" aria-expanded={projectMenu} onClick={() => setProjectMenu(!projectMenu)}- className="inline-flex items-center gap-1 rounded-md font-semibold text-foreground-strong hover:bg-secondary/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"- data-testid="thread-project-picker">- {project.name}<ChevronDown aria-hidden className="h-4 w-4 text-muted-foreground" />- </button>?- </h2>- <ThreadPopover anchor={projectAnchor} open={projectMenu} onClose={() => setProjectMenu(false)} label="Projects" width={260}>- <div role="menu">- {visible.map((entry) => <ThreadMenuItem key={entry.id} label={entry.name} selected={entry.id === project.id}- hint={entry.id === project.id ? <Check className="h-3.5 w-3.5" /> : undefined}- onSelect={() => { setProjectMenu(false); useIdeThreadsStore.getState().newThread(entry.id); }} />)}- <ThreadMenuItem icon={<FolderPlus className="h-3.5 w-3.5" />} label="Connect another folder" onSelect={() => { setProjectMenu(false); connectProject(); }} />- </div>- </ThreadPopover>- <div className="mt-6 w-full">- <ThreadComposer threadKey={threadKey} prepareDraft={prepareDraft} autoFocusNonce={focusNonce + (onScreen ? 1 : 0)} />- <ThreadBranchBar folder={folder} draft checkout={checkout} onCheckout={setCheckout} base={base} onBase={setBase} locked={false} />- </div>+ const strip = <ThreadBranchBar folder={folder} draft={isDraft} checkout={checkout} onCheckout={setCheckout}+ base={base} onBase={setBase} locked={running} />;++ return <div className="relative flex h-full min-h-0 flex-col" data-testid="thread-view">+ {empty+ ? <div className="flex min-h-0 flex-1 flex-col items-center justify-center px-5 pb-10">+ <h2 className="text-center text-2xl font-normal tracking-tight text-foreground sm:text-3xl">+ What should we build in{" "}+ <button ref={projectAnchor} type="button" aria-haspopup="menu" aria-expanded={projectMenu} onClick={() => setProjectMenu(!projectMenu)}+ className="inline-flex items-center gap-1 rounded-md font-semibold text-foreground-strong hover:bg-secondary/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ data-testid="thread-project-picker">+ {project.name}<ChevronDown aria-hidden className="h-4 w-4 text-muted-foreground" />+ </button>?+ </h2>+ <ThreadPopover anchor={projectAnchor} open={projectMenu} onClose={() => setProjectMenu(false)} label="Projects" width={260}>+ <div role="menu">+ {visible.map((entry) => <ThreadMenuItem key={entry.id} label={entry.name} selected={entry.id === project.id}+ hint={entry.id === project.id ? <Check className="h-3.5 w-3.5" /> : undefined}+ onSelect={() => { setProjectMenu(false); useIdeThreadsStore.getState().newThread(entry.id); }} />)}+ <ThreadMenuItem icon={<FolderPlus className="h-3.5 w-3.5" />} label="Connect another folder" onSelect={() => { setProjectMenu(false); connectProject(); }} /></div>- : <>- <ThreadTimeline items={timeline.items} sessionId={selection.sessionId} bottomInset={composerHeight} />- <div ref={composerBox} className="pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-background from-70% to-transparent px-5 pb-3 pt-6">- <div className="pointer-events-auto">- <ThreadComposer threadKey={threadKey} prepareDraft={prepareDraft} autoFocusNonce={focusNonce} />- <ThreadBranchBar folder={folder} draft={isDraft} checkout={checkout} onCheckout={setCheckout} base={base} onBase={setBase} locked={running} />- </div>- </div>- </>}+ </ThreadPopover>+ <div className="mt-7 w-full">+ <ThreadComposer threadKey={threadKey} prepareDraft={prepareDraft} autoFocusNonce={focusNonce + (onScreen ? 1 : 0)} strip={strip} />+ </div></div>- {terminals.length > 0 && <ThreadTerminalDrawer terminals={terminals} folder={folder} open={drawerOpen} active={activeTerminal} height={drawerHeight}- onSelect={setActiveTerminal} onAdd={() => addTerminal("Terminal")} onCloseTab={closeTerminal} onClose={() => setDrawerOpen(false)}- onResize={(next) => { setDrawerHeight(next); storeValue(DRAWER_HEIGHT_KEY, String(next)); }} />}- </div>- {diffOpen && <div className="w-[min(480px,40%)] shrink-0">- <ThreadDiffPanel folder={folder} version={finishedTurns} onClose={() => { setDiffOpen(false); storeValue(DIFF_OPEN_KEY, "0"); }} />- </div>}+ : <>+ <ThreadTimeline items={timeline.items} sessionId={selection.sessionId} bottomInset={composerHeight} />+ <div ref={composerBox} className="pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-background from-70% to-transparent px-5 pb-4 pt-6">+ <div className="pointer-events-auto">+ <ThreadComposer threadKey={threadKey} prepareDraft={prepareDraft} autoFocusNonce={focusNonce} strip={strip} />+ </div>+ </div>+ </>}</div>;}diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/projectActions.ts b/jarvis/ui/web/frontend/src/components/agentic/threads/projectActions.tsdeleted file mode 100644index 6ec3d943b1..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/threads/projectActions.ts+++ /dev/null@@ -1,63 +0,0 @@-/**- * A project's actions: named shell commands ("Dev server" → `npm run dev`)- * the thread header runs in the terminal drawer with one click.- *- * Kept per project in this browser's storage — a convenience a person sets up- * once; storage that is blocked or cleared leaves the header with its plain- * "Add action" button and nothing breaks.- */--export interface ProjectAction {- id: string;- name: string;- command: string;-}--const KEY = "jarvis.ide.projectActions.v1";--function readAll(): Record<string, ProjectAction[]> {- try {- const raw: unknown = JSON.parse(localStorage.getItem(KEY) ?? "{}");- if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};- const out: Record<string, ProjectAction[]> = {};- for (const [project, list] of Object.entries(raw)) {- if (!Array.isArray(list)) continue;- out[project] = list.filter((row): row is ProjectAction =>- Boolean(row) && typeof row.id === "string" && typeof row.name === "string" && typeof row.command === "string");- }- return out;- } catch {- return {};- }-}--function writeAll(all: Record<string, ProjectAction[]>): void {- try { localStorage.setItem(KEY, JSON.stringify(all)); }- catch { /* storage blocked: the actions last for this session only */ }-}--export function readProjectActions(projectId: string): ProjectAction[] {- return readAll()[projectId] ?? [];-}--/** Add or replace (same id) one action; returns the project's new list. */-export function saveProjectAction(projectId: string, action: ProjectAction): ProjectAction[] {- const all = readAll();- const list = all[projectId] ?? [];- const at = list.findIndex((row) => row.id === action.id);- const next = at >= 0 ? list.map((row, i) => (i === at ? action : row)) : [...list, action];- writeAll({ ...all, [projectId]: next });- return next;-}--export function deleteProjectAction(projectId: string, actionId: string): ProjectAction[] {- const all = readAll();- const next = (all[projectId] ?? []).filter((row) => row.id !== actionId);- writeAll({ ...all, [projectId]: next });- return next;-}--/** What the shell is sent to run `command`: the line plus Enter. */-export function actionInput(command: string): string {- return `${command.replace(/\r?\n/g, " ").trim()}\r`;-}diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/threadModel.ts b/jarvis/ui/web/frontend/src/components/agentic/threads/threadModel.tsindex 435a6d7b15..693e7c6e59 100644--- a/jarvis/ui/web/frontend/src/components/agentic/threads/threadModel.ts+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/threadModel.ts@@ -114,3 +114,36 @@ export function folderLabel(path: string): string {const parts = path.split(/[\\/]/).filter(Boolean);return parts[parts.length - 1] ?? path;}++/** The agent, model, effort and access the person picked last — what every new thread starts on. */+export interface ThreadSeat {+ provider: string;+ model: string;+ effort: string;+ permissionMode: string;+}++const SEAT_KEY = "jarvis.ide.threadSeat.v1";++/** Remember an explicit pick. Opening an old thread never calls this, so it never moves the seat. */+export function rememberSeat(seat: ThreadSeat): void {+ if (!seat.provider) return;+ try {+ localStorage.setItem(SEAT_KEY, JSON.stringify({+ provider: seat.provider, model: seat.model, effort: seat.effort, permissionMode: seat.permissionMode,+ }));+ } catch { /* storage blocked: new threads start on the provider's defaults */ }+}++export function rememberedSeat(): ThreadSeat | null {+ try {+ const raw: unknown = JSON.parse(localStorage.getItem(SEAT_KEY) ?? "null");+ if (!raw || typeof raw !== "object") return null;+ const row = raw as Record<string, unknown>;+ if (typeof row.provider !== "string" || !row.provider) return null;+ const text = (value: unknown) => (typeof value === "string" ? value : "");+ return { provider: row.provider, model: text(row.model), effort: text(row.effort), permissionMode: text(row.permissionMode) };+ } catch {+ return null;+ }+}diff --git a/jarvis/ui/web/frontend/src/lib/gitApi.ts b/jarvis/ui/web/frontend/src/lib/gitApi.tsindex c0902df891..35b3634824 100644--- a/jarvis/ui/web/frontend/src/lib/gitApi.ts+++ b/jarvis/ui/web/frontend/src/lib/gitApi.ts@@ -132,47 +132,6 @@ export async function inspectGit(folder: string, signal?: AbortSignal): Promise<return (await res.json()) as GitRepoInfo;}-/** A changed path under a folder, relative to it (`GET /changes`). */-export interface FolderChange {- path: string;- status: "modified" | "added" | "deleted" | "untracked" | "conflicted";- added: number | null;- removed: number | null;- is_directory: boolean;-}--export interface FolderChanges {- available: boolean;- branch: string;- files: FolderChange[];- truncated: boolean;- reason: string;-}--export interface FolderDiff {- path: string;- status: string;- binary: boolean;- added: number;- removed: number;- hunks: { header: string; lines: { kind: "add" | "del" | "ctx"; text: string; old_no: number | null; new_no: number | null }[] }[];- truncated: boolean;-}--/** What changed under a folder that no workspace has open — a thread's checkout. */-export async function fetchFolderChanges(folder: string, signal?: AbortSignal): Promise<FolderChanges> {- const res = await fetch(`${BASE}/changes?folder=${encodeURIComponent(folder)}`, { signal });- if (!res.ok) throw await failure(res);- return (await res.json()) as FolderChanges;-}--/** How one file under `folder` differs from the last commit. */-export async function fetchFolderDiff(folder: string, path: string, signal?: AbortSignal): Promise<FolderDiff> {- const res = await fetch(`${BASE}/diff?folder=${encodeURIComponent(folder)}&path=${encodeURIComponent(path)}`, { signal });- if (!res.ok) throw await failure(res);- return (await res.json()) as FolderDiff;-}-export function prepareGit(folder: string, plan: GitPlan): Promise<GitPrepared> {return post<GitPrepared>("/prepare", { folder, mode: plan.mode, branch: plan.branch, base: plan.base });}