A desktop coding agent with free access to frontier models.
TypeScript
feat: tasks board and home screen
Samrat Talukdar69e783a5d82b
diff --git a/apps/app/src/app/lib/omnirush-server.ts b/apps/app/src/app/lib/omnirush-server.tsindex 2128ea4c..5cc5886e 100644--- a/apps/app/src/app/lib/omnirush-server.ts+++ b/apps/app/src/app/lib/omnirush-server.ts@@ -260,6 +260,36 @@ export type OmniRushWorkspaceList = {activeId?: string | null;};+/** One parallel task (apps/server routes/workspace-tasks.ts TaskView). */+export type OmniRushWorkspaceTask = {+ id: string;+ title: string;+ prompt: string;+ state: "created" | "running" | "done" | "failed" | "stopped" | "applied" | "merged" | "missing";+ label: string;+ branch: string;+ baseBranch: string | null;+ name: string;+ path: string;+ workspaceId: string | null;+ sessionId: string | null;+ createdAt: string;+ startedAt: string | null;+ finishedAt: string | null;+ age: string;+ files: number | null;+ finished: boolean;+ result: { mode: "apply" | "merge"; files: number; at: string } | null;+};++export type OmniRushWorkspaceTaskList = {+ git: boolean;+ repo: string | null;+ branch: string | null;+ hasCommit: boolean;+ tasks: OmniRushWorkspaceTask[];+};+export type OmniRushSessionMessage = {info: Message;parts: Part[];@@ -1873,6 +1903,26 @@ export function createOmniRushServerClient(options: { baseUrl: string; token?: stimeoutMs: timeouts.binary,}),listWorkspaces: () => requestJson<OmniRushWorkspaceList>(baseUrl, "/workspaces", { token, hostToken, timeoutMs: timeouts.listWorkspaces }),+ listWorkspaceTasks: (workspaceId: string) =>+ requestJson<OmniRushWorkspaceTaskList>(baseUrl, `/workspaces/${encodeURIComponent(workspaceId)}/tasks`, { token, hostToken, timeoutMs: timeouts.status }),+ createWorkspaceTask: (workspaceId: string, payload: { prompt: string; title?: string; parentSessionId?: string | null }) =>+ requestJson<{ task: OmniRushWorkspaceTask; workspace: WorkspaceInfo }>(baseUrl, `/workspaces/${encodeURIComponent(workspaceId)}/tasks`, {+ token, hostToken, method: "POST", body: payload, timeoutMs: timeouts.activateWorkspace * 3,+ }),+ showWorkspaceTask: (workspaceId: string, taskId: string) =>+ requestJson<{ task: OmniRushWorkspaceTask; stat: string; reply: string }>(baseUrl, `/workspaces/${encodeURIComponent(workspaceId)}/tasks/${encodeURIComponent(taskId)}`, { token, hostToken, timeoutMs: timeouts.config }),+ bringBackWorkspaceTask: (workspaceId: string, taskId: string, mode: "apply" | "merge") =>+ requestJson<{ mode: "apply" | "merge"; files: Array<{ status: string; file: string }>; task: OmniRushWorkspaceTask }>(baseUrl, `/workspaces/${encodeURIComponent(workspaceId)}/tasks/${encodeURIComponent(taskId)}/${mode}`, {+ token, hostToken, method: "POST", timeoutMs: timeouts.binary,+ }),+ stopWorkspaceTask: (workspaceId: string, taskId: string) =>+ requestJson<{ stopped: boolean; task: OmniRushWorkspaceTask }>(baseUrl, `/workspaces/${encodeURIComponent(workspaceId)}/tasks/${encodeURIComponent(taskId)}/stop`, {+ token, hostToken, method: "POST", timeoutMs: timeouts.config,+ }),+ removeWorkspaceTask: (workspaceId: string, taskId: string) =>+ requestJson<{ ok: boolean; removed: string }>(baseUrl, `/workspaces/${encodeURIComponent(workspaceId)}/tasks/${encodeURIComponent(taskId)}`, {+ token, hostToken, method: "DELETE", timeoutMs: timeouts.deleteWorkspace,+ }),createLocalWorkspace: (payload: { folderPath: string; name: string; preset: string }) =>requestJson<WorkspaceList>(baseUrl, "/workspaces/local", {token,diff --git a/apps/app/src/react-app/domains/session/chat/session-empty-hero.tsx b/apps/app/src/react-app/domains/session/chat/session-empty-hero.tsxindex 7b9487e7..9c926fb4 100644--- a/apps/app/src/react-app/domains/session/chat/session-empty-hero.tsx+++ b/apps/app/src/react-app/domains/session/chat/session-empty-hero.tsx@@ -7,6 +7,7 @@ import { CODING_STARTER_CARDS, resolveOrganizationPromptCardContent } from "@/coimport { useCheckDesktopRestriction, useOrgRestrictions } from "@/react-app/domains/cloud/desktop-config-provider";import { BuildathonPromoCard } from "@/react-app/domains/buildathon/buildathon-promo";import { PlacementHomeCard } from "@/react-app/domains/placements/placements";+import { HomeRecent, type HomeViewContext } from "@/react-app/domains/session/home/home-recent";import {NewTaskComposer,type NewTaskComposerContext,@@ -79,6 +80,8 @@ export type SessionEmptyHeroProps = {onOpenProviderAuth?: () => void;/** Workspace-scoped wiring for the full composer (skills, agents, models). */composer?: NewTaskComposerContext | null;+ /** Recent projects and chats, and the search of past chats (all local). */+ home?: HomeViewContext | null;};/**@@ -153,7 +156,9 @@ export function SessionEmptyHero(props: SessionEmptyHeroProps) {</button>) : null}- <div className="grid grid-cols-2 gap-1.5">+ {props.home?.sessions.length ? <HomeRecent context={props.home} /> : null}++ {props.home?.sessions.length ? null : <div className="grid grid-cols-2 gap-1.5">{suggestions.map((suggestion) => (<buttonkey={suggestion.title}@@ -169,7 +174,7 @@ export function SessionEmptyHero(props: SessionEmptyHeroProps) {</span></button>))}- </div>+ </div>}<BuildathonPromoCard />diff --git a/apps/app/src/react-app/domains/session/chat/session-page.tsx b/apps/app/src/react-app/domains/session/chat/session-page.tsxindex f4c682cd..77e9c81a 100644--- a/apps/app/src/react-app/domains/session/chat/session-page.tsx+++ b/apps/app/src/react-app/domains/session/chat/session-page.tsx@@ -66,6 +66,7 @@ import {ResizablePanelGroup,} from "@/components/ui/resizable";import { ShareWorkspaceModal } from "../../workspace/share-workspace-modal";+import type { HomeViewContext } from "@/react-app/domains/session/home/home-recent";import { SessionEmptyHero } from "./session-empty-hero";import type { NewTaskComposerContext, NewTaskComposerHandoff } from "./new-task-composer";import type { SessionCloudMcpMaintenanceState } from "../../connections/use-session-mcp-maintenance";@@ -190,6 +191,9 @@ export type SessionPageSidebarProps = {onOpenAutomations?: () => void;dashboardActive?: boolean;onOpenDashboard?: () => void;+ tasksActive?: boolean;+ tasksRunningCount?: number;+ onOpenTasks?: () => void;/** Opens the cross-session message search dialog (Cmd/Ctrl+Shift+F). */onOpenSessionSearch?: () => void;onReorderWorkspaces?: (workspaceIds: string[]) => void;@@ -282,6 +286,8 @@ export type SessionPageProps = {chatFirstBusy?: boolean;/** Workspace-scoped wiring for the empty-state hero's full composer. */newTaskComposer?: NewTaskComposerContext | null;+ /** The home screen's recent projects and chats and local chat search (no session open). */+ home?: HomeViewContext | null;onRenameSession?: (sessionId: string, title: string) => Promise<void> | void;onDeleteSession?: (sessionId: string) => Promise<void> | void;onArchiveSession?: (sessionId: string, archived: boolean) => Promise<void> | void;@@ -1539,6 +1545,9 @@ export function SessionPage(props: SessionPageProps) {onOpenAutomations={props.sidebar.onOpenAutomations}dashboardActive={props.sidebar.dashboardActive}onOpenDashboard={props.sidebar.onOpenDashboard}+ tasksActive={props.sidebar.tasksActive}+ tasksRunningCount={props.sidebar.tasksRunningCount}+ onOpenTasks={props.sidebar.onOpenTasks}conversationHistory={{canGoBack: canGoBackInConversationHistory,canGoForward: canGoForwardInConversationHistory,@@ -2107,6 +2116,7 @@ export function SessionPage(props: SessionPageProps) {}onOpenProviderAuth={props.onOpenProviderAuth}composer={props.newTaskComposer}+ home={props.home}/></div>)}diff --git a/apps/app/src/react-app/domains/session/home/home-recent.tsx b/apps/app/src/react-app/domains/session/home/home-recent.tsxnew file mode 100644index 00000000..a53f3ba0--- /dev/null+++ b/apps/app/src/react-app/domains/session/home/home-recent.tsx@@ -0,0 +1,165 @@+/** @jsxImportSource react */+import { useEffect, useMemo, useState } from "react";+import { FolderGit2, Loader2, MessageSquare, Search } from "lucide-react";++import { formatRelativeTime } from "@/app/utils";+import { Input } from "@/components/ui/input";+import {+ createSessionSearcher,+ searchableSessionKey,+ type SearchableSession,+ type SessionMessageFetcher,+ type SessionSearchSnippet,+} from "@/react-app/domains/session/search/session-search";+import { homeChatTitle, recentChats, recentProjects, titleMatches, type HomeWorkspace } from "./home-view-model";++const MIN_QUERY_LENGTH = 2;+const DEBOUNCE_MS = 200;+const RESULT_LIMIT = 8;++/** What the home screen needs; every read is of chats already on this computer. */+export type HomeViewContext = {+ sessions: SearchableSession[];+ workspaces: HomeWorkspace[];+ fetchMessages: SessionMessageFetcher | null;+ onOpenSession: (workspaceId: string, sessionId: string) => void;+};++type SearchResult = { session: SearchableSession; snippet?: SessionSearchSnippet };++function useLocalChatSearch(context: HomeViewContext, query: string) {+ const searcher = useMemo(() => (context.fetchMessages ? createSessionSearcher(context.fetchMessages) : null), [context.fetchMessages]);+ const [debounced, setDebounced] = useState("");+ const [results, setResults] = useState<SearchResult[]>([]);+ const [searching, setSearching] = useState(false);++ useEffect(() => {+ const timer = window.setTimeout(() => setDebounced(query.trim()), DEBOUNCE_MS);+ return () => window.clearTimeout(timer);+ }, [query]);++ useEffect(() => {+ if (debounced.length < MIN_QUERY_LENGTH) {+ setResults([]);+ setSearching(false);+ return;+ }+ const found = new Map<string, SearchResult>();+ for (const session of titleMatches(context.sessions, debounced)) found.set(searchableSessionKey(session), { session });+ setResults([...found.values()].slice(0, RESULT_LIMIT));+ if (!searcher) return;+ setSearching(true);+ const run = searcher.search({+ query: debounced,+ sessions: context.sessions,+ onMatch: (match) => {+ const key = searchableSessionKey(match.session);+ if (found.has(key) || found.size >= RESULT_LIMIT) return;+ found.set(key, { session: match.session, snippet: match.snippet });+ setResults([...found.values()]);+ },+ onProgress: (progress) => setSearching(!progress.done),+ });+ return () => run.cancel();+ }, [context.sessions, debounced, searcher]);++ return { results, searching, active: debounced.length >= MIN_QUERY_LENGTH };+}++export function HomeRecent({ context }: { context: HomeViewContext }) {+ const [query, setQuery] = useState("");+ const search = useLocalChatSearch(context, query);+ const projects = useMemo(() => recentProjects(context.sessions, context.workspaces), [context.sessions, context.workspaces]);+ const chats = useMemo(() => recentChats(context.sessions), [context.sessions]);+ if (!context.sessions.length) return null;++ return (+ <div className="space-y-4" data-testid="home-recent">+ <div className="relative">+ <Search className="pointer-events-none absolute top-1/2 left-3 size-3.5 -translate-y-1/2 text-muted-foreground" aria-hidden="true" />+ <Input+ value={query}+ onChange={(event) => setQuery(event.target.value)}+ placeholder="Search your past chats"+ aria-label="Search your past chats"+ className="h-9 ps-8 text-[13px]"+ data-testid="home-search"+ />+ {search.searching ? <Loader2 className="absolute top-1/2 right-3 size-3.5 -translate-y-1/2 animate-spin text-muted-foreground" aria-label="Searching" /> : null}+ </div>++ {search.active ? (+ <section aria-label="Search results" className="space-y-1">+ {search.results.length ? search.results.map((result) => (+ <ChatRow key={searchableSessionKey(result.session)} session={result.session} snippet={result.snippet} onOpen={context.onOpenSession} />+ )) : (+ <p className="px-1 py-2 text-[12px] text-muted-foreground">{search.searching ? "Searching your chats…" : "No chat matches."}</p>+ )}+ </section>+ ) : (+ <>+ {projects.length ? (+ <section aria-label="Recent projects" className="space-y-1.5">+ <h3 className="px-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase">Recent projects</h3>+ <div className="grid grid-cols-2 gap-1.5 sm:grid-cols-3">+ {projects.map((project) => (+ <button+ key={project.workspaceId}+ type="button"+ className="flex min-w-0 flex-col items-start gap-0.5 rounded-lg border border-border/80 bg-background px-3 py-2 text-left transition-colors hover:bg-accent"+ onClick={() => context.onOpenSession(project.workspaceId, project.lastSessionId)}+ title={`Open the latest chat in ${project.name}`}+ data-testid="home-project"+ >+ <span className="flex w-full min-w-0 items-center gap-1.5 text-[12px] font-medium text-foreground">+ <FolderGit2 className="size-3.5 shrink-0 text-muted-foreground" aria-hidden="true" />+ <span className="truncate">{project.name}</span>+ </span>+ <span className="text-[11px] text-muted-foreground">+ {project.chats} chat{project.chats === 1 ? "" : "s"} · {formatRelativeTime(project.updatedAt)}+ </span>+ </button>+ ))}+ </div>+ </section>+ ) : null}+ <section aria-label="Recent chats" className="space-y-1">+ <h3 className="px-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase">Recent chats</h3>+ {chats.map((session) => (+ <ChatRow key={searchableSessionKey(session)} session={session} onOpen={context.onOpenSession} />+ ))}+ </section>+ </>+ )}+ </div>+ );+}++function ChatRow(props: { session: SearchableSession; snippet?: SessionSearchSnippet; onOpen: (workspaceId: string, sessionId: string) => void }) {+ const { session, snippet } = props;+ return (+ <button+ type="button"+ className="flex w-full min-w-0 items-start gap-2 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-accent"+ onClick={() => props.onOpen(session.workspaceId, session.sessionId)}+ data-testid="home-chat"+ >+ <MessageSquare className="mt-0.5 size-3.5 shrink-0 text-muted-foreground" aria-hidden="true" />+ <span className="min-w-0 flex-1">+ <span className="flex min-w-0 items-baseline gap-2">+ <span className="truncate text-[12px] font-medium text-foreground">{homeChatTitle(session.title)}</span>+ <span className="ml-auto shrink-0 text-[11px] text-muted-foreground">{formatRelativeTime(session.updatedAt)}</span>+ </span>+ <span className="block truncate text-[11px] text-muted-foreground">+ {snippet ? (+ <>+ {snippet.before}+ <mark className="rounded-sm bg-amber-3 px-0.5 text-foreground">{snippet.match}</mark>+ {snippet.after}+ </>+ ) : session.workspaceTitle}+ </span>+ </span>+ </button>+ );+}diff --git a/apps/app/src/react-app/domains/session/home/home-view-model.ts b/apps/app/src/react-app/domains/session/home/home-view-model.tsnew file mode 100644index 00000000..23334fb7--- /dev/null+++ b/apps/app/src/react-app/domains/session/home/home-view-model.ts@@ -0,0 +1,62 @@+import type { SearchableSession } from "@/react-app/domains/session/search/session-search";++/** Same limits and titles as the shared home view (apps/server/src/workspace/home-view.mjs). */+export const HOME_RECENT_CHATS = 8;+export const HOME_RECENT_PROJECTS = 6;++export type HomeWorkspace = {+ id: string;+ name: string;+ /** A parallel task's own workspace: listed on its repository's task board, not here. */+ task: boolean;+};++export type HomeProject = {+ workspaceId: string;+ name: string;+ updatedAt: number;+ chats: number;+ lastSessionId: string;+};++/** A chat's title for lists (the engine's default "New session - <date>" reads "Untitled chat"). */+export function homeChatTitle(title: string | null | undefined): string {+ const text = String(title ?? "").replace(/\s+/g, " ").trim();+ if (!text || /^(new session|child session)\s*-\s*\d{4}-/i.test(text)) return "Untitled chat";+ return text.length > 72 ? `${text.slice(0, 69).trimEnd()}…` : text;+}++/** The newest chats across every workspace on this computer. */+export function recentChats(sessions: SearchableSession[], limit = HOME_RECENT_CHATS): SearchableSession[] {+ return [...sessions].sort((a, b) => b.updatedAt - a.updatedAt).slice(0, limit);+}++/**+ * The projects with the newest chats, each with its latest chat (one click+ * opens it). Task workspaces are left out: their repository's board lists them.+ */+export function recentProjects(sessions: SearchableSession[], workspaces: HomeWorkspace[], limit = HOME_RECENT_PROJECTS): HomeProject[] {+ const byId = new Map(workspaces.map((workspace) => [workspace.id, workspace]));+ const projects = new Map<string, HomeProject>();+ for (const session of recentChats(sessions, Number.POSITIVE_INFINITY)) {+ const workspace = byId.get(session.workspaceId);+ if (!workspace || workspace.task) continue;+ const known = projects.get(session.workspaceId);+ if (known) known.chats += 1;+ else projects.set(session.workspaceId, {+ workspaceId: session.workspaceId,+ name: workspace.name || session.workspaceTitle,+ updatedAt: session.updatedAt,+ chats: 1,+ lastSessionId: session.sessionId,+ });+ }+ return [...projects.values()].slice(0, limit);+}++/** Chats whose title contains the query (the message text is searched separately, on this computer). */+export function titleMatches(sessions: SearchableSession[], query: string): SearchableSession[] {+ const needle = query.trim().toLowerCase();+ if (!needle) return [];+ return recentChats(sessions, Number.POSITIVE_INFINITY).filter((session) => session.title.toLowerCase().includes(needle));+}diff --git a/apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx b/apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsxindex 43a87f7b..41f56719 100644--- a/apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx+++ b/apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx@@ -14,6 +14,7 @@ import {Copy,FolderPlus,Gift,+ Layers,LayoutGrid,MoreHorizontal,Pencil,@@ -955,6 +956,10 @@ export type AppSidebarProps = {onOpenAutomations?: () => void;dashboardActive?: boolean;onOpenDashboard?: () => void;+ /** The parallel-task board of the selected repository, with how many of its tasks run. */+ tasksActive?: boolean;+ tasksRunningCount?: number;+ onOpenTasks?: () => void;/** Opens the cross-session message search dialog (Cmd/Ctrl+Shift+F). */onOpenSessionSearch?: () => void;auditClient?: OmniRushServerClient | null;@@ -1453,6 +1458,24 @@ export function AppSidebar(props: AppSidebarProps) {onSelect={props.onOpenDashboard}/>) : null}+ {props.onOpenTasks ? (+ <SidebarDestination+ active={props.tasksActive === true}+ icon={Layers}+ label="Parallel tasks"+ labelContent={(+ <span className="flex min-w-0 flex-1 items-center gap-2" data-testid="sidebar-tasks">+ <span className="truncate">Parallel tasks</span>+ {props.tasksRunningCount ? (+ <span className="ml-auto rounded bg-muted px-1 text-[10px] text-muted-foreground" aria-label={`${props.tasksRunningCount} running`} data-testid="sidebar-tasks-running">+ {props.tasksRunningCount}+ </span>+ ) : null}+ </span>+ )}+ onSelect={props.onOpenTasks}+ />+ ) : null}{props.onOpenAutomations ? (<SidebarDestinationactive={props.automationsActive === true}diff --git a/apps/app/src/react-app/domains/workspace/tasks/tasks-board-page.tsx b/apps/app/src/react-app/domains/workspace/tasks/tasks-board-page.tsxnew file mode 100644index 00000000..dad49646--- /dev/null+++ b/apps/app/src/react-app/domains/workspace/tasks/tasks-board-page.tsx@@ -0,0 +1,396 @@+/** @jsxImportSource react */+import { useEffect, useState } from "react";+import { useSearchParams } from "react-router";+import { useQueryClient } from "@tanstack/react-query";+import {+ AlertCircle,+ FileDiff,+ GitBranch,+ GitMerge,+ Layers,+ MessageSquare,+ Plus,+ Square,+ Trash2,+ Undo2,+} from "lucide-react";++import type { OmniRushWorkspaceTask } from "@/app/lib/omnirush-server";+import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";+import { Badge } from "@/components/ui/badge";+import { Button } from "@/components/ui/button";+import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";+import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty";+import { Skeleton } from "@/components/ui/skeleton";+import { toast } from "@/components/ui/sonner";+import { Textarea } from "@/components/ui/textarea";+import { ConfirmModal } from "@/react-app/design-system/modals/confirm-modal";+import { cn } from "@/lib/utils";+import { isTaskActive, useWorkspaceTasks, workspaceTasksQueryKey, type WorkspaceTasksClient } from "./workspace-tasks-query";++export type TasksBoardPageProps = {+ client: WorkspaceTasksClient | null;+ /** The workspace the board belongs to (a task's own workspace shows its repository's board). */+ workspaceId: string;+ workspaceName: string;+ /** Creates the task and sends its prompt in its own chat, like the composer. */+ onStartTask: (prompt: string) => Promise<void>;+ onOpenChat: (workspaceId: string, sessionId: string | null) => void;+ /** The workspace list changed (a task's workspace was added or removed). */+ onWorkspacesChanged: () => void;+};++type PendingAction = { kind: "apply" | "merge" | "remove"; task: OmniRushWorkspaceTask };+type Changes = { task: OmniRushWorkspaceTask; stat: string; reply: string };++const STATE_STYLE: Record<OmniRushWorkspaceTask["state"], { dot: string; text: string }> = {+ created: { dot: "bg-blue-9 animate-pulse", text: "Starting" },+ running: { dot: "bg-blue-9 animate-pulse", text: "Running" },+ done: { dot: "bg-green-9", text: "Done" },+ failed: { dot: "bg-red-9", text: "Failed" },+ stopped: { dot: "bg-muted-foreground", text: "Stopped" },+ applied: { dot: "bg-green-9", text: "Applied here" },+ merged: { dot: "bg-violet-9", text: "Merged" },+ missing: { dot: "bg-amber-9", text: "Folder missing" },+};++function errorMessage(error: unknown): string {+ return error instanceof Error && error.message ? error.message : String(error);+}++function errorCode(error: unknown): string {+ if (typeof error !== "object" || error === null || !("code" in error)) return "";+ return typeof error.code === "string" ? error.code : "";+}++function plural(count: number, word: string) {+ return `${count} ${word}${count === 1 ? "" : "s"}`;+}++export function TasksBoardPage(props: TasksBoardPageProps) {+ const queryClient = useQueryClient();+ const tasksQuery = useWorkspaceTasks(props.client, props.workspaceId);+ const [newOpen, setNewOpen] = useState(false);+ const [prompt, setPrompt] = useState("");+ const [starting, setStarting] = useState(false);+ const [pending, setPending] = useState<PendingAction | null>(null);+ const [busyTaskId, setBusyTaskId] = useState<string | null>(null);+ const [conflict, setConflict] = useState<{ title: string; message: string } | null>(null);+ const [changes, setChanges] = useState<Changes | null>(null);++ // The command palette's "New parallel task…" opens the board with ?new=1.+ const [searchParams, setSearchParams] = useSearchParams();+ useEffect(() => {+ if (searchParams.get("new") !== "1") return;+ setNewOpen(true);+ const next = new URLSearchParams(searchParams);+ next.delete("new");+ setSearchParams(next, { replace: true });+ }, [searchParams, setSearchParams]);++ const refresh = () => queryClient.invalidateQueries({ queryKey: workspaceTasksQueryKey(props.workspaceId) });++ const start = async () => {+ const text = prompt.trim();+ if (!text || starting) return;+ setStarting(true);+ try {+ await props.onStartTask(text);+ setPrompt("");+ setNewOpen(false);+ toast.success("Task started in its own copy of the repository");+ } catch (error) {+ toast.error(errorMessage(error));+ } finally {+ setStarting(false);+ void refresh();+ }+ };++ const act = async (task: OmniRushWorkspaceTask, kind: "apply" | "merge" | "remove" | "stop") => {+ const client = props.client;+ if (!client) return;+ setBusyTaskId(task.id);+ try {+ if (kind === "stop") {+ await client.stopWorkspaceTask(props.workspaceId, task.id);+ toast.success("Task stopped");+ } else if (kind === "remove") {+ await client.removeWorkspaceTask(props.workspaceId, task.id);+ props.onWorkspacesChanged();+ toast.success("Task removed");+ } else {+ const done = await client.bringBackWorkspaceTask(props.workspaceId, task.id, kind);+ toast.success(kind === "apply"+ ? `Applied ${plural(done.files.length, "file")} to ${tasksQuery.data?.branch ?? "this checkout"} (not committed)`+ : `Merged ${task.branch} (${plural(done.files.length, "file")})`);+ }+ } catch (error) {+ const code = errorCode(error);+ if (code === "task_conflict" || code === "task_no_changes" || code === "task_commit_failed") {+ setConflict({+ title: code === "task_no_changes" ? "Nothing to bring back" : kind === "merge" ? "The merge did not go through" : "The changes do not apply",+ message: `${errorMessage(error)} Your checkout was left exactly as it was.`,+ });+ } else {+ toast.error(errorMessage(error));+ }+ } finally {+ setBusyTaskId(null);+ void refresh();+ }+ };++ const viewChanges = async (task: OmniRushWorkspaceTask) => {+ if (!props.client) return;+ try {+ const shown = await props.client.showWorkspaceTask(props.workspaceId, task.id);+ setChanges({ task: shown.task, stat: shown.stat, reply: shown.reply });+ } catch (error) {+ toast.error(errorMessage(error));+ }+ };++ const list = tasksQuery.data;+ const tasks = list?.tasks ?? [];+ const runningCount = tasks.filter(isTaskActive).length;+ const canStart = Boolean(list?.git && list.hasCommit);++ return (+ <div className="mx-auto w-full max-w-5xl space-y-5 p-6" data-testid="tasks-board">+ <div className="flex flex-wrap items-start justify-between gap-4">+ <div className="min-w-0">+ <h2 className="text-xl font-semibold">Parallel tasks</h2>+ <p className="mt-1 text-sm text-muted-foreground">+ Each task works in its own copy of {list?.repo ?? props.workspaceName} (a git worktree on its own branch), so several can run at once+ without touching your files. Bring a result back when it is done.+ </p>+ </div>+ <Button onClick={() => setNewOpen(true)} disabled={!canStart} data-testid="tasks-new">+ <Plus /> New parallel task+ </Button>+ </div>++ {tasksQuery.isLoading ? (+ <div className="grid gap-3 sm:grid-cols-2" role="status" aria-label="Loading tasks">+ <Skeleton className="h-36 rounded-2xl" />+ <Skeleton className="h-36 rounded-2xl" />+ </div>+ ) : tasksQuery.error ? (+ <Alert variant="destructive">+ <AlertCircle />+ <AlertTitle>Tasks unavailable</AlertTitle>+ <AlertDescription>{errorMessage(tasksQuery.error)}</AlertDescription>+ </Alert>+ ) : !list?.git || !list.hasCommit ? (+ <Empty className="rounded-2xl border border-dashed">+ <EmptyHeader>+ <EmptyMedia variant="icon"><GitBranch /></EmptyMedia>+ <EmptyTitle>{!list?.git ? "Parallel tasks need a git repository" : "Commit once to start tasks"}</EmptyTitle>+ <EmptyDescription>+ {!list?.git+ ? "This folder is not in a git repository. Tasks run in separate copies of a repository, so open a project that uses git (or run git init and make a first commit)."+ : "The repository has no commit yet. Each task starts from your latest commit, so make one first."}+ </EmptyDescription>+ </EmptyHeader>+ </Empty>+ ) : tasks.length === 0 ? (+ <Empty className="rounded-2xl border border-dashed">+ <EmptyHeader>+ <EmptyMedia variant="icon"><Layers /></EmptyMedia>+ <EmptyTitle>No tasks yet</EmptyTitle>+ <EmptyDescription>+ Start a task to let the agent work on something in the background while you keep working here.+ </EmptyDescription>+ </EmptyHeader>+ <EmptyContent>+ <Button variant="outline" onClick={() => setNewOpen(true)}><Plus /> New parallel task</Button>+ </EmptyContent>+ </Empty>+ ) : (+ <>+ <p className="text-xs text-muted-foreground" aria-live="polite">+ {runningCount ? `${plural(runningCount, "task")} running` : "No task is running"}+ {list.branch ? ` · results come back into ${list.branch}` : ""}+ </p>+ <div className="grid gap-3 sm:grid-cols-2">+ {tasks.map((task) => (+ <TaskCard+ key={task.id}+ task={task}+ busy={busyTaskId === task.id}+ onOpenChat={() => task.workspaceId && props.onOpenChat(task.workspaceId, task.sessionId)}+ onViewChanges={() => void viewChanges(task)}+ onApply={() => setPending({ kind: "apply", task })}+ onMerge={() => setPending({ kind: "merge", task })}+ onStop={() => void act(task, "stop")}+ onRemove={() => setPending({ kind: "remove", task })}+ />+ ))}+ </div>+ </>+ )}++ <Dialog open={newOpen} onOpenChange={(open) => { if (!starting) setNewOpen(open); }}>+ <DialogContent className="w-full max-w-lg sm:max-w-lg">+ <DialogHeader>+ <DialogTitle>New parallel task</DialogTitle>+ <DialogDescription>+ Runs in a new copy of {list?.repo ?? props.workspaceName} on its own branch, starting from your latest commit+ {list?.branch ? ` on ${list.branch}` : ""}. Uncommitted changes here are not part of it.+ </DialogDescription>+ </DialogHeader>+ <Textarea+ autoFocus+ value={prompt}+ placeholder="What should the agent do? For example: add input validation to the signup form"+ className="min-h-28"+ data-testid="tasks-new-prompt"+ onChange={(event) => setPrompt(event.target.value)}+ onKeyDown={(event) => {+ if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {+ event.preventDefault();+ void start();+ }+ }}+ />+ <DialogFooter>+ <Button variant="outline" onClick={() => setNewOpen(false)} disabled={starting}>Cancel</Button>+ <Button onClick={() => void start()} disabled={!prompt.trim() || starting} data-testid="tasks-new-start">+ {starting ? "Starting…" : "Start task"}+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>++ <ConfirmModal+ open={pending !== null}+ variant={pending?.kind === "remove" ? "danger" : "warning"}+ title={pending?.kind === "apply" ? "Apply the changes here?" : pending?.kind === "merge" ? "Merge the task's branch?" : "Remove this task?"}+ message={pending ? confirmMessage(pending, list?.branch ?? null) : ""}+ confirmLabel={pending?.kind === "apply" ? "Apply here" : pending?.kind === "merge" ? "Merge" : isTaskActive(pending?.task ?? { state: "done" }) ? "Stop and remove" : "Remove"}+ cancelLabel="Cancel"+ onCancel={() => setPending(null)}+ onConfirm={() => {+ const next = pending;+ setPending(null);+ if (next) void act(next.task, next.kind);+ }}+ />++ <Dialog open={conflict !== null} onOpenChange={(open) => { if (!open) setConflict(null); }}>+ <DialogContent className="w-full max-w-md sm:max-w-md">+ <DialogHeader>+ <DialogTitle>{conflict?.title}</DialogTitle>+ <DialogDescription>{conflict?.message}</DialogDescription>+ </DialogHeader>+ <DialogFooter showCloseButton />+ </DialogContent>+ </Dialog>++ <Dialog open={changes !== null} onOpenChange={(open) => { if (!open) setChanges(null); }}>+ <DialogContent className="w-full max-w-2xl sm:max-w-2xl">+ <DialogHeader>+ <DialogTitle>{changes?.task.title}</DialogTitle>+ <DialogDescription>{changes ? `${changes.task.branch} · ${STATE_STYLE[changes.task.state].text}` : ""}</DialogDescription>+ </DialogHeader>+ <div className="space-y-3">+ <div>+ <div className="mb-1 text-xs font-medium text-muted-foreground">Files changed</div>+ <pre className="max-h-56 overflow-auto rounded-lg border bg-muted/40 p-3 font-mono text-xs leading-5 whitespace-pre" data-testid="tasks-changes-stat">+ {changes?.stat || (changes && isTaskActive(changes.task) ? "Shown when the task finishes." : "No changes.")}+ </pre>+ </div>+ {changes?.reply ? (+ <div>+ <div className="mb-1 text-xs font-medium text-muted-foreground">Last reply</div>+ <p className="max-h-48 overflow-auto rounded-lg border p-3 text-sm whitespace-pre-wrap">{changes.reply}</p>+ </div>+ ) : null}+ </div>+ <DialogFooter showCloseButton />+ </DialogContent>+ </Dialog>+ </div>+ );+}++function confirmMessage(pending: PendingAction, branch: string | null): string {+ const into = branch ? ` (${branch})` : "";+ if (pending.kind === "apply") {+ return `The task's changes are written into your checkout${into} as uncommitted edits, for you to review and commit. If they clash with your own edits nothing is changed.`;+ }+ if (pending.kind === "merge") {+ return `The task's changes are committed on ${pending.task.branch}, which is merged into your current branch${into}. If the merge conflicts it is undone and nothing changes.`;+ }+ return `Its folder and branch ${pending.task.branch} are deleted, with any changes that were not brought back. Its chat stays in your history.`;+}++type TaskCardProps = {+ task: OmniRushWorkspaceTask;+ busy: boolean;+ onOpenChat: () => void;+ onViewChanges: () => void;+ onApply: () => void;+ onMerge: () => void;+ onStop: () => void;+ onRemove: () => void;+};++function TaskCard({ task, busy, ...actions }: TaskCardProps) {+ const style = STATE_STYLE[task.state];+ const active = isTaskActive(task);+ const canBringBack = task.finished && (task.files ?? 0) > 0;+ return (+ <div+ className={cn("flex flex-col gap-3 rounded-2xl border border-dls-border bg-dls-card p-4 shadow-[var(--dls-card-shadow)]", busy && "opacity-70")}+ data-testid="task-card"+ data-task-state={task.state}+ >+ <div className="flex items-start justify-between gap-3">+ <div className="min-w-0">+ <div className="truncate text-sm font-medium text-dls-text" title={task.prompt}>{task.title}</div>+ <div className="mt-1 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground">+ <GitBranch className="size-3 shrink-0" />+ <span className="truncate font-mono" title={task.path}>{task.branch}</span>+ </div>+ </div>+ <Badge variant="outline" className="shrink-0 gap-1.5" data-testid="task-state">+ <span className={cn("size-1.5 rounded-full", style.dot)} aria-hidden="true" />+ {style.text}+ </Badge>+ </div>+ <div className="flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground">+ <span data-testid="task-files">{task.files === null ? "Files: unknown" : plural(task.files, "file") + " changed"}</span>+ {task.age ? <span>Started {task.age}</span> : null}+ {task.result ? <span>{task.result.mode === "apply" ? "Applied" : "Merged"} {plural(task.result.files, "file")}</span> : null}+ </div>+ <div className="mt-auto flex flex-wrap gap-1.5">+ <Button size="sm" variant="outline" onClick={actions.onOpenChat} disabled={!task.workspaceId || !task.sessionId}>+ <MessageSquare /> Open chat+ </Button>+ <Button size="sm" variant="outline" onClick={actions.onViewChanges} disabled={busy}>+ <FileDiff /> View changes+ </Button>+ {active ? (+ <Button size="sm" variant="outline" onClick={actions.onStop} disabled={busy}>+ <Square /> Stop+ </Button>+ ) : null}+ {task.finished ? (+ <>+ <Button size="sm" variant="outline" onClick={actions.onApply} disabled={busy || !canBringBack} data-testid="task-apply">+ <Undo2 /> Apply here+ </Button>+ <Button size="sm" variant="outline" onClick={actions.onMerge} disabled={busy || !canBringBack} data-testid="task-merge">+ <GitMerge /> Merge+ </Button>+ </>+ ) : null}+ <Button size="sm" variant="ghost" className="ml-auto text-muted-foreground" onClick={actions.onRemove} disabled={busy} aria-label="Remove task" data-testid="task-remove">+ <Trash2 /> Remove+ </Button>+ </div>+ </div>+ );+}diff --git a/apps/app/src/react-app/domains/workspace/tasks/workspace-tasks-query.ts b/apps/app/src/react-app/domains/workspace/tasks/workspace-tasks-query.tsnew file mode 100644index 00000000..58bbe8a8--- /dev/null+++ b/apps/app/src/react-app/domains/workspace/tasks/workspace-tasks-query.ts@@ -0,0 +1,41 @@+import { useQuery } from "@tanstack/react-query";++import type { OmniRushServerClient, OmniRushWorkspaceTask, OmniRushWorkspaceTaskList } from "@/app/lib/omnirush-server";++/** The server calls the board makes (a slice of the local server client). */+export type WorkspaceTasksClient = Pick<+ OmniRushServerClient,+ "listWorkspaceTasks" | "showWorkspaceTask" | "bringBackWorkspaceTask" | "stopWorkspaceTask" | "removeWorkspaceTask"+>;++/** How often the board (and the sidebar's count) refreshes while a task runs. */+export const TASKS_POLL_MS = 3_000;++export function workspaceTasksQueryKey(workspaceId: string) {+ return ["workspace-tasks", workspaceId] as const;+}++export function isTaskActive(task: Pick<OmniRushWorkspaceTask, "state">): boolean {+ return task.state === "running" || task.state === "created";+}++export function runningTaskCount(list: OmniRushWorkspaceTaskList | undefined): number {+ return list?.tasks.filter(isTaskActive).length ?? 0;+}++/**+ * The parallel tasks of the repository a workspace belongs to. Polls only while+ * one of them runs; otherwise it refreshes when the board opens or acts.+ */+export function useWorkspaceTasks(client: WorkspaceTasksClient | null, workspaceId: string, enabled = true) {+ return useQuery({+ queryKey: workspaceTasksQueryKey(workspaceId),+ queryFn: () => {+ if (!client) throw new Error("The local server is not connected.");+ return client.listWorkspaceTasks(workspaceId);+ },+ enabled: enabled && Boolean(client && workspaceId),+ refetchInterval: (query) => (runningTaskCount(query.state.data) > 0 ? TASKS_POLL_MS : false),+ staleTime: 1_000,+ });+}diff --git a/apps/app/src/react-app/shell/app-root.tsx b/apps/app/src/react-app/shell/app-root.tsxindex 6253bc75..cdb29664 100644--- a/apps/app/src/react-app/shell/app-root.tsx+++ b/apps/app/src/react-app/shell/app-root.tsx@@ -463,6 +463,14 @@ export function AppRoot() {</DevProfiler>}/>+ <Route+ path="/workspace/:workspaceId/tasks"+ element={+ <DevProfiler id="TasksRoute">+ <SessionRoute />+ </DevProfiler>+ }+ /><Routepath="/automations"element={diff --git a/apps/app/src/react-app/shell/session-route.tsx b/apps/app/src/react-app/shell/session-route.tsxindex f766957f..40c7914f 100644--- a/apps/app/src/react-app/shell/session-route.tsx+++ b/apps/app/src/react-app/shell/session-route.tsx@@ -19,6 +19,7 @@ import { trackSessionActive, trackTaskStarted } from "@/app/lib/den-telemetry";import { buildDiagnosticsBundleJson } from "@/app/lib/diagnostics-bundle";import { downloadTextAsFile } from "@/app/lib/download";import { canCreateWorkspaces } from "@/app/lib/workspace-creation-policy";+import { useQueryClient } from "@tanstack/react-query";import { createClient, isPromptAdmissionUnknown, unwrap } from "@/app/lib/opencode";import { createClientV2, isOpencodeV2BaseUrl, V2_SESSION_ARCHIVE_UNAVAILABLE } from "@/app/lib/opencode-v2-adapter";import { abortSessionSafe, forkSession, listCommands, revertSession, setSessionArchived, shellInSession, unrevertSession } from "@/app/lib/opencode-session";@@ -263,7 +264,11 @@ import {workspaceExtensionsRoute,workspaceSessionRoute,workspaceSettingsRoute,+ workspaceTasksRoute,} from "./workspace-routes";+import { TasksBoardPage } from "@/react-app/domains/workspace/tasks/tasks-board-page";+import { runningTaskCount, useWorkspaceTasks, workspaceTasksQueryKey } from "@/react-app/domains/workspace/tasks/workspace-tasks-query";+import type { HomeViewContext } from "@/react-app/domains/session/home/home-recent";import { WorkspaceProvider } from "./workspace-provider";import type { OpenTarget } from "@/react-app/domains/session/artifacts/open-target";import { SettingsSurface } from "./settings-route";@@ -379,9 +384,11 @@ function focusedWorkbenchPaneOwner() {export function SessionRoute() {const navigate = useNavigate();const location = useLocation();+ const queryClient = useQueryClient();const appsRouteActive = /^(?:\/apps|\/dashboard\/apps)(?:\/|$)/.test(location.pathname);const automationsRouteRequested = /^\/automations(?:\/|$)/.test(location.pathname);const dashboardRouteRequested = /^\/dashboard(?:\/|$)/.test(location.pathname);+ const tasksRouteActive = /^\/workspace\/[^/]+\/tasks(?:\/|$)/.test(location.pathname);const {enabled: mcpAppsDashboardEnabled,loading: dashboardAvailabilityLoading,@@ -518,7 +525,7 @@ export function SessionRoute() {runRemoteWorkspaceConnectionCheck,} = useWorkspaceRouteState({developerMode,- workspaceRoute: appsRouteActive ? "apps" : automationsRouteActive ? "automations" : dashboardWorkspaceRoute ? "dashboard" : "session",+ workspaceRoute: appsRouteActive ? "apps" : automationsRouteActive ? "automations" : dashboardWorkspaceRoute ? "dashboard" : tasksRouteActive ? "tasks" : "session",onServerSettingsChanged: () => setOmniRushServerSettingsVersion((value) => value + 1),onHostInfo: setOmniRushServerHostInfoState,});@@ -769,6 +776,17 @@ export function SessionRoute() {[errorsByWorkspaceId, retryingWorkspaceIds, sessionListErrorsByWorkspaceId, sessionsByWorkspaceId, workspaces],);useSessionGroupSync({ workspaces, endpointForWorkspace });+ // A parallel task's own workspace is listed on its repository's board, not in the sidebar (unless it is open).+ const sidebarWorkspaceSessionGroups = useMemo(+ () => workspaceSessionGroups.filter((group) => !group.workspace.task || group.workspace.id === selectedWorkspaceId),+ [selectedWorkspaceId, workspaceSessionGroups],+ );+ const tasksBoardWorkspaceId = selectedWorkspace?.task && workspaces.some((workspace) => workspace.id === selectedWorkspace.task?.parentWorkspaceId)+ ? selectedWorkspace.task.parentWorkspaceId+ : selectedWorkspaceId;+ const tasksAvailable = Boolean(selectedWorkspace && selectedWorkspace.workspaceType !== "remote" && tasksBoardWorkspaceId);+ const workspaceTasksQuery = useWorkspaceTasks(client, tasksBoardWorkspaceId, tasksAvailable);+ const tasksRunningCount = runningTaskCount(workspaceTasksQuery.data);const selectedWorkspaceGroupState = sessionManagementStore((state) => (selectedWorkspaceId ? state.groupsByWorkspace[selectedWorkspaceId] : undefined));@@ -2840,6 +2858,41 @@ export function SessionRoute() {};}, [client, endpointForWorkspace, workspaces]);+ // The home screen (no chat open): recent projects and chats across workspaces, searched on this computer.+ const homeView = useMemo<HomeViewContext>(() => ({+ sessions: paletteSessionOptions,+ workspaces: workspaces.map((workspace) => ({ id: workspace.id, name: workspace.displayNameResolved, task: Boolean(workspace.task) })),+ fetchMessages: sessionSearchFetcher,+ onOpenSession: (workspaceId, sessionId) => {+ setLegacySelectedWorkspaceId(workspaceId);+ writeActiveWorkspaceId(workspaceId);+ writeLastSessionFor(workspaceId, sessionId);+ navigateToWorkspaceSession(workspaceId, sessionId);+ },+ }), [navigateToWorkspaceSession, paletteSessionOptions, sessionSearchFetcher, setLegacySelectedWorkspaceId, workspaces]);++ const tasksPaletteItems = useMemo<PaletteItem[]>(() => tasksAvailable ? [{+ id: "tasks.open",+ title: "Open parallel tasks",+ detail: tasksRunningCount ? `${tasksRunningCount} running` : "Tasks that run in their own copy of this repository",+ meta: "Tasks",+ searchText: "parallel tasks agents worktree board background",+ action: () => {+ setCommandPaletteOpen(false);+ navigate(workspaceTasksRoute(tasksBoardWorkspaceId));+ },+ }, {+ id: "tasks.new",+ title: "New parallel task…",+ detail: "Run a prompt in a separate copy of this repository",+ meta: "Tasks",+ searchText: "new parallel task agent worktree branch background",+ action: () => {+ setCommandPaletteOpen(false);+ navigate(`${workspaceTasksRoute(tasksBoardWorkspaceId)}?new=1`);+ },+ }] : [], [navigate, tasksAvailable, tasksBoardWorkspaceId, tasksRunningCount]);+const sessionSearchPaletteItem = useMemo<PaletteItem>(() => ({id: "session-search.open",title: "Search session messages",@@ -3210,6 +3263,41 @@ export function SessionRoute() {}}, [baseUrl, client, local, navigateToWorkspaceSession, refreshRouteState, rememberPendingCreatedSession, token]);+ /**+ * A parallel task: the server makes its worktree and workspace, then its+ * chat is created there and the prompt sent the way the composer sends one+ * (same model, agent and context), so it is captured like any chat.+ */+ const startParallelTask = useCallback(async (workspaceId: string, prompt: string) => {+ if (!client || !baseUrl || !token) throw new Error("omnirush.ai server is unavailable.");+ const created = await client.createWorkspaceTask(workspaceId, { prompt, parentSessionId: selectedSessionId });+ const taskWorkspace = created.workspace;+ await refreshRouteState();+ void queryClient.invalidateQueries({ queryKey: workspaceTasksQueryKey(workspaceId) });+ const opencodeUrl = `${(buildOmniRushWorkspaceBaseUrl(baseUrl, taskWorkspace.id) ?? baseUrl).replace(/\/+$/, "")}/opencode`;+ const createEngineClient = isOpencodeV2BaseUrl(opencodeUrl) ? createClientV2 : createClient;+ const engine = createEngineClient(opencodeUrl, taskWorkspace.path || undefined, { token, mode: "omnirush" });+ const session = unwrap(await engine.session.create({ directory: taskWorkspace.path || undefined }));+ const system = await buildOmniRushSessionSystemContext(client, {+ workspaceId: taskWorkspace.id,+ cacheKey: session.id,+ runtimeKey: environmentRuntimeKey,+ });+ const model = local.prefs.defaultModel;+ const result = await engine.session.promptAsync({+ sessionID: session.id,+ parts: [{ type: "text", text: prompt }],+ model: model ?? undefined,+ agent: selectedAgent ?? undefined,+ ...(modelVariantValue ? { variant: modelVariantValue } : {}),+ system,+ });+ if (result.error) throw new Error(serializeSDKError(result.error));+ if (model) useSessionModelStore.getState().setModel(session.id, model, modelVariantValue ?? null);+ writeLastSessionFor(taskWorkspace.id, session.id);+ void queryClient.invalidateQueries({ queryKey: workspaceTasksQueryKey(workspaceId) });+ }, [baseUrl, client, environmentRuntimeKey, local.prefs.defaultModel, modelVariantValue, queryClient, refreshRouteState, selectedAgent, selectedSessionId, token]);+// The new task's folder, picked above its composer: switch to another// workspace, or open a folder as a new one (the sidebar's "+" in one step).const openProjectFolder = useCallback(async () => {@@ -3445,6 +3533,7 @@ export function SessionRoute() {onChatFirstTask={handleChatFirstTask}chatFirstBusy={createWorkspaceBusy}newTaskComposer={newTaskComposerWithProjects}+ home={homeView}providerAuthModal={sessionProviderAuthSnapshot.providerAuthModalOpen ? {open: true,loading: false,@@ -3487,8 +3576,22 @@ export function SessionRoute() {}}/>}- primaryTitle={appsRouteActive ? "Dashboard" : automationsRouteActive ? "Automations" : dashboardRouteActive ? "Dashboard" : undefined}- primarySlot={appsRouteActive ? (+ primaryTitle={appsRouteActive ? "Dashboard" : automationsRouteActive ? "Automations" : dashboardRouteActive ? "Dashboard" : tasksRouteActive ? "Parallel tasks" : undefined}+ primarySlot={tasksRouteActive && tasksAvailable ? (+ <TasksBoardPage+ client={client}+ workspaceId={tasksBoardWorkspaceId}+ workspaceName={workspaces.find((workspace) => workspace.id === tasksBoardWorkspaceId)?.displayNameResolved ?? ""}+ onStartTask={(prompt) => startParallelTask(tasksBoardWorkspaceId, prompt)}+ onOpenChat={(workspaceId, sessionId) => {+ setLegacySelectedWorkspaceId(workspaceId);+ writeActiveWorkspaceId(workspaceId);+ if (sessionId) writeLastSessionFor(workspaceId, sessionId);+ navigateToWorkspaceSession(workspaceId, sessionId);+ }}+ onWorkspacesChanged={() => void refreshRouteState()}+ />+ ) : appsRouteActive ? (<AppsPage onNewApp={startAppConversation} />) : automationsRouteActive ? (<AutomationsPage providerCatalog={providerCatalog} workspaceId={selectedWorkspaceId} />@@ -3510,7 +3613,7 @@ export function SessionRoute() {sessionTabNavRef.current = { ...sessionTabNavRef.current, options: tabs };}}sidebar={{- workspaceSessionGroups,+ workspaceSessionGroups: sidebarWorkspaceSessionGroups,selectedWorkspaceId,selectedSessionId,developerMode: false,@@ -3528,6 +3631,9 @@ export function SessionRoute() {}: undefined,dashboardActive: dashboardRouteActive || appsRouteActive,+ tasksActive: tasksRouteActive,+ tasksRunningCount,+ onOpenTasks: tasksAvailable ? () => navigate(workspaceTasksRoute(tasksBoardWorkspaceId)) : undefined,onOpenDashboard: mcpAppsDashboardEnabled? () => {navigate(dashboardRoute());@@ -3896,7 +4002,7 @@ export function SessionRoute() {currentSessionForGroupMove={currentSessionForGroupMove}currentSessionGroupId={currentSessionGroupId}onMoveCurrentSessionToGroup={handleMoveCurrentSessionToGroup}- extraItems={[...currentSessionActionPaletteItems, ...(sessionFindPaletteItem ? [sessionFindPaletteItem] : []), sessionSearchPaletteItem, ...terminalPaletteItems, ...(checkDesktopRestriction({ restriction: "allowControlSettings" }) ? [] : [developerModePaletteItem]), ...(copySessionIdPaletteItem ? [copySessionIdPaletteItem] : []), diagnosticsCopyPaletteItem, diagnosticsExportPaletteItem, nextSessionTabPaletteItem, prevSessionTabPaletteItem, reloadConfigPaletteItem]}+ extraItems={[...currentSessionActionPaletteItems, ...(sessionFindPaletteItem ? [sessionFindPaletteItem] : []), sessionSearchPaletteItem, ...tasksPaletteItems, ...terminalPaletteItems, ...(checkDesktopRestriction({ restriction: "allowControlSettings" }) ? [] : [developerModePaletteItem]), ...(copySessionIdPaletteItem ? [copySessionIdPaletteItem] : []), diagnosticsCopyPaletteItem, diagnosticsExportPaletteItem, nextSessionTabPaletteItem, prevSessionTabPaletteItem, reloadConfigPaletteItem]}listAgents={listAgents}selectedAgent={selectedAgent}onSelectAgent={setSelectedAgent}diff --git a/apps/app/src/react-app/shell/use-workspace-route-state.ts b/apps/app/src/react-app/shell/use-workspace-route-state.tsindex 511c9e8f..6e77b4d4 100644--- a/apps/app/src/react-app/shell/use-workspace-route-state.ts+++ b/apps/app/src/react-app/shell/use-workspace-route-state.ts@@ -94,13 +94,14 @@ import {sessionIdForLegacyWorkspaceInference,automationsRoute,dashboardRoute,+ workspaceTasksRoute,workspaceExtensionsRoute,workspaceSessionRoute,} from "./workspace-routes";export type UseWorkspaceRouteStateInput = {developerMode: boolean;- workspaceRoute?: "session" | "automations" | "dashboard" | "apps";+ workspaceRoute?: "session" | "automations" | "dashboard" | "apps" | "tasks";/** Invoked when the omnirush-server settings-changed event fires (the route bumps its settings version). */onServerSettingsChanged: () => void;/** Receives the local omnirush-server host info discovered during refresh. */@@ -186,6 +187,10 @@ export function useWorkspaceRouteState(input: UseWorkspaceRouteStateInput) {navigate(dashboardRoute(), options);return;}+ if (workspaceRoute === "tasks") {+ navigate(workspaceTasksRoute(workspaceId), options);+ return;+ }navigateToWorkspaceSession(workspaceId, sessionId, options);}, [extensionsRouteActive, extensionsRoutePath, location.pathname, navigate, navigateToWorkspaceSession, workspaceRoute]);diff --git a/apps/app/src/react-app/shell/workspace-routes.ts b/apps/app/src/react-app/shell/workspace-routes.tsindex ad6a717c..6d720026 100644--- a/apps/app/src/react-app/shell/workspace-routes.ts+++ b/apps/app/src/react-app/shell/workspace-routes.ts@@ -47,6 +47,11 @@ export function settingsNavigationFromPathname(pathname: string, tab: SettingsTa};}+/** The parallel-task board of a workspace's repository. */+export function workspaceTasksRoute(workspaceId: string) {+ return `/workspace/${encodeURIComponent(workspaceId.trim())}/tasks`;+}+export function automationsRoute() {return "/automations";}diff --git a/apps/app/tests/home-recent.test.tsx b/apps/app/tests/home-recent.test.tsxnew file mode 100644index 00000000..e46fefbe--- /dev/null+++ b/apps/app/tests/home-recent.test.tsx@@ -0,0 +1,110 @@+/** @jsxImportSource react */+import { afterAll, describe, expect, test } from "bun:test";+import { GlobalRegistrator } from "@happy-dom/global-registrator";++import type { OmniRushSessionMessage } from "../src/app/lib/omnirush-server";+import type { SearchableSession } from "../src/react-app/domains/session/search/session-search";++const registered = typeof globalThis.window === "undefined";+if (registered) GlobalRegistrator.register({ url: "http://localhost/" });+Object.defineProperty(globalThis, "IS_REACT_ACT_ENVIRONMENT", { configurable: true, value: true });+afterAll(async () => {+ if (registered) await GlobalRegistrator.unregister();+});++const { act } = await import("react");+const { createRoot } = await import("react-dom/client");+const { HomeRecent } = await import("../src/react-app/domains/session/home/home-recent");+const { homeChatTitle, recentChats, recentProjects, titleMatches } = await import("../src/react-app/domains/session/home/home-view-model");++const now = Date.now();+const sessions: SearchableSession[] = [+ { workspaceId: "ws_app", sessionId: "ses_a1", title: "Fix the login redirect", workspaceTitle: "app", updatedAt: now - 60_000 },+ { workspaceId: "ws_site", sessionId: "ses_s1", title: "New session - 2026-10-19T10:00:00.000Z", workspaceTitle: "site", updatedAt: now - 120_000 },+ { workspaceId: "ws_app", sessionId: "ses_a0", title: "Older chat", workspaceTitle: "app", updatedAt: now - 3_600_000 },+ { workspaceId: "ws_task", sessionId: "ses_t1", title: "Add a greeting", workspaceTitle: "app › add-a-greeting-ab12", updatedAt: now - 30_000 },+];+const workspaces = [+ { id: "ws_app", name: "app", task: false },+ { id: "ws_site", name: "site", task: false },+ { id: "ws_task", name: "app › add-a-greeting-ab12", task: true },+];++function message(id: string, role: "user" | "assistant", text: string): OmniRushSessionMessage {+ return {+ info: { id, role, sessionID: "x" },+ parts: [{ id: `${id}_p`, type: "text", text, sessionID: "x", messageID: id }],+ } as unknown as OmniRushSessionMessage;+}++describe("home view model", () => {+ test("recent chats are newest first across workspaces; projects open their latest chat and leave task copies out", () => {+ expect(recentChats(sessions).map((s) => s.sessionId)).toEqual(["ses_t1", "ses_a1", "ses_s1", "ses_a0"]);+ expect(recentProjects(sessions, workspaces)).toEqual([+ { workspaceId: "ws_app", name: "app", updatedAt: now - 60_000, chats: 2, lastSessionId: "ses_a1" },+ { workspaceId: "ws_site", name: "site", updatedAt: now - 120_000, chats: 1, lastSessionId: "ses_s1" },+ ]);+ });++ test("titles read like the CLI's: the engine's default title is an untitled chat", () => {+ expect(homeChatTitle("New session - 2026-10-19T10:00:00.000Z")).toBe("Untitled chat");+ expect(homeChatTitle(" Fix it ")).toBe("Fix it");+ expect(titleMatches(sessions, "LOGIN").map((s) => s.sessionId)).toEqual(["ses_a1"]);+ });+});++describe("home screen", () => {+ test("shows recent projects and chats, opens one in a click, and searches past chats on this computer", async () => {+ const opened: string[] = [];+ const fetched: string[] = [];+ const fetchMessages = async (_workspaceId: string, sessionId: string) => {+ fetched.push(sessionId);+ return sessionId === "ses_a0" ? [message("m1", "user", "please add a rate limiter to the upload handler")] : [];+ };+ document.body.innerHTML = "<div id=root></div>";+ const root = createRoot(document.getElementById("root")!);+ await act(async () => {+ root.render(<HomeRecent context={{ sessions, workspaces, fetchMessages, onOpenSession: (w, s) => opened.push(`${w}/${s}`) }} />);+ });+ const projects = [...document.querySelectorAll<HTMLButtonElement>("[data-testid=home-project]")];+ expect(projects.map((p) => p.textContent)).toEqual([expect.stringContaining("app"), expect.stringContaining("site")]);+ expect(projects[0]!.textContent).toContain("2 chats");+ const chats = [...document.querySelectorAll<HTMLButtonElement>("[data-testid=home-chat]")];+ expect(chats.map((c) => c.textContent)).toEqual([+ expect.stringContaining("Add a greeting"),+ expect.stringContaining("Fix the login redirect"),+ expect.stringContaining("Untitled chat"),+ expect.stringContaining("Older chat"),+ ]);+ await act(async () => { projects[0]!.click(); });+ await act(async () => { chats[2]!.click(); });+ expect(opened).toEqual(["ws_app/ses_a1", "ws_site/ses_s1"]);+ expect(fetched).toEqual([]);++ const input = document.querySelector<HTMLInputElement>("[data-testid=home-search]")!;+ await act(async () => {+ Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")!.set!.call(input, "rate limiter");+ input.dispatchEvent(new Event("input", { bubbles: true }));+ });+ await act(async () => { await new Promise((resolve) => setTimeout(resolve, 400)); });+ const results = [...document.querySelectorAll<HTMLButtonElement>("[data-testid=home-chat]")];+ expect(results.length).toBe(1);+ expect(results[0]!.textContent).toContain("Older chat");+ expect(results[0]!.querySelector("mark")?.textContent).toBe("rate limiter");+ expect(document.querySelector("[data-testid=home-project]")).toBeNull();+ expect(fetched.sort()).toEqual(["ses_a0", "ses_a1", "ses_s1", "ses_t1"]);+ await act(async () => { results[0]!.click(); });+ expect(opened.at(-1)).toBe("ws_app/ses_a0");+ await act(async () => root.unmount());+ });++ test("nothing is shown before the first chat", async () => {+ document.body.innerHTML = "<div id=root></div>";+ const root = createRoot(document.getElementById("root")!);+ await act(async () => {+ root.render(<HomeRecent context={{ sessions: [], workspaces, fetchMessages: null, onOpenSession: () => undefined }} />);+ });+ expect(document.querySelector("[data-testid=home-recent]")).toBeNull();+ await act(async () => root.unmount());+ });+});diff --git a/apps/app/tests/workspace-tasks-board.test.tsx b/apps/app/tests/workspace-tasks-board.test.tsxnew file mode 100644index 00000000..2f942abf--- /dev/null+++ b/apps/app/tests/workspace-tasks-board.test.tsx@@ -0,0 +1,183 @@+/** @jsxImportSource react */+import { afterAll, describe, expect, test } from "bun:test";+import { GlobalRegistrator } from "@happy-dom/global-registrator";++import type { OmniRushWorkspaceTask, OmniRushWorkspaceTaskList } from "../src/app/lib/omnirush-server";+import type { WorkspaceTasksClient } from "../src/react-app/domains/workspace/tasks/workspace-tasks-query";++// The DOM exists before React and the dialogs load (their portals look for it once).+const registered = typeof globalThis.window === "undefined";+if (registered) GlobalRegistrator.register({ url: "http://localhost/" });+Object.defineProperty(globalThis, "IS_REACT_ACT_ENVIRONMENT", { configurable: true, value: true });+afterAll(async () => {+ if (registered) await GlobalRegistrator.unregister();+});++const { QueryClient, QueryClientProvider } = await import("@tanstack/react-query");+const { act } = await import("react");+const { createRoot } = await import("react-dom/client");+const { MemoryRouter } = await import("react-router");+const { OmniRushServerError } = await import("../src/app/lib/omnirush-server");+const { TasksBoardPage } = await import("../src/react-app/domains/workspace/tasks/tasks-board-page");+const { runningTaskCount } = await import("../src/react-app/domains/workspace/tasks/workspace-tasks-query");+type Root = ReturnType<typeof createRoot>;++function task(overrides: Partial<OmniRushWorkspaceTask>): OmniRushWorkspaceTask {+ return {+ id: "t1", title: "Add a greeting", prompt: "Add a greeting", state: "running", label: "running",+ branch: "omnirush/add-a-greeting-ab12", baseBranch: "main", name: "app › add-a-greeting-ab12",+ path: "/code/app-tasks/add-a-greeting-ab12", workspaceId: "ws_task1", sessionId: "ses_1",+ createdAt: "2026-10-20T00:00:00.000Z", startedAt: "2026-10-20T00:00:00.000Z", finishedAt: null,+ age: "2 min ago", files: 1, finished: false, result: null, ...overrides,+ };+}++function fakeClient(list: OmniRushWorkspaceTaskList) {+ const calls: string[] = [];+ let current = list;+ let applyError: Error | null = null;+ const client: WorkspaceTasksClient = {+ listWorkspaceTasks: async () => current,+ showWorkspaceTask: async (_ws, id) => ({ task: current.tasks.find((entry) => entry.id === id)!, stat: " greeting.txt | 1 +", reply: "Added it." }),+ bringBackWorkspaceTask: async (_ws, id, mode) => {+ calls.push(`${mode}:${id}`);+ if (applyError) throw applyError;+ return { mode, files: [{ status: "A", file: "greeting.txt" }], task: { ...current.tasks.find((entry) => entry.id === id)!, state: mode === "apply" ? "applied" : "merged" } };+ },+ stopWorkspaceTask: async (_ws, id) => { calls.push(`stop:${id}`); return { stopped: true, task: current.tasks[0]! }; },+ removeWorkspaceTask: async (_ws, id) => { calls.push(`remove:${id}`); return { ok: true, removed: id }; },+ };+ return {+ client, calls,+ setList: (next: OmniRushWorkspaceTaskList) => { current = next; },+ failApply: (error: Error) => { applyError = error; },+ };+}++async function settle() {+ await act(async () => { await new Promise((resolve) => setTimeout(resolve, 20)); });+}++async function mount(client: WorkspaceTasksClient, extra: { opened?: string[]; started?: string[] } = {}) {+ document.body.innerHTML = "<div id=root></div>";+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });+ let root: Root | null = null;+ await act(async () => {+ root = createRoot(document.getElementById("root")!);+ root.render(+ <QueryClientProvider client={queryClient}>+ <MemoryRouter>+ <TasksBoardPage+ client={client}+ workspaceId="ws_main"+ workspaceName="app"+ onStartTask={async (prompt) => { extra.started?.push(prompt); }}+ onOpenChat={(workspaceId, sessionId) => extra.opened?.push(`${workspaceId}/${sessionId}`)}+ onWorkspacesChanged={() => undefined}+ />+ </MemoryRouter>+ </QueryClientProvider>,+ );+ });+ await settle();+ return { unmount: () => act(() => root?.unmount()) };+}++function button(label: string, scope: ParentNode = document): HTMLButtonElement {+ const found = [...scope.querySelectorAll("button")].find((element) => element.textContent?.trim() === label);+ if (!found) throw new Error(`no button "${label}" in ${document.body.textContent}`);+ return found;+}++async function click(element: HTMLElement) {+ await act(async () => { element.click(); });+ await settle();+}++describe("parallel tasks board", () => {+ test("a folder outside git explains that tasks need a repository with a commit", async () => {+ const { client } = fakeClient({ git: false, repo: null, branch: null, hasCommit: false, tasks: [] });+ const view = await mount(client);+ expect(document.body.textContent).toContain("Parallel tasks need a git repository");+ expect(document.querySelector<HTMLButtonElement>("[data-testid=tasks-new]")?.disabled).toBe(true);+ await view.unmount();+ });++ test("cards show each task's state, branch, files and age, with the actions that fit", async () => {+ const fake = fakeClient({+ git: true, repo: "app", branch: "main", hasCommit: true,+ tasks: [task({}), task({ id: "t2", title: "Fix the readme", state: "done", finished: true, files: 2, branch: "omnirush/fix-the-readme-cd34", sessionId: "ses_2", workspaceId: "ws_task2" })],+ });+ const opened: string[] = [];+ const view = await mount(fake.client, { opened });+ const cards = [...document.querySelectorAll<HTMLElement>("[data-testid=task-card]")];+ expect(cards.map((card) => card.dataset.taskState)).toEqual(["running", "done"]);+ expect(cards[0]!.textContent).toContain("omnirush/add-a-greeting-ab12");+ expect(cards[0]!.textContent).toContain("Running");+ expect(cards[0]!.textContent).toContain("1 file changed");+ expect(cards[0]!.textContent).toContain("Started 2 min ago");+ expect(cards[0]!.querySelector("[data-testid=task-apply]")).toBeNull();+ expect(button("Stop", cards[0]!)).toBeTruthy();+ expect(cards[1]!.textContent).toContain("2 files changed");+ expect(document.body.textContent).toContain("1 task running");+ await click(button("Open chat", cards[1]!));+ expect(opened).toEqual(["ws_task2/ses_2"]);+ await click(button("Stop", cards[0]!));+ expect(fake.calls).toContain("stop:t1");+ await view.unmount();+ });++ test("apply asks first, then brings the result back; a conflict is shown plainly and nothing else happens", async () => {+ const fake = fakeClient({ git: true, repo: "app", branch: "main", hasCommit: true, tasks: [task({ state: "done", finished: true })] });+ const view = await mount(fake.client);+ await click(document.querySelector<HTMLButtonElement>("[data-testid=task-apply]")!);+ expect(document.body.textContent).toContain("Apply the changes here?");+ expect(fake.calls).toEqual([]);+ await click(button("Apply here", document.querySelector("[role=alertdialog]") ?? document));+ expect(fake.calls).toEqual(["apply:t1"]);++ fake.failApply(new OmniRushServerError(409, "task_conflict", "The changes do not apply cleanly to the main checkout (it changed in the same places). Use merge, or resolve by hand."));+ await click(document.querySelector<HTMLButtonElement>("[data-testid=task-merge]")!);+ await click(button("Merge", document.querySelector("[role=alertdialog]") ?? document));+ expect(fake.calls).toEqual(["apply:t1", "merge:t1"]);+ expect(document.body.textContent).toContain("The merge did not go through");+ expect(document.body.textContent).toContain("Your checkout was left exactly as it was.");+ await view.unmount();+ });++ test("view changes shows the diff stat and the task's last reply; remove asks first", async () => {+ const fake = fakeClient({ git: true, repo: "app", branch: "main", hasCommit: true, tasks: [task({ state: "done", finished: true })] });+ const view = await mount(fake.client);+ await click(button("View changes"));+ expect(document.querySelector("[data-testid=tasks-changes-stat]")?.textContent).toContain("greeting.txt | 1 +");+ expect(document.body.textContent).toContain("Added it.");+ await click(button("Close"));+ await click(document.querySelector<HTMLButtonElement>("[data-testid=task-remove]")!);+ expect(document.body.textContent).toContain("Remove this task?");+ await click(button("Remove", document.querySelector("[role=alertdialog]") ?? document));+ expect(fake.calls).toEqual(["remove:t1"]);+ await view.unmount();+ });++ test("the new task dialog sends the prompt to start the task", async () => {+ const fake = fakeClient({ git: true, repo: "app", branch: "main", hasCommit: true, tasks: [] });+ const started: string[] = [];+ const view = await mount(fake.client, { started });+ expect(document.body.textContent).toContain("No tasks yet");+ await click(document.querySelector<HTMLButtonElement>("[data-testid=tasks-new]")!);+ const textarea = document.querySelector<HTMLTextAreaElement>("[data-testid=tasks-new-prompt]")!;+ await act(async () => {+ const setter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, "value")!.set!;+ setter.call(textarea, "Add a health check route");+ textarea.dispatchEvent(new Event("input", { bubbles: true }));+ });+ await click(document.querySelector<HTMLButtonElement>("[data-testid=tasks-new-start]")!);+ expect(started).toEqual(["Add a health check route"]);+ await view.unmount();+ });++ test("the sidebar count is the number of tasks still working", () => {+ expect(runningTaskCount(undefined)).toBe(0);+ expect(runningTaskCount({ git: true, repo: "app", branch: "main", hasCommit: true, tasks: [task({}), task({ id: "t2", state: "created" }), task({ id: "t3", state: "done" })] })).toBe(2);+ });+});