The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Assist: Scheduled tab, Schedule dialog and Settings connectors
Clauded214e7317f55
diff --git a/src/app/(studio)/assist/scheduled/page.tsx b/src/app/(studio)/assist/scheduled/page.tsxnew file mode 100644index 00000000..46778489--- /dev/null+++ b/src/app/(studio)/assist/scheduled/page.tsx@@ -0,0 +1,8 @@+import type { Metadata } from "next";+import { ScheduledView } from "@/components/assist/scheduled-view";++export const metadata: Metadata = { title: "Scheduled" };++export default function Page() {+ return <ScheduledView />;+}diff --git a/src/components/assist-view.tsx b/src/components/assist-view.tsxindex cee835c2..30439c0d 100644--- a/src/components/assist-view.tsx+++ b/src/components/assist-view.tsx@@ -1,6 +1,6 @@"use client";-import { Bot, Cpu, Loader2, MessageSquarePlus } from "lucide-react";+import { Bot, CalendarClock, Cpu, Loader2, MessageSquarePlus } from "lucide-react";import Link from "next/link";import { useRouter, useSearchParams } from "next/navigation";import { useEffect, useMemo, useRef, useState } from "react";@@ -16,6 +16,7 @@ import { AssistComposer } from "@/components/assist/composer";import { ChatMenu } from "@/components/assist/chat-menu";import { useChatActions, useChats, useProjects, useSkills } from "@/components/assist/hooks";import { ModePicker, useModeChoice } from "@/components/assist/mode-picker";+import { ScheduleDialog } from "@/components/assist/schedule-dialog";import { ProjectDot, RailButton } from "@/components/assist/shell";import { SkillIcon } from "@/components/assist/skill-icon";import { Transcript } from "@/components/assist/transcript";@@ -100,6 +101,7 @@ export function AssistView() {const skills = useSkills();const projects = useProjects();const end = useRef<HTMLDivElement>(null);+ const [scheduling, setScheduling] = useState(false);const go = (next: string | null) => router.replace(next ? `/assist?c=${next}` : "/assist", { scroll: false });const thread = view.data?.thread;@@ -158,6 +160,16 @@ export function AssistView() {</div><div className="flex shrink-0 items-center gap-1">{agentBadge}+ {thread && thread.items.some((i) => i.role === "user") && (+ <Tooltip>+ <TooltipTrigger asChild>+ <Button variant="ghost" size="sm" onClick={() => setScheduling(true)} aria-label="Schedule this request">+ <CalendarClock /> <span className="hidden lg:inline">Schedule</span>+ </Button>+ </TooltipTrigger>+ <TooltipContent>Run this chat's request again on a schedule</TooltipContent>+ </Tooltip>+ )}{id && (<Button variant="ghost" size="sm" onClick={() => go(null)} aria-label="New chat"><MessageSquarePlus /> <span className="hidden sm:inline">New chat</span>@@ -243,6 +255,23 @@ export function AssistView() {</>)}+ {thread && (+ <ScheduleDialog+ open={scheduling}+ onOpenChange={setScheduling}+ seed={(() => {+ // The chat's first request is the job; later messages refine it.+ const first = thread.items.find((i) => i.role === "user");+ return {+ prompt: first?.role === "user" ? `${first.skills?.length ? `${first.skills.map((n) => `/${n}`).join(" ")} ` : ""}${first.text}` : "",+ attachments: first?.role === "user" ? first.attachments : undefined,+ projectId: thread.projectId ?? null,+ engine: thread.engine,+ mode: { mode: thread.mode ?? "smart", agent: thread.agent, model: thread.model, effort: thread.effort },+ };+ })()}+ />+ )}{open && pos >= 0 && (<Viewergeneration={viewable[pos].g}diff --git a/src/components/assist/connectors-settings.tsx b/src/components/assist/connectors-settings.tsxnew file mode 100644index 00000000..8808463b--- /dev/null+++ b/src/components/assist/connectors-settings.tsx@@ -0,0 +1,229 @@+"use client";++import { AlertTriangle, Info, KeyRound, Loader2, Pencil, Plug, Plus, Trash2 } from "lucide-react";+import { useId, useState } from "react";+import { toast } from "sonner";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+} from "@/components/ui/alert-dialog";+import { Button } from "@/components/ui/button";+import { Checkbox } from "@/components/ui/checkbox";+import { Input } from "@/components/ui/input";+import { Label } from "@/components/ui/label";+import { Skeleton } from "@/components/ui/skeleton";+import { Switch } from "@/components/ui/switch";+import { checkConnectorUrl, MAX_CONNECTOR_NAME, MAX_CONNECTORS, type ConnectorView } from "@/lib/assist-connectors";+import { useConnectorActions, useConnectors } from "./hooks";++/**+ * Settings → Assist connectors: remote MCP servers whose tools Claude may use in Assist chats. The+ * browser sends a URL and token once and only ever gets them back masked; nothing here connects to+ * the URL (Claude does, from Anthropic's servers).+ */+export function ConnectorSettings({ claudeReady }: { claudeReady: boolean }) {+ const list = useConnectors();+ const [adding, setAdding] = useState(false);+ const [editing, setEditing] = useState<string | null>(null);+ const items = list.data ?? [];+ const full = items.length >= MAX_CONNECTORS;++ return (+ <div className="space-y-4">+ <div className="flex items-start gap-2.5 rounded-xl bg-muted px-3 py-2.5 text-[13px] text-muted-foreground">+ <Info className="mt-0.5 size-4 shrink-0" />+ <p>+ Connectors work in Claude chats (Smart, or Manual with a Claude model){claudeReady ? "" : " — add an Anthropic API key above first"}. Claude reaches them from Anthropic's servers, so each needs a+ public https address. Chats on Ollama or the offline planner can't use them. Tool calls cost Claude tokens; the chat lists each connector tool Claude used.+ </p>+ </div>+ {list.isLoading ? (+ <Skeleton className="h-16 rounded-xl" />+ ) : items.length ? (+ <ul className="divide-y rounded-xl border sm:w-[40rem] sm:max-w-full">+ {items.map((c) =>+ editing === c.id ? (+ <li key={c.id} className="p-3">+ <ConnectorForm connector={c} onDone={() => setEditing(null)} />+ </li>+ ) : (+ <Row key={c.id} c={c} onEdit={() => setEditing(c.id)} />+ ),+ )}+ </ul>+ ) : (+ !adding && <p className="text-[13px] text-muted-foreground">No connectors yet. Add one with its MCP server URL — the app's docs list it (often ending in /mcp).</p>+ )}+ {adding ? (+ <div className="rounded-xl border p-3 sm:w-[40rem] sm:max-w-full">+ <ConnectorForm onDone={() => setAdding(false)} />+ </div>+ ) : (+ <Button size="sm" variant="secondary" disabled={full} onClick={() => setAdding(true)}>+ <Plus /> {full ? `Up to ${MAX_CONNECTORS} connectors` : "Add a connector"}+ </Button>+ )}+ </div>+ );+}++function Row({ c, onEdit }: { c: ConnectorView; onEdit: () => void }) {+ const actions = useConnectorActions();+ const [deleting, setDeleting] = useState(false);+ return (+ <li className="flex items-start gap-3 px-3 py-2.5">+ <Plug className="mt-1 size-4 shrink-0 text-muted-foreground" aria-hidden />+ <div className="min-w-0 flex-1">+ <p className="truncate text-[13px] font-medium">{c.name}</p>+ <p className="truncate font-mono text-[11px] text-muted-foreground" title={c.url}>+ {c.url}+ </p>+ <p className="text-[11px] text-muted-foreground">+ <KeyRound className="mr-1 inline size-3 align-[-2px]" aria-hidden />+ {c.hasToken ? <span className="font-mono">{c.token}</span> : "No token"} · Claude sees it as <span className="font-mono">{c.slug}</span>+ </p>+ {c.warning && (+ <p className="mt-1 flex items-start gap-1 text-[11px] text-amber-800 dark:text-amber-300">+ <AlertTriangle className="mt-px size-3 shrink-0" aria-hidden /> {c.warning}+ </p>+ )}+ </div>+ <div className="flex shrink-0 items-center gap-0.5">+ <Switch+ checked={c.enabled}+ onCheckedChange={(on) => void actions.update(c.id, { enabled: on }).catch((e) => toast.error((e as Error).message))}+ aria-label={c.enabled ? `Switch off ${c.name}` : `Switch on ${c.name}`}+ />+ <Button size="icon" variant="ghost" className="size-8 text-muted-foreground" aria-label={`Edit ${c.name}`} onClick={onEdit}>+ <Pencil className="size-3.5" />+ </Button>+ <Button size="icon" variant="ghost" className="size-8 text-muted-foreground hover:text-destructive" aria-label={`Delete ${c.name}`} onClick={() => setDeleting(true)}>+ <Trash2 className="size-3.5" />+ </Button>+ </div>+ <AlertDialog open={deleting} onOpenChange={setDeleting}>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Delete {c.name}?</AlertDialogTitle>+ <AlertDialogDescription>Claude stops using its tools, and its token is deleted from this server. Chats that used it keep what it returned.</AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction variant="destructive" onClick={() => void actions.remove(c.id).catch((e) => toast.error((e as Error).message))}>+ Delete+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ </li>+ );+}++/** Add a connector, or edit one: an empty token field keeps the saved token. */+function ConnectorForm({ connector, onDone }: { connector?: ConnectorView; onDone: () => void }) {+ const actions = useConnectorActions();+ const ids = { name: useId(), url: useId(), token: useId(), hint: useId() };+ const [name, setName] = useState(connector?.name ?? "");+ const [url, setUrl] = useState("");+ const [token, setToken] = useState("");+ const [dropToken, setDropToken] = useState(false);+ const [busy, setBusy] = useState(false);+ // The server enforces the http rule (it knows FUOBE_ALLOW_PRIVATE_URLS); here only the shape is checked.+ const check = url.trim() ? checkConnectorUrl(url, true) : null;+ const urlError = check && "error" in check ? check.error : null;+ const canSave = !!name.trim() && (connector ? !urlError : !!url.trim() && !urlError);++ const save = async (e: React.FormEvent) => {+ e.preventDefault();+ if (!canSave) return;+ setBusy(true);+ try {+ if (connector) {+ await actions.update(connector.id, {+ name: name.trim(),+ ...(url.trim() && { url: url.trim() }),+ ...(dropToken ? { token: "" } : token.trim() ? { token: token.trim() } : {}),+ });+ toast.success("Connector saved", { duration: 1500 });+ } else {+ await actions.create({ name: name.trim(), url: url.trim(), ...(token.trim() && { token: token.trim() }) });+ toast.success(`${name.trim()} connected`, { description: "Claude chats can use its tools from the next message.", duration: 2500 });+ }+ onDone();+ } catch (err) {+ toast.error((err as Error).message);+ } finally {+ setBusy(false);+ }+ };++ return (+ <form onSubmit={save} className="space-y-3" aria-label={connector ? `Edit ${connector.name}` : "Add a connector"}>+ <div className="grid grid-cols-[minmax(0,1fr)] gap-3 sm:grid-cols-[minmax(0,0.8fr)_minmax(0,1.2fr)]">+ <div className="space-y-1.5">+ <Label htmlFor={ids.name} className="text-[13px]">+ Name+ </Label>+ <Input id={ids.name} value={name} onChange={(e) => setName(e.target.value)} maxLength={MAX_CONNECTOR_NAME} placeholder="e.g. Notion" autoFocus />+ </div>+ <div className="space-y-1.5">+ <Label htmlFor={ids.url} className="text-[13px]">+ MCP server URL+ </Label>+ <Input+ id={ids.url}+ type="url"+ inputMode="url"+ autoComplete="off"+ spellCheck={false}+ value={url}+ onChange={(e) => setUrl(e.target.value)}+ placeholder={connector ? `Unchanged: ${connector.url}` : "https://mcp.example.com/mcp"}+ aria-invalid={!!urlError}+ aria-describedby={urlError ? ids.hint : undefined}+ />+ {urlError && (+ <p id={ids.hint} className="text-[12px] text-destructive">+ {urlError}+ </p>+ )}+ </div>+ </div>+ <div className="space-y-1.5">+ <Label htmlFor={ids.token} className="text-[13px]">+ Token <span className="font-normal text-muted-foreground">(optional)</span>+ </Label>+ <Input+ id={ids.token}+ type="password"+ autoComplete="off"+ spellCheck={false}+ value={token}+ disabled={dropToken}+ onChange={(e) => setToken(e.target.value)}+ placeholder={connector?.hasToken ? `Saved (${connector.token}) — type a new one to replace it` : "The server's API key or access token"}+ />+ <p className="text-[12px] text-muted-foreground">Sent as an Authorization: Bearer header, by Anthropic, to this server only. Stored on this server like your other keys and never shown again.</p>+ {connector?.hasToken && (+ <label className="inline-flex items-center gap-2 text-[12px]">+ <Checkbox checked={dropToken} onCheckedChange={(v) => setDropToken(v === true)} /> Remove the saved token+ </label>+ )}+ </div>+ <div className="flex flex-wrap gap-2">+ <Button type="submit" size="sm" disabled={busy || !canSave}>+ {busy && <Loader2 className="animate-spin" />} {connector ? "Save" : "Add connector"}+ </Button>+ <Button type="button" size="sm" variant="ghost" onClick={onDone}>+ Cancel+ </Button>+ </div>+ </form>+ );+}diff --git a/src/components/assist/hooks.ts b/src/components/assist/hooks.tsindex c9fc5a1d..d52ab876 100644--- a/src/components/assist/hooks.ts+++ b/src/components/assist/hooks.ts@@ -17,8 +17,13 @@ import type {Skill,SkillSummary,} from "@/lib/assist";+import type { ConnectorView } from "@/lib/assist-connectors";+import type { ScheduleRule, ScheduleView } from "@/lib/assist-schedule";import type { Engine, Generation } from "@/lib/catalog/types";+/** A rule as the dialog sends it: the server sets when "every N hours" starts counting. */+export type ScheduleRuleInput = ScheduleRule extends infer R ? (R extends { kind: "hours" } ? Omit<R, "from"> : R) : never;+/*** React Query hooks for Assist's skills, memory, projects and chat lists (/api/assist/**).* Thread transcripts stay under ["assist", id] (patched by the live generation stream in@@ -310,3 +315,99 @@ export function useProjectActions() {},};}++// ---------------------------------------------------------------------------+// Scheduled tasks++export interface ScheduleForm {+ title: string;+ prompt: string;+ attachments?: string[];+ projectId?: string | null;+ rule: ScheduleRuleInput;+ tz: string;+ approval: "ask" | "auto";+ capUsd?: number | null;+ engine: Engine;+ mode?: AssistModeChoice | null;+ paused?: boolean;+}++/** Tasks, all or one project's; refreshed every 30 s so "next run" and the last result stay current. */+export function useSchedules(projectId?: string) {+ return useHydrationSafe(+ useQuery({+ queryKey: ["assist-schedules", projectId ?? "all"],+ queryFn: async () => (await json<{ items: ScheduleView[] }>(await fetch(`/api/assist/schedules${projectId ? `?project=${projectId}` : ""}`))).items,+ refetchInterval: 30_000,+ }),+ );+}++export function useScheduleActions() {+ const qc = useQueryClient();+ const refresh = () => {+ void qc.invalidateQueries({ queryKey: ["assist-schedules"] });+ void qc.invalidateQueries({ queryKey: ["assist-chats"] });+ };+ return {+ create: async (f: ScheduleForm) => {+ const s = await send<ScheduleView>("/api/assist/schedules", "POST", f);+ refresh();+ return s;+ },+ update: async (id: string, f: Partial<ScheduleForm>) => {+ const s = await send<ScheduleView>(`/api/assist/schedules/${id}`, "PATCH", f);+ refresh();+ return s;+ },+ remove: async (id: string) => {+ await send(`/api/assist/schedules/${id}`, "DELETE");+ refresh();+ },+ runNow: async (id: string) => {+ const r = await fetch(`/api/assist/schedules/${id}/run`, { method: "POST" });+ const body = (await r.json().catch(() => ({}))) as { threadId?: string | null; error?: string };+ if (!r.ok && r.status !== 409) throw new Error(body.error ?? `Request failed (${r.status})`);+ refresh();+ return body.threadId ?? null;+ },+ };+}++// ---------------------------------------------------------------------------+// Custom MCP connectors (Settings → Assist connectors)++export function useConnectors() {+ return useHydrationSafe(+ useQuery({+ queryKey: ["assist-connectors"],+ queryFn: async () => (await json<{ items: ConnectorView[] }>(await fetch("/api/assist/connectors"))).items,+ }),+ );+}++export function useConnectorActions() {+ const qc = useQueryClient();+ const refresh = () => void qc.invalidateQueries({ queryKey: ["assist-connectors"] });+ return {+ create: async (f: { name: string; url: string; token?: string }) => {+ const c = await send<ConnectorView>("/api/assist/connectors", "POST", f);+ refresh();+ return c;+ },+ update: async (id: string, f: { name?: string; url?: string; token?: string; enabled?: boolean }) => {+ // Optimistic for the on / off switch.+ if (f.enabled !== undefined) qc.setQueryData<ConnectorView[]>(["assist-connectors"], (old) => old?.map((c) => (c.id === id ? { ...c, enabled: f.enabled! } : c)));+ try {+ return await send<ConnectorView>(`/api/assist/connectors/${id}`, "PATCH", f);+ } finally {+ refresh();+ }+ },+ remove: async (id: string) => {+ await send(`/api/assist/connectors/${id}`, "DELETE");+ refresh();+ },+ };+}diff --git a/src/components/assist/project-view.tsx b/src/components/assist/project-view.tsxindex 7dd20842..cbac6f64 100644--- a/src/components/assist/project-view.tsx+++ b/src/components/assist/project-view.tsx@@ -54,6 +54,7 @@ import { useChatActions, useChats, useProject, useProjectActions, useProjectAsseimport { MemoryView } from "./memory-view";import { useModeChoice } from "./mode-picker";import { ProjectDialog } from "./project-dialog";+import { ScheduledView } from "./scheduled-view";import { ProjectDot, RailButton } from "./shell";const SOURCE_ICON: Record<SourceKind, typeof FileText> = { link: Link2, file: FileText, image: ImageIcon, video: Video, audio: AudioLines, element: AtSign, text: NotebookPen };@@ -140,7 +141,8 @@ function Project({ p }: { p: AssistProject }) {</div></div><Tabs value={tab} onValueChange={setTab} className="mt-10 gap-4">- <TabsList>+ {/* Five tabs are wider than a phone: the row scrolls by itself, not the page. */}+ <TabsList className="max-w-full justify-start overflow-x-auto scrollbar-none"><TabsTrigger value="chats" className="px-3">Chats <span className="font-mono text-[11px] text-muted-foreground">{chats.data?.threads.length || ""}</span></TabsTrigger>@@ -153,6 +155,9 @@ function Project({ p }: { p: AssistProject }) {<TabsTrigger value="memory" className="px-3">Memory</TabsTrigger>+ <TabsTrigger value="scheduled" className="px-3">+ Scheduled+ </TabsTrigger></TabsList><TabsContent value="chats">{chats.isLoading ? (@@ -182,6 +187,9 @@ function Project({ p }: { p: AssistProject }) {<TabsContent value="memory" className="-mx-3 sm:-mx-6"><MemoryView projectId={p.id} /></TabsContent>+ <TabsContent value="scheduled" className="-mx-3 sm:-mx-6">+ <ScheduledView projectId={p.id} />+ </TabsContent></Tabs></div><ProjectDialog open={settings} onOpenChange={setSettings} project={p} />diff --git a/src/components/assist/schedule-dialog.tsx b/src/components/assist/schedule-dialog.tsxnew file mode 100644index 00000000..73660a1a--- /dev/null+++ b/src/components/assist/schedule-dialog.tsx@@ -0,0 +1,385 @@+"use client";++import { CalendarClock, Loader2, X } from "lucide-react";+import { useId, useMemo, useState } from "react";+import { toast } from "sonner";+import { Button } from "@/components/ui/button";+import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";+import { Input } from "@/components/ui/input";+import { Label } from "@/components/ui/label";+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";+import { Textarea } from "@/components/ui/textarea";+import { EngineSwitch } from "@/components/studio/engine-switch";+import { radioKeys, radioTab } from "@/components/studio/radio-keys";+import { useNow } from "@/components/studio/use-now";+import { useEngine } from "@/lib/api";+import { threadTitle, type AssistModeChoice } from "@/lib/assist";+import {+ DEFAULT_SCHEDULE_CAP_USD,+ formatWhen,+ MAX_SCHEDULE_CAP_USD,+ MAX_SCHEDULE_PROMPT,+ nextRun,+ ruleError,+ SCHEDULE_HOURS,+ untilText,+ WEEK_ORDER,+ WEEKDAYS,+ zoneLabel,+ type ScheduleApproval,+ type ScheduleRule,+ type ScheduleView,+} from "@/lib/assist-schedule";+import type { Engine } from "@/lib/catalog/types";+import { cn } from "@/lib/utils";+import { useChats, useProjects, useScheduleActions, type ScheduleRuleInput } from "./hooks";+import { ModePicker } from "./mode-picker";+import { ProjectDot } from "./project-dot";++/** What a new task starts from: a chat's request, a project. */+export interface ScheduleSeed {+ prompt?: string;+ attachments?: string[];+ projectId?: string | null;+ engine?: Engine;+ mode?: AssistModeChoice | null;+}++const KINDS: { id: ScheduleRule["kind"]; label: string }[] = [+ { id: "daily", label: "Daily" },+ { id: "weekly", label: "Weekly" },+ { id: "hours", label: "Every few hours" },+ { id: "once", label: "Once" },+];++const browserZone = () => {+ try {+ return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";+ } catch {+ return "UTC";+ }+};++const allZones = (): string[] => {+ try {+ return (Intl as unknown as { supportedValuesOf?: (k: string) => string[] }).supportedValuesOf?.("timeZone") ?? [];+ } catch {+ return [];+ }+};++/** "2026-10-28T09:00" for tomorrow at 09:00 on this device's clock (the default for "Once"). */+function tomorrowAt9(now: number): string {+ const d = new Date(now + 86_400_000);+ const p = (n: number) => String(n).padStart(2, "0");+ return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}T09:00`;+}++/** Create or edit a scheduled task: the prompt, when it runs, where, and whether it asks first. */+export function ScheduleDialog({ open, onOpenChange, schedule, seed }: { open: boolean; onOpenChange: (open: boolean) => void; schedule?: ScheduleView; seed?: ScheduleSeed }) {+ return (+ <Dialog open={open} onOpenChange={onOpenChange}>+ <DialogContent className="max-h-[min(92svh,820px)] gap-0 overflow-hidden p-0 sm:max-w-[600px]">{open && <Form schedule={schedule} seed={seed} onDone={() => onOpenChange(false)} />}</DialogContent>+ </Dialog>+ );+}++function Form({ schedule, seed, onDone }: { schedule?: ScheduleView; seed?: ScheduleSeed; onDone: () => void }) {+ const actions = useScheduleActions();+ const projects = useProjects();+ const can = useChats({ project: "none" }).data?.availability;+ const [preferred] = useEngine();+ const now = useNow(30_000);+ const ids = { title: useId(), prompt: useId(), time: useId(), at: useId(), hours: useId(), tz: useId(), cap: useId(), project: useId() };+ const initialPrompt = schedule?.prompt ?? seed?.prompt ?? "";+ const [prompt, setPrompt] = useState(initialPrompt);+ const [title, setTitle] = useState(schedule?.title ?? (initialPrompt ? threadTitle(initialPrompt) : ""));+ const [titleTouched, setTitleTouched] = useState(!!schedule);+ const [attachments, setAttachments] = useState<string[]>(schedule?.attachments ?? seed?.attachments ?? []);+ const [projectId, setProjectId] = useState<string | null>(schedule?.projectId ?? seed?.projectId ?? null);+ const r = schedule?.rule;+ const [kind, setKind] = useState<ScheduleRule["kind"]>(r?.kind ?? "daily");+ const [time, setTime] = useState(r && "time" in r ? r.time : "09:00");+ const [days, setDays] = useState<number[]>(r?.kind === "weekly" ? r.days : [1]);+ const [every, setEvery] = useState(r?.kind === "hours" ? r.every : 6);+ const [at, setAt] = useState(r?.kind === "once" ? r.at : () => tomorrowAt9(Date.now()));+ const [tz, setTz] = useState(schedule?.tz ?? browserZone);+ const [approval, setApproval] = useState<ScheduleApproval>(schedule?.approval ?? "ask");+ const [cap, setCap] = useState(String(schedule?.capUsd ?? DEFAULT_SCHEDULE_CAP_USD));+ const [engine, setEngine] = useState<Engine>(schedule?.engine ?? seed?.engine ?? preferred);+ const [mode, setMode] = useState<AssistModeChoice | null>((schedule?.mode as AssistModeChoice | null) ?? seed?.mode ?? null);+ const [busy, setBusy] = useState(false);+ const zones = useMemo(() => {+ const list = allZones();+ return list.includes(tz) ? list : [tz, ...list];+ }, [tz]);++ const rule: ScheduleRuleInput = kind === "daily" ? { kind, time } : kind === "weekly" ? { kind, days, time } : kind === "hours" ? { kind, every } : { kind, at };+ // An unchanged "every N hours" keeps counting from when it was set up.+ const from = r?.kind === "hours" && r.every === every ? r.from : now;+ const full: ScheduleRule = rule.kind === "hours" ? { ...rule, from } : rule;+ const problem = ruleError(full);+ const next = problem ? null : nextRun(full, tz, now);+ const capUsd = Number(cap);+ const capBad = approval === "auto" && (!cap.trim() || !Number.isFinite(capUsd) || capUsd < 0 || capUsd > MAX_SCHEDULE_CAP_USD);++ const save = async (e: React.FormEvent) => {+ e.preventDefault();+ if (!prompt.trim()) return void toast.error("Write what Assist should do each time");+ if (problem) return void toast.error(problem);+ if (!next) return void toast.error(kind === "once" ? "That time has passed — pick a later one" : "This schedule never runs");+ if (capBad) return void toast.error(`Set a cap between $0 and $${MAX_SCHEDULE_CAP_USD}`);+ setBusy(true);+ try {+ const body = {+ title: title.trim() || threadTitle(prompt),+ prompt: prompt.trim(),+ attachments,+ projectId,+ rule,+ tz,+ approval,+ capUsd: approval === "auto" ? capUsd : null,+ engine,+ mode,+ };+ const s = schedule ? await actions.update(schedule.id, body) : await actions.create(body);+ toast.success(schedule ? "Schedule saved" : "Scheduled", { description: s.nextRunAt ? `Next run ${formatWhen(s.nextRunAt, s.tz)}` : undefined, duration: 2500 });+ onDone();+ } catch (err) {+ toast.error((err as Error).message);+ } finally {+ setBusy(false);+ }+ };++ const toggleDay = (d: number) => setDays((xs) => (xs.includes(d) ? xs.filter((x) => x !== d) : [...xs, d]));++ return (+ <form onSubmit={save} className="flex min-h-0 flex-col">+ <DialogHeader className="border-b px-5 pt-5 pb-4">+ <DialogTitle className="flex items-center gap-2 font-heading text-[24px] font-normal">+ <CalendarClock className="size-5 text-muted-foreground" /> {schedule ? "Edit scheduled task" : "Schedule a task"}+ </DialogTitle>+ <DialogDescription>Each run is a new chat on this server — it runs even when Fuobe isn't open in a browser. What it makes lands in your Library.</DialogDescription>+ </DialogHeader>+ <div className="min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-5">+ <div className="space-y-2">+ <Label htmlFor={ids.prompt}>What should Assist do each time?</Label>+ <Textarea+ id={ids.prompt}+ value={prompt}+ onChange={(e) => {+ setPrompt(e.target.value);+ if (!titleTouched) setTitle(e.target.value.trim() ? threadTitle(e.target.value) : "");+ }}+ maxLength={MAX_SCHEDULE_PROMPT}+ rows={4}+ autoFocus={!schedule && !initialPrompt}+ placeholder="e.g. “Make 3 new ad variations for my sneaker, vertical 9:16, in today's light”"+ className="min-h-24 text-[14px]"+ />+ {attachments.length > 0 && (+ <ul className="flex flex-wrap gap-1.5" aria-label="Files each run uses">+ {attachments.map((a, i) => (+ <li key={a} className="inline-flex h-7 items-center gap-1 rounded-full bg-muted pr-1 pl-2.5 text-[12px]">+ File {i + 1}+ <button type="button" onClick={() => setAttachments((xs) => xs.filter((x) => x !== a))} className="grid size-5 place-items-center rounded-full hover:bg-background" aria-label={`Don't use file ${i + 1}`}>+ <X className="size-3" />+ </button>+ </li>+ ))}+ </ul>+ )}+ </div>++ <div className="grid grid-cols-[minmax(0,1fr)] gap-4 sm:grid-cols-2">+ <div className="space-y-2">+ <Label htmlFor={ids.title}>Name</Label>+ <Input+ id={ids.title}+ value={title}+ onChange={(e) => {+ setTitle(e.target.value);+ setTitleTouched(true);+ }}+ maxLength={80}+ placeholder="Daily ad variations"+ />+ </div>+ <div className="space-y-2">+ <Label htmlFor={ids.project}>Project</Label>+ <Select value={projectId ?? "none"} onValueChange={(v) => setProjectId(v === "none" ? null : v)}>+ <SelectTrigger id={ids.project} className="w-full">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="none">No project</SelectItem>+ {projects.data?.map((p) => (+ <SelectItem key={p.id} value={p.id}>+ <ProjectDot project={p} /> {p.name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>+ </div>++ <fieldset className="space-y-3">+ <legend className="text-sm font-medium">When</legend>+ <div role="radiogroup" aria-label="Repeat" onKeyDown={radioKeys} className="flex flex-wrap gap-1.5">+ {KINDS.map((k) => (+ <button+ key={k.id}+ type="button"+ role="radio"+ aria-checked={kind === k.id}+ tabIndex={radioTab(kind === k.id)}+ onClick={() => setKind(k.id)}+ className={cn(+ "inline-flex h-8 items-center rounded-full px-3 text-[13px] font-medium transition-colors",+ kind === k.id ? "bg-brand-faint text-brand-text hover:bg-brand-faint-hover" : "bg-secondary text-secondary-foreground hover:bg-accent",+ )}+ >+ {k.label}+ </button>+ ))}+ </div>+ {kind === "weekly" && (+ <div className="flex flex-wrap gap-1.5" role="group" aria-label="Days">+ {WEEK_ORDER.map((d) => (+ <button+ key={d}+ type="button"+ aria-pressed={days.includes(d)}+ aria-label={WEEKDAYS[d]}+ onClick={() => toggleDay(d)}+ className={cn(+ "grid h-8 w-11 place-items-center rounded-lg border text-[12px] font-medium transition-colors",+ days.includes(d) ? "border-primary bg-brand-faint text-brand-text" : "text-muted-foreground hover:bg-accent hover:text-foreground",+ )}+ >+ {WEEKDAYS[d].slice(0, 3)}+ </button>+ ))}+ </div>+ )}+ <div className="grid grid-cols-[minmax(0,1fr)] gap-4 sm:grid-cols-2">+ {(kind === "daily" || kind === "weekly") && (+ <div className="space-y-2">+ <Label htmlFor={ids.time}>Time</Label>+ <Input id={ids.time} type="time" value={time} onChange={(e) => setTime(e.target.value)} required />+ </div>+ )}+ {kind === "hours" && (+ <div className="space-y-2">+ <Label htmlFor={ids.hours}>Every</Label>+ <Select value={String(every)} onValueChange={(v) => setEvery(Number(v))}>+ <SelectTrigger id={ids.hours} className="w-full">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {SCHEDULE_HOURS.map((h) => (+ <SelectItem key={h} value={String(h)}>+ {h === 1 ? "hour" : h % 24 === 0 && h > 24 ? `${h / 24} days` : `${h} hours`}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>+ )}+ {kind === "once" && (+ <div className="space-y-2">+ <Label htmlFor={ids.at}>Date and time</Label>+ <Input id={ids.at} type="datetime-local" value={at} onChange={(e) => setAt(e.target.value)} required />+ </div>+ )}+ <div className="space-y-2">+ <Label htmlFor={ids.tz}>Time zone</Label>+ <Select value={tz} onValueChange={setTz}>+ <SelectTrigger id={ids.tz} className="w-full">+ <SelectValue>{zoneLabel(tz, now)}</SelectValue>+ </SelectTrigger>+ <SelectContent className="max-h-72">+ {zones.map((z) => (+ <SelectItem key={z} value={z}>+ {z.replace(/_/g, " ")}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>+ </div>+ <p className="text-[13px] text-muted-foreground" aria-live="polite">+ {problem ? (+ <span className="text-destructive">{problem}</span>+ ) : next ? (+ <>+ Next run: <span className="font-medium text-foreground">{formatWhen(next, tz)}</span> ({untilText(next, now)})+ {kind === "hours" && !schedule ? ", then every " + (every === 1 ? "hour" : `${every} hours`) : ""}.+ </>+ ) : (+ <span className="text-destructive">That time has passed — pick a later one.</span>+ )}+ </p>+ </fieldset>++ <fieldset className="space-y-2">+ <legend className="text-sm font-medium">Assistant</legend>+ <div className="flex flex-wrap items-center gap-1.5">+ <ModePicker value={mode} onChange={setMode} availability={can} />+ <EngineSwitch value={engine} onChange={setEngine} size="sm" compact />+ </div>+ <p className="text-[12px] text-muted-foreground">+ {engine === "open" ? "Open-source models run free on your GPU." : "Paid models cost what the approval card shows."} Smart uses Claude (your Anthropic key, billed per run); Free uses a local model or the offline planner.+ </p>+ </fieldset>++ <fieldset className="space-y-2">+ <legend className="text-sm font-medium">Before anything runs</legend>+ <div role="radiogroup" aria-label="Approval" onKeyDown={radioKeys} className="grid gap-2">+ {(+ [+ { id: "ask", title: "Ask me first", body: "Each run plans the job, then waits in its chat for your OK. Nothing is spent until you approve." },+ { id: "auto", title: "Run on its own, within a cap", body: "Plans start without asking while they fit the cap. A plan that would pass it, or has no known price, waits for you." },+ ] as const+ ).map((o) => (+ <button+ key={o.id}+ type="button"+ role="radio"+ aria-checked={approval === o.id}+ tabIndex={radioTab(approval === o.id)}+ onClick={() => setApproval(o.id)}+ className={cn("rounded-xl border px-3.5 py-2.5 text-left transition-colors", approval === o.id ? "border-primary bg-brand-faint" : "hover:bg-accent")}+ >+ <span className="block text-[13px] font-medium">{o.title}</span>+ <span className="block text-[12px] text-muted-foreground">{o.body}</span>+ </button>+ ))}+ </div>+ {approval === "auto" && (+ <div className="flex flex-wrap items-center gap-2 pt-1">+ <Label htmlFor={ids.cap} className="text-[13px] font-normal">+ Spend up to+ </Label>+ <div className="relative w-28">+ <span className="pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-[13px] text-muted-foreground">$</span>+ <Input id={ids.cap} type="number" inputMode="decimal" min={0} max={MAX_SCHEDULE_CAP_USD} step={0.5} value={cap} onChange={(e) => setCap(e.target.value)} aria-invalid={capBad} className="pl-6" />+ </div>+ <span className="text-[13px] text-muted-foreground">per run on its own. Demo runs and open-source models are free.</span>+ </div>+ )}+ </fieldset>+ </div>+ <DialogFooter className="mx-0 mb-0 border-t px-5 py-3">+ <Button type="button" variant="ghost" onClick={onDone}>+ Cancel+ </Button>+ <Button type="submit" disabled={busy || !prompt.trim() || !!problem || !next || capBad}>+ {busy && <Loader2 className="animate-spin" />} {schedule ? "Save" : "Schedule"}+ </Button>+ </DialogFooter>+ </form>+ );+}diff --git a/src/components/assist/scheduled-view.tsx b/src/components/assist/scheduled-view.tsxnew file mode 100644index 00000000..92b99e89--- /dev/null+++ b/src/components/assist/scheduled-view.tsx@@ -0,0 +1,247 @@+"use client";++import { CalendarClock, CircleAlert, CircleCheck, Clock, Loader2, MoreHorizontal, Pause, Pencil, Play, Plus, SkipForward, Trash2 } from "lucide-react";+import Link from "next/link";+import { useRouter } from "next/navigation";+import { useState } from "react";+import { toast } from "sonner";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+} from "@/components/ui/alert-dialog";+import { Button } from "@/components/ui/button";+import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";+import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty";+import { SidebarTrigger } from "@/components/ui/sidebar";+import { Skeleton } from "@/components/ui/skeleton";+import { Switch } from "@/components/ui/switch";+import { useNow } from "@/components/studio/use-now";+import { describeRule, formatWhen, untilText, zoneLabel, type ScheduleResult, type ScheduleView } from "@/lib/assist-schedule";+import { formatCost, timeAgo } from "@/lib/format";+import { cn } from "@/lib/utils";+import { useProjects, useScheduleActions, useSchedules } from "./hooks";+import { ScheduleDialog } from "./schedule-dialog";+import { ProjectDot, RailButton } from "./shell";++const RESULT: Record<ScheduleResult["status"], { icon: typeof Clock; tone: string }> = {+ running: { icon: Loader2, tone: "text-brand-text" },+ waiting: { icon: Clock, tone: "text-amber-700 dark:text-amber-300" },+ done: { icon: CircleCheck, tone: "text-emerald-700 dark:text-emerald-400" },+ failed: { icon: CircleAlert, tone: "text-destructive" },+ skipped: { icon: SkipForward, tone: "text-muted-foreground" },+};++/**+ * Assist's Scheduled tab (Supercomputer's Scheduled Tasks): every task with its rule, next run and+ * last result, to run now, pause, edit or delete. Standalone at /assist/scheduled, or one project's+ * tasks inside its page.+ */+export function ScheduledView({ projectId }: { projectId?: string } = {}) {+ const schedules = useSchedules(projectId);+ const [creating, setCreating] = useState(false);+ const list = schedules.data ?? [];++ return (+ <div className={cn("flex min-w-0 flex-col", !projectId && "min-h-svh")}>+ {!projectId && (+ <header className="sticky top-0 z-20 flex h-14 items-center gap-1.5 bg-background/85 px-3 backdrop-blur sm:px-6">+ <SidebarTrigger className="md:hidden" />+ <RailButton />+ <h1 className="font-heading text-[22px] leading-none">Scheduled</h1>+ <div className="ml-auto">+ <Button size="sm" onClick={() => setCreating(true)}>+ <Plus /> <span className="hidden sm:inline">Schedule a task</span>+ <span className="sm:hidden">New</span>+ </Button>+ </div>+ </header>+ )}+ <div className={cn("w-full max-w-[900px] min-w-0 flex-1 px-3 pb-16 sm:px-6", projectId ? "pt-2" : "pt-4 md:pt-8")}>+ {!projectId ? (+ <p className="max-w-2xl text-[15px] text-pretty text-muted-foreground">+ Prompts that run by themselves — daily ad variations, a weekly competitor scan, a content calendar. Each run is a new chat; it asks before spending unless you let it run within a cap.+ </p>+ ) : (+ <div className="flex flex-wrap items-center justify-between gap-2">+ <p className="text-[13px] text-muted-foreground">Runs here follow the project's instructions and sources.</p>+ <Button size="sm" onClick={() => setCreating(true)}>+ <Plus /> Schedule+ </Button>+ </div>+ )}+ <div className="mt-5">+ {schedules.isLoading ? (+ <div className="space-y-2">+ {Array.from({ length: 3 }, (_, i) => (+ <Skeleton key={i} className="h-24 rounded-2xl" />+ ))}+ </div>+ ) : schedules.isError ? (+ <p className="rounded-2xl border border-dashed px-4 py-8 text-center text-[13px] text-muted-foreground">Couldn't load the tasks: {(schedules.error as Error).message}</p>+ ) : list.length ? (+ <ul className="space-y-2">+ {list.map((s) => (+ <TaskRow key={s.id} s={s} showProject={!projectId} />+ ))}+ </ul>+ ) : (+ <Empty className="rounded-2xl border border-dashed">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <CalendarClock />+ </EmptyMedia>+ <EmptyTitle>No scheduled tasks yet</EmptyTitle>+ <EmptyDescription>Schedule a prompt here, or from any chat's menu. You choose whether each run asks you first.</EmptyDescription>+ </EmptyHeader>+ <EmptyContent>+ <Button size="sm" onClick={() => setCreating(true)}>+ <Plus /> Schedule a task+ </Button>+ </EmptyContent>+ </Empty>+ )}+ </div>+ </div>+ <ScheduleDialog open={creating} onOpenChange={setCreating} seed={{ projectId: projectId ?? null }} />+ </div>+ );+}++function TaskRow({ s, showProject }: { s: ScheduleView; showProject: boolean }) {+ const router = useRouter();+ const actions = useScheduleActions();+ const projects = useProjects();+ const now = useNow(30_000);+ const [editing, setEditing] = useState(false);+ const [deleting, setDeleting] = useState(false);+ const [busy, setBusy] = useState(false);+ const project = s.projectId ? projects.data?.find((p) => p.id === s.projectId) : null;+ const ended = !s.paused && s.nextRunAt === null;++ const attempt = async (fn: () => Promise<unknown>) => {+ setBusy(true);+ try {+ await fn();+ } catch (e) {+ toast.error((e as Error).message);+ } finally {+ setBusy(false);+ }+ };+ const runNow = () =>+ attempt(async () => {+ const id = await actions.runNow(s.id);+ if (!id) return void toast("The last run is still going — try again when it stops");+ toast.success("Started", { action: { label: "Open chat", onClick: () => router.push(`/assist?c=${id}`) }, duration: 4000 });+ });++ const last = s.last;+ const R = last ? RESULT[last.status] : null;+ // Inside a project's page the tasks sit under its tabs, a level lower.+ const Title = showProject ? "h2" : "h3";+ return (+ <li className="rounded-2xl border bg-background p-3.5 sm:p-4">+ <div className="flex items-start gap-3">+ <span className="mt-0.5 grid size-9 shrink-0 place-items-center rounded-xl bg-muted text-muted-foreground" aria-hidden>+ <CalendarClock className="size-4" />+ </span>+ <div className="min-w-0 flex-1">+ <Title className="truncate text-[14px] font-medium">{s.title}</Title>+ <p className="mt-0.5 flex flex-wrap items-center gap-x-1.5 text-[12px] text-muted-foreground">+ <span>{describeRule(s.rule)}</span>+ <span aria-hidden>·</span>+ <span>{zoneLabel(s.tz, now)}</span>+ {showProject && project && (+ <>+ <span aria-hidden>·</span>+ <Link href={`/assist/projects/${project.id}`} className="inline-flex items-center gap-1 hover:text-foreground">+ <ProjectDot project={project} className="size-1.5" /> {project.name}+ </Link>+ </>+ )}+ </p>+ </div>+ <div className="flex shrink-0 items-center gap-1">+ <Switch+ checked={!s.paused}+ disabled={busy || ended}+ onCheckedChange={(on) => void attempt(() => actions.update(s.id, { paused: !on }))}+ aria-label={s.paused ? `Resume ${s.title}` : `Pause ${s.title}`}+ />+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button variant="ghost" size="icon-sm" className="text-muted-foreground" aria-label={`More for ${s.title}`}>+ <MoreHorizontal />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end" className="w-48">+ <DropdownMenuItem onSelect={() => void runNow()}>+ <Play /> Run now+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => setEditing(true)}>+ <Pencil /> Edit…+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => void attempt(() => actions.update(s.id, { paused: !s.paused }))} disabled={ended}>+ {s.paused ? <Play /> : <Pause />} {s.paused ? "Resume" : "Pause"}+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ <DropdownMenuItem variant="destructive" onSelect={() => setDeleting(true)}>+ <Trash2 /> Delete…+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ </div>+ <p className="mt-2 line-clamp-2 text-[13px] text-pretty text-foreground/85 sm:pl-12">{s.prompt}</p>+ <dl className="mt-3 grid grid-cols-[minmax(0,1fr)] gap-2 text-[12px] sm:grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)] sm:pl-12">+ <div className="min-w-0">+ <dt className="text-muted-foreground">Next run</dt>+ <dd className="font-medium">{s.paused ? "Paused" : s.nextRunAt ? `${formatWhen(s.nextRunAt, s.tz)} (${untilText(s.nextRunAt, now)})` : "None — it ran"}</dd>+ <dd className="text-muted-foreground">{s.approval === "ask" ? "Asks before spending" : s.capUsd ? `Runs on its own up to ${formatCost(s.capUsd)} a run` : "Runs free plans on its own"}</dd>+ </div>+ <div className="min-w-0">+ <dt className="text-muted-foreground">+ Last run{s.lastRunAt ? ` · ${timeAgo(s.lastRunAt)}` : ""}+ {s.runs > 1 ? ` · ${s.runs} runs` : ""}+ </dt>+ {last && R ? (+ <dd className={cn("flex min-w-0 items-start gap-1.5", R.tone)}>+ <R.icon className={cn("mt-0.5 size-3.5 shrink-0", last.status === "running" && "animate-spin")} aria-hidden />+ <span className="min-w-0">+ <span className="line-clamp-2 break-words">{last.text}</span>+ {last.threadId && (+ <Link href={`/assist?c=${last.threadId}`} className="font-medium text-brand-text hover:underline">+ {last.status === "waiting" ? "Review the plan" : "Open chat"}+ </Link>+ )}+ </span>+ </dd>+ ) : (+ <dd className="text-muted-foreground">Not run yet</dd>+ )}+ </div>+ </dl>+ <ScheduleDialog open={editing} onOpenChange={setEditing} schedule={s} />+ <AlertDialog open={deleting} onOpenChange={setDeleting}>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Delete “{s.title}”?</AlertDialogTitle>+ <AlertDialogDescription>It won't run again. The chats its runs made, and everything they made, stay.</AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction variant="destructive" onClick={() => void attempt(() => actions.remove(s.id))}>+ Delete+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ </li>+ );+}diff --git a/src/components/assist/shell.tsx b/src/components/assist/shell.tsxindex bd851c10..185ca3aa 100644--- a/src/components/assist/shell.tsx+++ b/src/components/assist/shell.tsx@@ -1,6 +1,6 @@"use client";-import { Brain, FolderPlus, MessageSquarePlus, MessagesSquare, Search, Sparkles, X } from "lucide-react";+import { Brain, CalendarClock, FolderPlus, MessageSquarePlus, MessagesSquare, Search, Sparkles, X } from "lucide-react";import Link from "next/link";import { usePathname, useRouter, useSearchParams } from "next/navigation";import { Suspense, useDeferredValue, useState } from "react";@@ -17,7 +17,7 @@ import { ProjectDialog } from "./project-dialog";import { ProjectDot } from "./project-dot";/**- * Assist's own sidebar (Supercomputer's): New chat, Search, Skills, Memory, Projects and Chats.+ * Assist's own sidebar (Supercomputer's): New chat, Search, Skills, Memory, Scheduled, Projects and Chats.* A column from xl up; below that the same list opens as a sheet from the header button.*/@@ -41,16 +41,16 @@ export function RailButton({ className }: { className?: string }) {<><Tooltip><TooltipTrigger asChild>- <Button variant="ghost" size="icon-sm" className={cn("xl:hidden", className)} onClick={() => setOpen(true)} aria-label="Chats, projects, skills and memory">+ <Button variant="ghost" size="icon-sm" className={cn("xl:hidden", className)} onClick={() => setOpen(true)} aria-label="Chats, projects, skills, memory and scheduled tasks"><MessagesSquare /></Button></TooltipTrigger>- <TooltipContent>Chats, projects, skills and memory</TooltipContent>+ <TooltipContent>Chats, projects, skills, memory and scheduled tasks</TooltipContent></Tooltip><Sheet open={open} onOpenChange={setOpen}><SheetContent side="left" className="w-[min(86vw,320px)] gap-0 p-0" aria-describedby={undefined} onOpenAutoFocus={(e) => e.preventDefault()}><SheetTitle className="sr-only">Assist</SheetTitle>- <SheetDescription className="sr-only">Chats, projects, skills and memory</SheetDescription>+ <SheetDescription className="sr-only">Chats, projects, skills, memory and scheduled tasks</SheetDescription><Suspense fallback={<RailSkeleton />}><Rail onNavigate={() => setOpen(false)} /></Suspense>@@ -118,6 +118,7 @@ function Rail({ onNavigate }: { onNavigate?: () => void }) {<nav className="space-y-0.5" aria-label="Assist pages"><RailLink href="/assist/skills" icon={Sparkles} label="Skills" active={pathname.startsWith("/assist/skills")} onNavigate={onNavigate} /><RailLink href="/assist/memory" icon={Brain} label="Memory" active={pathname.startsWith("/assist/memory")} onNavigate={onNavigate} />+ <RailLink href="/assist/scheduled" icon={CalendarClock} label="Scheduled" active={pathname.startsWith("/assist/scheduled")} onNavigate={onNavigate} /></nav></div><div className="min-h-0 flex-1 overflow-y-auto px-3 pb-4">diff --git a/src/components/assist/transcript.tsx b/src/components/assist/transcript.tsxindex db804bf2..019a61e7 100644--- a/src/components/assist/transcript.tsx+++ b/src/components/assist/transcript.tsx@@ -1,6 +1,6 @@"use client";-import { AppWindow, ArrowUpRight, AudioLines, Box, Brain, Captions, Check, CircleAlert, Clapperboard, Film, FileText, ImageIcon, Info, Languages, Layers, Loader2, Megaphone, Scissors, Search, Sparkles, Video } from "lucide-react";+import { AppWindow, ArrowUpRight, AudioLines, Box, Brain, Captions, Check, CircleAlert, Clapperboard, Film, FileText, ImageIcon, Info, Languages, Layers, Loader2, Megaphone, Plug, Scissors, Search, Sparkles, Video } from "lucide-react";import Link from "next/link";import { useState } from "react";import { toast } from "sonner";@@ -290,6 +290,14 @@ export function Transcript({);case "tool":if (item.studio && item.href) return <StudioCard key={item.id} text={item.text} studio={item.studio} href={item.href} />;+ // A custom MCP connector's tool Claude used (Settings → Assist connectors).+ if (item.connector)+ return (+ <p key={item.id} className={cn("flex items-center gap-1.5 text-[12px]", item.failed ? "text-destructive" : "text-muted-foreground")}>+ <Plug className="size-3" aria-hidden /> <span className="sr-only">Connector:</span> {item.text}+ {item.failed && " — didn't work"}+ </p>+ );return item.href ? (<Link key={item.id} href={item.href} className="flex w-fit items-center gap-1.5 text-[12px] text-muted-foreground hover:text-foreground"><Search className="size-3" /> {item.text} <ArrowUpRight className="size-3" />diff --git a/src/components/settings-form.tsx b/src/components/settings-form.tsxindex 4dacd64e..9566feae 100644--- a/src/components/settings-form.tsx+++ b/src/components/settings-form.tsx@@ -15,6 +15,7 @@ import { LoraSettings } from "@/components/lora-settings";import { useStatus, type StatusInfo } from "@/lib/api";import { connectionSummary, ENGINE_MODE_LABEL, FAL_KEYS_URL, showFirstRun } from "@/lib/connections";import { cn } from "@/lib/utils";+import { ConnectorSettings } from "@/components/assist/connectors-settings";import { NotificationSettings } from "@/components/notification-settings";import { SecuritySettings } from "@/components/security-settings";@@ -382,6 +383,14 @@ export function SettingsForm({ prices }: { prices?: string }) {</div></Section>+ <Section+ id="assist-connectors"+ title="Assist · connectors"+ description="Give Claude in Assist the tools of your other apps — docs, tasks, CRM, analytics — through their MCP servers (a URL and, usually, a token). Only Claude chats use them."+ >+ <ConnectorSettings claudeReady={!!get("anthropicKey")?.isSet} />+ </Section>+<Sectionid="notifications"title="Notifications"diff --git a/tests/e2e/assist-flows.mjs b/tests/e2e/assist-flows.mjsindex 43308ae9..63ef144e 100644--- a/tests/e2e/assist-flows.mjs+++ b/tests/e2e/assist-flows.mjs@@ -171,14 +171,15 @@ await step("phone: the sidebar opens as a sheet; no sideways scroll", async () =const phone = await browser.newContext({ ...PHONE, colorScheme: scheme });const p = await phone.newPage();p.on("pageerror", (e) => errors.push(e.message));- for (const r of ["/assist", "/assist/skills", "/assist/memory"]) {+ for (const r of ["/assist", "/assist/skills", "/assist/memory", "/assist/scheduled"]) {await openRoute(p, app + r);const wide = await p.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);if (wide > 0) throw new Error(`${r} is ${wide}px too wide`);}await openRoute(p, `${app}/assist`);- await p.getByRole("button", { name: "Chats, projects, skills and memory" }).click();+ await p.getByRole("button", { name: "Chats, projects, skills, memory and scheduled tasks" }).click();await p.getByRole("dialog").getByRole("link", { name: "Skills" }).waitFor();+ await p.getByRole("dialog").getByRole("link", { name: "Scheduled" }).waitFor();await shot(p, "flow-phone-rail");await phone.close();});