Skip to content

Your lightweight open-source personal agent.

fix(webui): simplify automation calendar and creation UI

chengyongruc25b2048efe1
diff --git a/webui/src/components/settings/SettingsPage.tsx b/webui/src/components/settings/SettingsPage.tsx
index 7b9fb7196..2be379df4 100644
--- a/webui/src/components/settings/SettingsPage.tsx
+++ b/webui/src/components/settings/SettingsPage.tsx
@@ -97,8 +97,6 @@ export function SettingsPage({
automationsError,
automationsFilter,
automationsLoading,
- automationsQuery,
- automationsSort,
beginModelPresetCreation,
cancelModelPresetCreation,
changeModelCallOrder,
@@ -195,8 +193,6 @@ export function SettingsPage({
setAutomationPendingDelete,
setAutomationPendingEdit,
setAutomationsFilter,
- setAutomationsQuery,
- setAutomationsSort,
setCliAppsError,
setCliAppsMessage,
setCustomMcpForm,
@@ -578,14 +574,10 @@ export function SettingsPage({
settingsSnapshot={controller.settings}
onStartChat={onStartAutomationChat}
loading={automationsLoading}
- query={automationsQuery}
filter={automationsFilter}
- sort={automationsSort}
actionKey={automationAction}
error={automationsError}
- onQueryChange={setAutomationsQuery}
onFilterChange={setAutomationsFilter}
- onSortChange={setAutomationsSort}
onAction={handleAutomationAction}
onRequestEdit={(job) => {
setAutomationDetailReturn(null);
diff --git a/webui/src/components/settings/system/AutomationCalendar.tsx b/webui/src/components/settings/system/AutomationCalendar.tsx
index 0fe46dbfa..211d64050 100644
--- a/webui/src/components/settings/system/AutomationCalendar.tsx
+++ b/webui/src/components/settings/system/AutomationCalendar.tsx
@@ -1,8 +1,10 @@
-import { ChevronDown, CircleAlert, Clock3, Loader2 } from "lucide-react";
-import { useLayoutEffect, useMemo, useRef, useState } from "react";
+import { CircleAlert, Loader2, X } from "lucide-react";
+import { useId, useLayoutEffect, useMemo, useRef, useState } from "react";
+import type { ReactNode } from "react";
import { Button } from "@/components/ui/button";
import { formControlFocusClassName } from "@/components/ui/form-control";
+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import type { SessionAutomationJob } from "@/lib/types";
import { cn } from "@/lib/utils";
@@ -24,10 +26,8 @@ type CalendarCopy = {
running: string;
failed: string;
more: (count: number) => string;
+ close: string;
noEntries: string;
- outsideMonth: string;
- paused: string;
- attention: string;
completed: string;
};
@@ -35,6 +35,7 @@ interface AutomationCalendarProps {
jobs: SessionAutomationJob[];
locale: string;
copy: CalendarCopy;
+ filters?: ReactNode;
onInspect: (job: SessionAutomationJob, trigger: HTMLElement) => void;
}
@@ -173,7 +174,72 @@ function CalendarEntryRow({ entry, locale, copy, onInspect, compact = false }: {
);
}
-export function AutomationCalendar({ jobs, locale, copy, onInspect }: AutomationCalendarProps) {
+function CalendarOverflowEntries({ entries, dayLabel, locale, copy, onInspect }: {
+ entries: CalendarEntry[];
+ dayLabel: string;
+ locale: string;
+ copy: CalendarCopy;
+ onInspect: AutomationCalendarProps["onInspect"];
+}) {
+ const [open, setOpen] = useState(false);
+ const titleId = useId();
+ const triggerRef = useRef<HTMLButtonElement | null>(null);
+ const pendingSelection = useRef<SessionAutomationJob | null>(null);
+
+ return (
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>
+ <button
+ ref={triggerRef}
+ type="button"
+ className={cn(
+ "min-h-6 w-full rounded-compact pe-2 ps-[1.375rem] py-1 text-left text-[10px] text-muted-foreground transition-colors duration-150 hover:bg-foreground/[0.055] hover:text-foreground motion-reduce:transition-none",
+ formControlFocusClassName,
+ )}
+ >
+ {copy.more(entries.length - 3)}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ align="start"
+ side="right"
+ collisionPadding={16}
+ aria-labelledby={titleId}
+ className="w-80 max-w-[calc(100vw-2rem)] overscroll-contain p-2"
+ onCloseAutoFocus={(event) => {
+ const job = pendingSelection.current;
+ pendingSelection.current = null;
+ if (!job || !triggerRef.current?.isConnected) return;
+ // Hand off after the day popover exits, retaining a mounted return target.
+ event.preventDefault();
+ onInspect(job, triggerRef.current);
+ }}
+ >
+ <div className="mb-1 flex items-center gap-2 px-2 py-1">
+ <h3 id={titleId} className="min-w-0 flex-1 text-[13px] font-semibold">{dayLabel}</h3>
+ <Button type="button" variant="ghost" size="icon" className="h-8 w-8 shrink-0" aria-label={copy.close} onClick={() => setOpen(false)}>
+ <X className="h-4 w-4" aria-hidden />
+ </Button>
+ </div>
+ {entries.map((entry) => (
+ <CalendarEntryRow
+ key={entry.id}
+ entry={entry}
+ locale={locale}
+ copy={copy}
+ onInspect={(job) => {
+ pendingSelection.current = job;
+ setOpen(false);
+ }}
+ compact
+ />
+ ))}
+ </PopoverContent>
+ </Popover>
+ );
+}
+
+export function AutomationCalendar({ jobs, locale, copy, filters, onInspect }: AutomationCalendarProps) {
const [month, setMonth] = useState(() => startOfMonth(new Date()));
const calendarRef = useRef<HTMLElement | null>(null);
const [wideCalendar, setWideCalendar] = useState(true);
@@ -190,16 +256,12 @@ export function AutomationCalendar({ jobs, locale, copy, onInspect }: Automation
const key = dateKey(entry.startMs);
entriesByDay.set(key, [...(entriesByDay.get(key) ?? []), entry]);
});
- const visibleJobIds = new Set(visibleEntries.map((entry) => entry.job.id));
- const outsideJobs = jobs.filter((job) => !visibleJobIds.has(job.id));
const monthLabel = new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }).format(month);
const weekdayFormatter = new Intl.DateTimeFormat(locale, { weekday: "short" });
const dayFormatter = new Intl.DateTimeFormat(locale, { day: "numeric" });
const agendaDateFormatter = new Intl.DateTimeFormat(locale, { month: "short", day: "numeric", weekday: "short" });
const weekdayLabels = Array.from({ length: 7 }, (_, index) => weekdayFormatter.format(addDays(new Date(2026, 0, 5), index)));
- const inspectOutsideJob = (job: SessionAutomationJob, target: HTMLElement) => onInspect(job, target);
-
useLayoutEffect(() => {
const calendar = calendarRef.current;
if (!calendar) return;
@@ -214,52 +276,50 @@ export function AutomationCalendar({ jobs, locale, copy, onInspect }: Automation
}, []);
return (
- <section ref={calendarRef} className="automation-calendar overflow-hidden rounded-panel border border-border/70 bg-[hsl(var(--settings-surface))]">
- <div className="flex min-h-14 flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2.5 sm:px-6">
- <h2 className="min-w-0 flex-1 text-[15px] font-semibold text-foreground">{monthLabel}</h2>
- <div className="flex items-center gap-1">
- <Button
- type="button"
- variant="outline"
- size="sm"
- className="h-8 rounded-control px-3 text-[12px]"
- onClick={() => setMonth(startOfMonth(new Date()))}
- >
- {copy.today}
- </Button>
- <Button
- type="button"
- variant="ghost"
- size="icon"
- className="h-8 w-8 text-muted-foreground"
- aria-label={copy.previousMonth}
- onClick={() => setMonth((value) => addMonths(value, -1))}
- >
- <span className="text-lg leading-none" aria-hidden>‹</span>
- </Button>
- <Button
- type="button"
- variant="ghost"
- size="icon"
- className="h-8 w-8 text-muted-foreground"
- aria-label={copy.nextMonth}
- onClick={() => setMonth((value) => addMonths(value, 1))}
- >
- <span className="text-lg leading-none" aria-hidden>›</span>
- </Button>
+ <section ref={calendarRef} className="automation-calendar overflow-hidden rounded-panel bg-[hsl(var(--settings-surface))]">
+ <div className="automation-calendar-header bg-foreground/[0.025]">
+ <div className="automation-calendar-toolbar">
+ <h2 className="min-w-0 text-[15px] font-semibold text-foreground">{monthLabel}</h2>
+ {filters ? <div className="automation-calendar-filters min-w-0">{filters}</div> : null}
+ <div className="automation-calendar-navigation flex items-center gap-1">
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ className="h-8 rounded-control px-3 text-[12px]"
+ onClick={() => setMonth(startOfMonth(new Date()))}
+ >
+ {copy.today}
+ </Button>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ className="h-8 w-8 text-muted-foreground"
+ aria-label={copy.previousMonth}
+ onClick={() => setMonth((value) => addMonths(value, -1))}
+ >
+ <span className="text-lg leading-none" aria-hidden>‹</span>
+ </Button>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ className="h-8 w-8 text-muted-foreground"
+ aria-label={copy.nextMonth}
+ onClick={() => setMonth((value) => addMonths(value, 1))}
+ >
+ <span className="text-lg leading-none" aria-hidden>›</span>
+ </Button>
+ </div>
</div>
- </div>
-
- {!jobs.length ? (
- <div className="flex min-h-48 items-center justify-center px-6 text-center text-[13px] text-muted-foreground">
- {copy.noEntries}
- </div>
- ) : null}
- {jobs.length > 0 && wideCalendar ? <div className="automation-calendar-grid" aria-label={monthLabel}>
- <div className="automation-calendar-weekdays" aria-hidden>
+ {wideCalendar ? <div className="automation-calendar-weekdays" aria-hidden>
{weekdayLabels.map((label) => <div key={label}>{label}</div>)}
- </div>
+ </div> : null}
+ </div>
+
+ {wideCalendar ? <div className="automation-calendar-grid" aria-label={monthLabel}>
<div className="automation-calendar-month">
{days.map((day) => {
const entries = entriesByDay.get(dateKey(day)) ?? [];
@@ -295,25 +355,13 @@ export function AutomationCalendar({ jobs, locale, copy, onInspect }: Automation
/>
))}
{entries.length > 3 ? (
- <details className="group/more">
- <summary className={cn(
- "cursor-pointer list-none rounded-control px-2 py-1 text-[10px] text-muted-foreground settings-hover [&::-webkit-details-marker]:hidden",
- formControlFocusClassName,
- )}>
- {copy.more(entries.length - 3)}
- </summary>
- <div className="mt-0.5 space-y-0.5">
- {entries.slice(3).map((entry) => (
- <CalendarEntryRow
- key={entry.id}
- entry={entry}
- locale={locale}
- copy={copy}
- onInspect={onInspect}
- />
- ))}
- </div>
- </details>
+ <CalendarOverflowEntries
+ entries={entries}
+ dayLabel={dayLabel}
+ locale={locale}
+ copy={copy}
+ onInspect={onInspect}
+ />
) : null}
</div>
</div>
@@ -322,7 +370,7 @@ export function AutomationCalendar({ jobs, locale, copy, onInspect }: Automation
</div>
</div> : null}
- {jobs.length > 0 && !wideCalendar ? <div className="automation-calendar-agenda px-3 py-2 sm:px-4">
+ {!wideCalendar ? <div className="automation-calendar-agenda px-3 py-2 sm:px-4">
{visibleEntries.length ? (
<ol>
{days.filter((day) => entriesByDay.has(dateKey(day))).map((day) => (
@@ -363,47 +411,6 @@ export function AutomationCalendar({ jobs, locale, copy, onInspect }: Automation
</div>
) : null}
- {outsideJobs.length ? (
- <details
- key={`${month.getTime()}:${visibleEntries.length ? "mixed" : "outside-only"}`}
- className="group"
- open={!visibleEntries.length || undefined}
- >
- <summary className={cn("automation-meta-row min-h-11 cursor-pointer list-none items-center text-[12px] text-muted-foreground settings-hover [&::-webkit-details-marker]:hidden", formControlFocusClassName)}>
- <Clock3 className="h-3.5 w-3.5 place-self-center" aria-hidden />
- <span className="flex min-w-0 items-center gap-2">
- <span className="truncate">{copy.outsideMonth}</span>
- <span className="tabular-nums text-muted-foreground/65">{outsideJobs.length}</span>
- </span>
- <ChevronDown className="h-4 w-4 transition-transform group-open:rotate-180 motion-reduce:transition-none" aria-hidden />
- </summary>
- <ul className="px-4 pb-2 sm:px-6">
- {outsideJobs.map((job) => (
- <li key={job.id}>
- <button
- type="button"
- className={cn("grid min-h-10 w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-x-2 rounded-control text-left text-[12px] settings-hover", formControlFocusClassName)}
- aria-haspopup="dialog"
- onClick={(event) => inspectOutsideJob(job, event.currentTarget)}
- >
- <span className="h-4 w-4" aria-hidden />
- <span className="truncate font-medium text-foreground">{job.name || job.id}</span>
- <span className="flex shrink-0 flex-wrap justify-end gap-x-2 gap-y-0.5 text-[11px] text-muted-foreground">
- {(job.state.last_status === "error" || job.state.last_error)
- ? <span>{copy.attention}</span> : null}
- {!job.enabled ? <span>{copy.paused}</span> : null}
- {job.enabled && job.delete_after_run && job.state.last_status === "ok"
- ? <span>{copy.completed}</span> : null}
- {job.enabled && !(job.delete_after_run && job.state.last_status === "ok")
- && job.state.last_status !== "error" && !job.state.last_error
- ? <span>{copy.outsideMonth}</span> : null}
- </span>
- </button>
- </li>
- ))}
- </ul>
- </details>
- ) : null}
</section>
);
}
diff --git a/webui/src/components/settings/system/AutomationsSettings.tsx b/webui/src/components/settings/system/AutomationsSettings.tsx
index c8b34cafa..e27288c31 100644
--- a/webui/src/components/settings/system/AutomationsSettings.tsx
+++ b/webui/src/components/settings/system/AutomationsSettings.tsx
@@ -2,21 +2,18 @@ import { useEffect, useId, useMemo, useRef, useState } from "react";
import type { FormEvent, ReactNode } from "react";
import type { TFunction } from "i18next";
import {
- ArrowUpDown,
Check,
ChevronDown,
- ChevronRight,
CircleAlert,
Clipboard,
Loader2,
- Search,
} from "lucide-react";
import { useTranslation } from "react-i18next";
import { channelTranslator } from "@/channel-plugins/i18n";
import { channelUiOwner, channelUiPresentation } from "@/channel-plugins/registry";
import { AutomationCalendar } from "@/components/settings/system/AutomationCalendar";
-import { SETTINGS_SEARCH_INPUT_CLASS, SettingsGroup } from "@/components/settings/shared/SettingsControls";
+import { SettingsGroup } from "@/components/settings/shared/SettingsControls";
import {
modelPresetOptionsFromSettings,
toModelBadgeInfo,
@@ -33,12 +30,6 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from "@/components/ui/dropdown-menu";
import { formControlFocusClassName } from "@/components/ui/form-control";
import { Input } from "@/components/ui/input";
import { SegmentedControl } from "@/components/ui/segmented-control";
@@ -56,17 +47,16 @@ import type {
import { cn } from "@/lib/utils";
export type AutomationFilter = "all" | "active" | "paused" | "failed" | "system";
-export type AutomationSort = "next" | "last" | "updated" | "name";
export type AutomationAction = "enable" | "disable" | "delete" | "run";
const EMPTY_TITLE_OVERRIDES: Record<string, string> = {};
const SYSTEM_TASKS_OPEN_STORAGE_KEY = "nanobot-webui.automation-system-tasks-open";
export function AutomationsSettings({
- payload, loading, query, filter, sort, actionKey, error,
+ payload, loading, filter, actionKey, error,
titleOverrides = EMPTY_TITLE_OVERRIDES,
settingsSnapshot = null,
- onQueryChange, onFilterChange, onSortChange, onAction,
+ onFilterChange, onAction,
onRequestEdit, onRequestDelete, onStartChat, onManageModels,
returnToDetailJob = null, onReturnToDetailHandled,
}: {
@@ -74,14 +64,10 @@ export function AutomationsSettings({
titleOverrides?: Record<string, string>;
settingsSnapshot?: SettingsPayload | null;
loading: boolean;
- query: string;
filter: AutomationFilter;
- sort: AutomationSort;
actionKey: string | null;
error: string | null;
- onQueryChange: (value: string) => void;
onFilterChange: (value: AutomationFilter) => void;
- onSortChange: (value: AutomationSort) => void;
onAction: (action: AutomationAction, job: SessionAutomationJob) => void | Promise<void>;
onRequestEdit: (job: SessionAutomationJob) => void;
onRequestDelete: (job: SessionAutomationJob) => void;
@@ -118,16 +104,13 @@ export function AutomationsSettings({
return true;
}
});
- const searchInput = useRef<HTMLInputElement | null>(null);
const pageTitle = useRef<HTMLHeadingElement | null>(null);
const selectedTrigger = useRef<HTMLElement | null>(null);
const afterDetailClose = useRef<((job: SessionAutomationJob) => void) | null>(null);
const filtered = useMemo(() => {
- const searchTokens = parseAutomationSearchQuery(query);
- return sortAutomationJobs(jobs, sort)
- .filter((job) => automationMatchesFilter(job, filter))
- .filter((job) => !searchTokens.length || automationMatchesSearch(job, searchTokens));
- }, [filter, jobs, query, sort]);
+ return jobs
+ .filter((job) => automationMatchesFilter(job, filter));
+ }, [filter, jobs]);
const personalJobs = jobs.filter((job) => !job.protected);
const personal = filtered.filter((job) => !job.protected);
const system = filtered.filter((job) => job.protected);
@@ -144,12 +127,6 @@ export function AutomationsSettings({
{ value: "failed", label: tx("settings.automations.filters.failed", "Needs attention"),
count: personalJobs.filter(automationNeedsAttention).length },
];
- const sortLabel = {
- next: tx("settings.automations.sort.next", "Next run"),
- last: tx("settings.automations.sort.last", "Last run"),
- updated: tx("settings.automations.sort.updated", "Updated"),
- name: tx("settings.automations.sort.name", "Name"),
- } satisfies Record<AutomationSort, string>;
const configuredPresetNames = useMemo(
() => new Set(settingsSnapshot?.model_presets?.map((preset) => preset.name) ?? []),
[settingsSnapshot],
@@ -178,10 +155,6 @@ export function AutomationsSettings({
else setDetailOpen(false);
}, [liveSelectedJob]);
- useEffect(() => {
- if (query) setSystemOpen(true);
- }, [query]);
-
useEffect(() => {
if (!returnToDetailJob) return;
const currentJob = jobs.find((job) => job.id === returnToDetailJob.id) ?? returnToDetailJob;
@@ -248,9 +221,10 @@ export function AutomationsSettings({
inputAriaLabel={tx("settings.automations.createInput", "Describe an automation")}
placeholder={tx(
"settings.automations.createPrompt",
- "Describe an automation, for example: summarize project updates every weekday at 9:00",
+ "What would you like nanobot to schedule?",
)}
variant="thread"
+ compactWhenIdle
modelLabel={modelBadgeLabel}
modelDetail={modelBadge.model}
modelPreset={activeModelPreset}
@@ -265,74 +239,30 @@ export function AutomationsSettings({
</div>
) : null}
- {jobs.length ? (
- <section
- aria-label={tx("settings.automations.viewOptions", "Search and filter")}
- className="grid min-w-0 items-center gap-3 sm:grid-cols-[minmax(13rem,1fr)_auto_auto]"
- >
- <div className="relative min-w-0">
- <Search className="pointer-events-none absolute start-4 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" aria-hidden />
- <Input
- ref={searchInput}
- value={query}
- onChange={(event) => onQueryChange(event.target.value)}
- aria-label={tx("settings.automations.search", "Search task, message, linked chat, or schedule")}
- placeholder={tx("settings.automations.search", "Search task, message, linked chat, or schedule")}
- className={cn("h-10 ps-11 text-[13px]", SETTINGS_SEARCH_INPUT_CLASS)}
- />
- </div>
- <div role="group" aria-label={tx("settings.nav.automations", "Automations")} className="min-w-0 max-w-full">
- <SegmentedControl
- value={filter}
- className="flex-wrap justify-start"
- itemClassName="px-2.5"
- options={summaryOptions.map((option) => ({
- value: option.value,
- label: <>{option.label} <span className="ml-0.5 tabular-nums opacity-65">{option.count}</span></>,
- }))}
- onChange={onFilterChange}
- />
- </div>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="ghost" className="h-9 justify-self-start gap-1.5 px-2 text-[11px] text-muted-foreground sm:justify-self-end">
- <ArrowUpDown className="h-3.5 w-3.5" aria-hidden />
- {sortLabel[sort]}
- <ChevronDown className="h-3.5 w-3.5" aria-hidden />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- {(Object.keys(sortLabel) as AutomationSort[]).map((value) => (
- <DropdownMenuItem key={value} onClick={() => onSortChange(value)}>
- <span>{sortLabel[value]}</span>
- {sort === value ? <Check className="ml-auto h-3.5 w-3.5" aria-hidden /> : null}
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
- </section>
- ) : null}
-
{error ? <AutomationError message={error} /> : null}
{loading && !payload ? (
<div role="status" className="flex h-44 items-center justify-center rounded-panel border border-border/70 bg-[hsl(var(--settings-surface))] text-[13px] text-muted-foreground">
<Loader2 className="mr-2 h-4 w-4 animate-spin" aria-hidden />
{tx("settings.automations.loading", "Loading automations...")}
</div>
- ) : payload && jobs.length && !filtered.length ? (
- <div className="flex min-h-32 items-center justify-center gap-3 rounded-panel border border-border/70 bg-[hsl(var(--settings-surface))] px-4 text-[12px] text-muted-foreground">
- <span>{tx("settings.automations.noMatches", "No automations match this view.")}</span>
- <Button variant="ghost" size="sm" onClick={() => {
- onQueryChange("");
- onFilterChange("all");
- }}>
- {tx("settings.automations.clearFilters", "Clear filters")}
- </Button>
- </div>
) : (
<AutomationCalendar
jobs={personal}
locale={locale}
+ filters={jobs.length ? (
+ <div role="group" aria-label={tx("settings.nav.automations", "Automations")}>
+ <SegmentedControl
+ value={filter}
+ className="flex-wrap justify-start"
+ itemClassName="px-2.5"
+ options={summaryOptions.map((option) => ({
+ value: option.value,
+ label: <>{option.label} <span className="ml-0.5 tabular-nums opacity-65">{option.count}</span></>,
+ }))}
+ onChange={onFilterChange}
+ />
+ </div>
+ ) : null}
copy={{
previousMonth: tx("settings.automations.calendar.previousMonth", "Previous month"),
nextMonth: tx("settings.automations.calendar.nextMonth", "Next month"),
@@ -342,14 +272,12 @@ export function AutomationsSettings({
running: tx("settings.automations.status.running", "Running"),
failed: tx("settings.automations.status.failed", "Failed"),
more: (count) => tx("settings.automations.calendar.more", "+{{count}} more", { count }),
+ close: tx("common.close", "Close"),
noEntries: personal.length
? tx("settings.automations.calendar.noEntries", "No runs in this month.")
: personalJobs.length
? tx("settings.automations.noMatches", "No automations match this view.")
: tx("settings.automations.empty", "No automations yet."),
- outsideMonth: tx("settings.automations.calendar.outsideMonth", "Without a date in this month"),
- paused: tx("settings.automations.filters.paused", "Paused"),
- attention: tx("settings.automations.filters.failed", "Needs attention"),
completed: tx("settings.automations.status.completed", "Completed"),
}}
onInspect={inspectJob}
@@ -412,7 +340,7 @@ export function AutomationsSettings({
if (detailOpen) return;
setInspectedJob(null);
const target = selectedTrigger.current?.isConnected
- ? selectedTrigger.current : searchInput.current ?? pageTitle.current;
+ ? selectedTrigger.current : pageTitle.current;
target?.focus({ preventScroll: true });
const next = afterDetailClose.current;
afterDetailClose.current = null;
@@ -452,7 +380,6 @@ export function AutomationDetailDialog({
<DialogContent
{...(job.protected ? { "aria-describedby": undefined } : {})}
{...(!open ? { inert: "", "aria-hidden": true } : {})}
- showCloseButton={false}
className={cn(
"flex max-h-[calc(100dvh-2rem)] max-w-[520px] flex-col gap-0 overflow-hidden p-0",
job.protected && "max-w-[440px]",
@@ -465,7 +392,6 @@ export function AutomationDetailDialog({
locale={locale}
actionKey={actionKey}
error={error}
- onClose={() => onOpenChange(false)}
onAction={onAction}
onRequestEdit={onRequestEdit}
onRequestDelete={onRequestDelete}
@@ -525,13 +451,12 @@ function AutomationListItem({ job, locale, disabled, onSelect }: {
}
function AutomationDetailPanel({
- job, locale, actionKey, error, onClose, onAction, onRequestEdit, onRequestDelete,
+ job, locale, actionKey, error, onAction, onRequestEdit, onRequestDelete,
}: {
job: SessionAutomationJob;
locale: string;
actionKey: string | null;
error: string | null;
- onClose: () => void;
onAction: (action: AutomationAction, job: SessionAutomationJob) => void | Promise<void>;
onRequestEdit: (job: SessionAutomationJob) => void;
onRequestDelete: (job: SessionAutomationJob) => void;
@@ -564,19 +489,16 @@ function AutomationDetailPanel({
return (
<>
- <DialogHeader className="shrink-0 px-6 pb-3 pt-5 text-left">
- <div className="flex items-center justify-between gap-3">
- <DialogTitle className="min-w-0 break-words leading-6">{job.name || job.id}</DialogTitle>
- <Button variant="ghost" size="sm" className="shrink-0 text-muted-foreground" onClick={onClose}>
- {tx("settings.automations.done", "Done")}
- </Button>
- </div>
+ <DialogHeader className="shrink-0 px-6 pb-3 pr-14 pt-5 text-left">
+ <DialogTitle className="min-w-0 break-words leading-6 text-balance">{job.name || job.id}</DialogTitle>
{canManage ? (
- <DialogDescription className="flex flex-wrap gap-x-3 gap-y-1 text-[13px] leading-5">
- <span>{formatAutomationSchedule(job, locale, tx)}</span>
- {timezone ? <span>{timezone}</span> : null}
- <span title={formatAutomationNextTitle(job, locale, tx)}>
- {formatAutomationNext(job, tx)}
+ <DialogDescription className="flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px] leading-5">
+ <span className="font-medium text-foreground/80">{formatAutomationSchedule(job, locale, tx)}</span>
+ <span className="inline-flex min-w-0 items-center gap-1.5">
+ <span>{tx("settings.automations.labels.next", "Next")}</span>
+ <span className="text-foreground/80" title={formatAutomationNextTitle(job, locale, tx)}>
+ {formatAutomationNext(job, tx)}
+ </span>
</span>
</DialogDescription>
) : null}
@@ -633,17 +555,12 @@ function AutomationDetailPanel({
</AutomationDetail>
{!job.protected ? (
<AutomationDetail label={tx("settings.automations.labels.origin", "Linked chat")}>
- {originHref ? (
- <a href={originHref} className="inline-flex min-w-0 max-w-full items-center gap-2 hover:text-foreground hover:underline">
- <span className="truncate">{origin}</span>
- <ChevronRight className="h-3.5 w-3.5 shrink-0" aria-hidden />
- </a>
- ) : origin}
+ <span className="block truncate" title={origin}>{origin}</span>
</AutomationDetail>
) : null}
</dl>
<Disclosure
- className="mt-3 border-t border-border/45 pt-1"
+ className="mt-2"
summaryClassName={cn("flex min-h-10 cursor-pointer items-center justify-between gap-3 rounded-control py-2.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground", formControlFocusClassName)}
summary={<>
{tx("settings.automations.moreDetails", "More details")}
@@ -651,6 +568,11 @@ function AutomationDetailPanel({
</>}
>
<dl>
+ {timezone && canManage ? (
+ <AutomationDetail label={tx("settings.automations.fields.timezone", "Timezone")}>
+ {timezone}
+ </AutomationDetail>
+ ) : null}
{job.delete_after_run ? <AutomationDetail label={tx("settings.automations.oneShot", "One-time")}>{tx("settings.automations.oneShotHint", "Removed after running")}</AutomationDetail> : null}
{job.created_at_ms ? <AutomationDetail label={tx("settings.automations.labels.created", "Created")}>{fmtDateTime(job.created_at_ms, locale)}</AutomationDetail> : null}
{job.updated_at_ms ? <AutomationDetail label={tx("settings.automations.labels.updated", "Updated")}>{fmtDateTime(job.updated_at_ms, locale)}</AutomationDetail> : null}
@@ -659,27 +581,29 @@ function AutomationDetailPanel({
</Disclosure>
</div>
{canManage ? (
- <div className="flex shrink-0 flex-wrap items-center gap-2 border-t border-border/45 px-6 py-3">
- <Button variant="ghost" size="sm" className="text-muted-foreground" disabled={busy || !canToggle} onClick={() => void onAction(job.enabled ? "disable" : "enable", job)}>
- {actionKey === `${job.enabled ? "disable" : "enable"}:${job.id}` ? <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" aria-hidden /> : null}
- {job.enabled ? tx("settings.automations.pause", "Pause") : tx("settings.automations.resume", "Resume")}
- </Button>
- {!localTrigger ? (
- <Button variant="ghost" size="sm" className="text-muted-foreground" disabled={!canRun || busy} onClick={() => void onAction("run", job)}>
- {actionKey === `run:${job.id}` ? <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" aria-hidden /> : null}
- {tx("settings.automations.runNow", "Run now")}
+ <div className="flex shrink-0 flex-col gap-2 border-t border-border/45 px-6 py-3 sm:flex-row sm:items-center">
+ <div className="flex min-w-0 flex-wrap items-center gap-1">
+ <Button variant="ghost" size="sm" className="text-muted-foreground" disabled={busy || !canToggle} onClick={() => void onAction(job.enabled ? "disable" : "enable", job)}>
+ {actionKey === `${job.enabled ? "disable" : "enable"}:${job.id}` ? <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" aria-hidden /> : null}
+ {job.enabled ? tx("settings.automations.pause", "Pause") : tx("settings.automations.resume", "Resume")}
</Button>
- ) : null}
- <Button
- variant="ghost"
- size="sm"
- className="text-destructive hover:bg-destructive/10 hover:text-destructive"
- disabled={busy}
- onClick={() => onRequestDelete(job)}
- >
- {tx("settings.automations.delete", "Delete")}
- </Button>
- <div className="ml-auto flex max-w-full flex-wrap justify-end gap-2">
+ {!localTrigger ? (
+ <Button variant="ghost" size="sm" className="text-muted-foreground" disabled={!canRun || busy} onClick={() => void onAction("run", job)}>
+ {actionKey === `run:${job.id}` ? <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" aria-hidden /> : null}
+ {tx("settings.automations.runNow", "Run now")}
+ </Button>
+ ) : null}
+ <Button
+ variant="ghost"
+ size="sm"
+ className="text-destructive hover:bg-destructive/10 hover:text-destructive"
+ disabled={busy}
+ onClick={() => onRequestDelete(job)}
+ >
+ {tx("settings.automations.delete", "Delete")}
+ </Button>
+ </div>
+ <div className="flex max-w-full flex-wrap justify-end gap-2 sm:ml-auto">
<Button variant="outline" size="sm" disabled={busy} onClick={() => onRequestEdit(job)}>
{tx("settings.automations.edit", "Edit")}
</Button>
@@ -723,7 +647,7 @@ function automationMessageNeedsExpansion(message: string): boolean {
function AutomationDetail({ label, title, children }: { label: string; title?: string; children: ReactNode }) {
return (
- <div className="grid min-w-0 grid-cols-[minmax(0,1fr)_minmax(0,1.7fr)] items-start gap-4 py-2.5 text-[13px] leading-5">
+ <div className="grid min-w-0 grid-cols-[minmax(6.5rem,0.75fr)_minmax(0,1.75fr)] items-start gap-4 py-2.5 text-[13px] leading-5">
<dt className="text-muted-foreground">{label}</dt>
<dd className="min-w-0 break-words text-right text-foreground [overflow-wrap:anywhere]" title={title}>{children}</dd>
</div>
@@ -1077,23 +1001,6 @@ function automationStatusKey(
return "active";
}
-function sortAutomationJobs(jobs: SessionAutomationJob[], sort: AutomationSort): SessionAutomationJob[] {
- const byName = (left: SessionAutomationJob, right: SessionAutomationJob) =>
- (left.name || left.id).localeCompare(right.name || right.id);
- return [...jobs].sort((left, right) => {
- if (sort === "name") return byName(left, right);
- if (sort === "last") {
- return (right.state.last_run_at_ms ?? 0) - (left.state.last_run_at_ms ?? 0) || byName(left, right);
- }
- if (sort === "updated") {
- return (right.updated_at_ms ?? 0) - (left.updated_at_ms ?? 0) || byName(left, right);
- }
- const leftNext = left.state.next_run_at_ms ?? Number.MAX_SAFE_INTEGER;
- const rightNext = right.state.next_run_at_ms ?? Number.MAX_SAFE_INTEGER;
- return leftNext - rightNext || byName(left, right);
- });
-}
-
function automationDraftFromJob(job: SessionAutomationJob | null): AutomationEditDraft {
const every = automationIntervalDraft(job?.schedule.every_ms ?? 3_600_000);
const scheduleKind = job?.schedule.kind === "at" || job?.schedule.kind === "cron"
@@ -1209,148 +1116,11 @@ function automationScheduleChanged(
return draft.atLocal !== formatLocalDateTimeInput(job.schedule.at_ms ?? NaN);
}
-type AutomationSearchField = "id" | "name" | "message" | "chat" | "cron" | "schedule" | "status";
-
-interface AutomationSearchToken {
- field: AutomationSearchField | null;
- value: string;
-}
-
-const AUTOMATION_SEARCH_FIELDS = new Set<AutomationSearchField>([
- "id",
- "name",
- "message",
- "chat",
- "cron",
- "schedule",
- "status",
-]);
-
const HOST_AUTOMATION_CHANNEL_LABELS: Record<string, string> = {
api: "API",
cli: "CLI",
};
-function parseAutomationSearchQuery(query: string): AutomationSearchToken[] {
- return (query.match(/[^\s:]+:"[^"]+"|"[^"]+"|\S+/g) ?? [])
- .map((rawPart): AutomationSearchToken | null => {
- const part = trimAutomationSearchValue(rawPart);
- if (!part) return null;
- const fieldMatch = part.match(/^([A-Za-z]+):(.*)$/);
- if (!fieldMatch) return { field: null, value: part.toLowerCase() };
- const field = fieldMatch[1].toLowerCase() as AutomationSearchField;
- const value = trimAutomationSearchValue(fieldMatch[2]).toLowerCase();
- if (!value) return null;
- return AUTOMATION_SEARCH_FIELDS.has(field)
- ? { field, value }
- : { field: null, value: part.toLowerCase() };
- })
- .filter((token): token is AutomationSearchToken => Boolean(token));
-}
-
-function trimAutomationSearchValue(value: string): string {
- return value.trim().replace(/^"|"$/g, "").trim();
-}
-
-function automationMatchesSearch(job: SessionAutomationJob, tokens: AutomationSearchToken[]): boolean {
- return tokens.every((token) => automationSearchText(job, token.field).includes(token.value));
-}
-
-function automationSearchText(job: SessionAutomationJob, field: AutomationSearchField | null = null): string {
- return automationSearchParts(job, field)
- .filter(Boolean)
- .join(" ")
- .toLowerCase();
-}
-
-function automationSearchParts(
- job: SessionAutomationJob,
- field: AutomationSearchField | null,
-): Array<string | number | null | undefined> {
- const originParts = automationOriginSearchParts(job);
- const scheduleParts = automationScheduleSearchParts(job);
- if (field === "id") return [job.id];
- if (field === "name") return [job.name, job.id];
- if (field === "message") return [job.payload.message, job.payload.command, job.trigger?.command];
- if (field === "chat") return originParts;
- if (field === "cron" || field === "schedule") return scheduleParts;
- if (field === "status") return [automationStatusKey(job), job.enabled ? "enabled" : "disabled"];
- return [
- job.id,
- job.name,
- job.payload.message,
- job.payload.command,
- job.trigger?.command,
- isLocalTriggerAutomation(job) ? "trigger local" : null,
- ...scheduleParts,
- automationStatusKey(job),
- ...originParts,
- ];
-}
-
-function automationOriginSearchParts(job: SessionAutomationJob): Array<string | null | undefined> {
- const origin = job.origin;
- if (!origin) return [];
- const channel = origin.channel.trim().toLowerCase();
- return [
- origin.session_key,
- origin.title,
- origin.preview,
- origin.channel,
- automationChannelDisplayName(channel),
- ];
-}
-
-function automationScheduleSearchParts(job: SessionAutomationJob): Array<string | number | null | undefined> {
- const schedule = job.schedule;
- const parts: Array<string | number | null | undefined> = [
- schedule.kind,
- schedule.expr,
- schedule.tz,
- schedule.every_ms,
- schedule.at_ms,
- ];
- if (schedule.kind === "cron" && schedule.expr) {
- parts.push(...automationCronSearchParts(schedule.expr));
- }
- return parts;
-}
-
-function automationCronSearchParts(expr: string): string[] {
- const parts = expr.trim().split(/\s+/);
- if (parts.length !== 5) return [];
- const [minute, hour, dayOfMonth, month, dayOfWeek] = parts;
- const everyDay = dayOfMonth === "*" && month === "*" && dayOfWeek === "*";
- const numericMinute = cronNumericToken(minute, 59);
- const numericHour = cronNumericToken(hour, 23);
- if (numericMinute === null) return [];
- const paddedMinute = String(numericMinute).padStart(2, "0");
-
- if (numericHour !== null) {
- const time = `${String(numericHour).padStart(2, "0")}:${paddedMinute}`;
- return [time, `:${paddedMinute}`];
- }
-
- if (everyDay && hour === "*") {
- return [`:${paddedMinute}`, `hourly at :${paddedMinute}`];
- }
-
- const range = /^(\d{1,2})-(\d{1,2})$/.exec(hour);
- if (!everyDay || !range) return [];
- const start = Number(range[1]);
- const end = Number(range[2]);
- if (start > 23 || end > 23) return [];
- const paddedRange = `${String(start).padStart(2, "0")}-${String(end).padStart(2, "0")}`;
- const rawRange = `${start}-${end}`;
- return [
- paddedRange,
- rawRange,
- `:${paddedMinute}`,
- `${paddedRange} at :${paddedMinute}`,
- `hourly ${paddedRange} at :${paddedMinute}`,
- ];
-}
-
function automationMatchesFilter(job: SessionAutomationJob, filter: AutomationFilter): boolean {
const status = automationStatusKey(job);
if (filter === "active") return status === "active" || status === "running";
@@ -1387,11 +1157,6 @@ function automationChannelLabel(
: channel;
}
-function automationChannelDisplayName(channel: string): string | undefined {
- const key = channel.trim().toLowerCase();
- return channelUiPresentation(key)?.displayName ?? HOST_AUTOMATION_CHANNEL_LABELS[key];
-}
-
function formatAutomationSchedule(
job: SessionAutomationJob,
locale: string,
diff --git a/webui/src/components/settings/system/useSystemSettingsState.ts b/webui/src/components/settings/system/useSystemSettingsState.ts
index 2add8f17e..fe79f9217 100644
--- a/webui/src/components/settings/system/useSystemSettingsState.ts
+++ b/webui/src/components/settings/system/useSystemSettingsState.ts
@@ -1,9 +1,6 @@
import { useRef, useState } from "react";
-import type {
- AutomationFilter,
- AutomationSort,
-} from "@/components/settings/system/AutomationsSettings";
+import type { AutomationFilter } from "@/components/settings/system/AutomationsSettings";
import {
DEFAULT_CUSTOM_MCP_FORM,
type AppsKindFilter,
@@ -53,9 +50,7 @@ export function useSystemSettingsState() {
const [apiServiceAction, setApiServiceAction] = useState<"start" | "stop" | null>(null);
const [apiServiceError, setApiServiceError] = useState<string | null>(null);
const [appsQuery, setAppsQuery] = useState("");
- const [automationsQuery, setAutomationsQuery] = useState("");
const [automationsFilter, setAutomationsFilter] = useState<AutomationFilter>("all");
- const [automationsSort, setAutomationsSort] = useState<AutomationSort>("next");
const [cliAppsMessage, setCliAppsMessage] = useState<string | null>(null);
const [cliAppsError, setCliAppsError] = useState<string | null>(null);
const [nanobotFeaturesError, setNanobotFeaturesError] = useState<string | null>(null);
@@ -87,8 +82,6 @@ export function useSystemSettingsState() {
automationsError,
automationsFilter,
automationsLoading,
- automationsQuery,
- automationsSort,
cliApps,
cliAppsAction,
cliAppsError,
@@ -130,8 +123,6 @@ export function useSystemSettingsState() {
setAutomationsError,
setAutomationsFilter,
setAutomationsLoading,
- setAutomationsQuery,
- setAutomationsSort,
setCliApps,
setCliAppsAction,
setCliAppsError,
diff --git a/webui/src/components/settings/useSettingsController.ts b/webui/src/components/settings/useSettingsController.ts
index ac05b4974..19cbdf536 100644
--- a/webui/src/components/settings/useSettingsController.ts
+++ b/webui/src/components/settings/useSettingsController.ts
@@ -116,7 +116,7 @@ export function useSettingsController({
const {
apiService, apiServiceAction, apiServiceError, apiServiceLoading, appsKindFilter, appsQuery,
automationAction, automationPendingDelete, automationPendingEdit, automations,
- automationsError, automationsFilter, automationsLoading, automationsQuery, automationsSort,
+ automationsError, automationsFilter, automationsLoading,
cliApps, cliAppsAction, cliAppsError, cliAppsFocusName, cliAppsLoading,
cliAppsMessage, customMcpForm, mcpConfigImport, mcpError, mcpFieldValues, mcpMessage,
mcpOAuthCallbackError, mcpOAuthCallbackUrl, mcpOAuthCompleting, mcpOAuthFlow,
@@ -124,7 +124,6 @@ export function useSettingsController({
nanobotFeatureConfirm, nanobotFeatures, nanobotFeaturesError, nanobotFeaturesLoading,
setAppsKindFilter, setAppsQuery, setAutomationPendingDelete,
setAutomationPendingEdit, setAutomationsFilter,
- setAutomationsQuery, setAutomationsSort,
setCliAppsError,
setCliAppsMessage, setCustomMcpForm, setMcpConfigImport, setMcpError, setMcpFieldValues,
setMcpMessage, setMcpOAuthCallbackError, setMcpOAuthCallbackUrl,
@@ -481,8 +480,6 @@ export function useSettingsController({
automationsError,
automationsFilter,
automationsLoading,
- automationsQuery,
- automationsSort,
beginModelPresetCreation,
cancelModelPresetCreation,
changeModelCallOrder,
@@ -579,8 +576,6 @@ export function useSettingsController({
setAutomationPendingDelete,
setAutomationPendingEdit,
setAutomationsFilter,
- setAutomationsQuery,
- setAutomationsSort,
setCliAppsError,
setCliAppsMessage,
setCustomMcpForm,
diff --git a/webui/src/components/thread/ThreadComposer.tsx b/webui/src/components/thread/ThreadComposer.tsx
index d2cfa2039..70d25a6b3 100644
--- a/webui/src/components/thread/ThreadComposer.tsx
+++ b/webui/src/components/thread/ThreadComposer.tsx
@@ -194,6 +194,7 @@ interface ThreadComposerProps {
disabled?: boolean;
placeholder?: string;
inputAriaLabel?: string;
+ compactWhenIdle?: boolean;
isStreaming?: boolean;
modelLabel?: string | null;
modelDetail?: string | null;
@@ -895,6 +896,7 @@ export function ThreadComposer({
disabled,
placeholder,
inputAriaLabel,
+ compactWhenIdle = false,
isStreaming = false,
modelLabel = null,
modelDetail = null,
@@ -936,6 +938,8 @@ export function ThreadComposer({
}: ThreadComposerProps) {
const { t } = useTranslation();
const [value, setValue] = useState("");
+ const [composerFocused, setComposerFocused] = useState(false);
+ const blurFrame = useRef<number | null>(null);
const [selectedSessionMentions, setSelectedSessionMentions] = useState<SessionMention[]>([]);
const [sessionDragPreview, setSessionDragPreview] = useState<{
mention: SessionMention;
@@ -1058,14 +1062,18 @@ export function ThreadComposer({
} = useClipboardAndDrop(addFiles);
useEffect(() => {
- if (interactionDisabled || hasTouchPrimaryPointer || (workspaceError && showProjectPicker)) {
+ if (compactWhenIdle || interactionDisabled || hasTouchPrimaryPointer || (workspaceError && showProjectPicker)) {
return;
}
const el = textareaRef.current;
if (!el) return;
const id = requestAnimationFrame(() => el.focus());
return () => cancelAnimationFrame(id);
- }, [hasTouchPrimaryPointer, interactionDisabled, showProjectPicker, workspaceError]);
+ }, [compactWhenIdle, hasTouchPrimaryPointer, interactionDisabled, showProjectPicker, workspaceError]);
+
+ useEffect(() => () => {
+ if (blurFrame.current !== null) cancelAnimationFrame(blurFrame.current);
+ }, []);
useEffect(() => {
if (!focusRequest || interactionDisabled) return;
@@ -2188,6 +2196,10 @@ export function ThreadComposer({
: t("thread.composer.voice.hint");
const showStopButton = isStreaming && !!onStop;
const relaxedHeroInput = isHero && images.length === 0 && !isStreaming;
+ const compactIdle = compactWhenIdle && !isHero && !composerFocused
+ && value.length === 0 && images.length === 0 && !inlineError
+ && !normalizedQuotedContext && !queuedPrompts.length && !goalState?.active
+ && !isDragging && !sessionDragPreview && !voiceRecorder.isRecording && !showProjectPicker;
const inputTextClasses = cn(
"w-full resize-none bg-transparent",
isHero
@@ -2201,6 +2213,20 @@ export function ThreadComposer({
return (
<form
ref={formRef}
+ onFocusCapture={() => {
+ if (!compactWhenIdle) return;
+ // Portaled model controls belong to this composer too: keep its layout
+ // stable while moving between the input, toolbar, and model picker.
+ if (blurFrame.current !== null) cancelAnimationFrame(blurFrame.current);
+ }}
+ onBlurCapture={() => {
+ if (!compactWhenIdle) return;
+ if (blurFrame.current !== null) cancelAnimationFrame(blurFrame.current);
+ blurFrame.current = requestAnimationFrame(() => {
+ blurFrame.current = null;
+ setComposerFocused(false);
+ });
+ }}
onSubmit={(e) => {
e.preventDefault();
submit();
@@ -2224,7 +2250,11 @@ export function ThreadComposer({
onDrop={(event) => {
if (!handleSessionDrop(event)) onDrop(event);
}}
- className={cn("relative w-full", isHero ? "px-0" : "px-1 pb-1.5 pt-1 sm:px-0")}
+ className={cn(
+ "relative w-full",
+ isHero ? "px-0" : "px-1 pb-1.5 pt-1 sm:px-0",
+ compactWhenIdle && "thread-composer-collapsible-layout",
+ )}
>
{showSlashMenu ? (
<SlashCommandPalette
@@ -2248,11 +2278,13 @@ export function ThreadComposer({
) : null}
<div
ref={surfaceRef}
+ data-compact={compactIdle || undefined}
className={cn(
"thread-composer-surface group/composer relative mx-auto flex w-full flex-col overflow-visible transition-all duration-200",
isHero
? "max-w-[58rem] rounded-prominent bg-muted/30 focus-within:bg-muted/50 dark:bg-card dark:focus-within:bg-white/[0.06]"
: "max-w-[49.5rem] rounded-panel bg-muted/30 focus-within:bg-muted/50 dark:bg-card dark:focus-within:bg-white/[0.06]",
+ compactWhenIdle && "thread-composer-collapsible transition-colors motion-reduce:transition-none",
interactionDisabled && "opacity-60",
sessionDragPreview && "ring-1 ring-primary/25",
isDragging && "ring-2 ring-primary/40 motion-reduce:ring-0 motion-reduce:border-primary",
@@ -2336,7 +2368,7 @@ export function ThreadComposer({
</div>
) : null}
<GoalStateStrip goalState={goalState} />
- <div className="relative">
+ <div className="thread-composer-input relative min-w-0">
{hasMentionDecorations ? (
<ComposerCliMentionOverlay
segments={displayMentionSegments}
@@ -2350,6 +2382,9 @@ export function ThreadComposer({
<textarea
ref={textareaRef}
value={value}
+ onFocus={() => {
+ if (compactWhenIdle) setComposerFocused(true);
+ }}
onChange={(e) => {
secondEnterPromptIdRef.current = null;
setValue(e.target.value);
diff --git a/webui/src/globals.css b/webui/src/globals.css
index 3830a6291..8c273b451 100644
--- a/webui/src/globals.css
+++ b/webui/src/globals.css
@@ -1031,6 +1031,71 @@
.automation-create-composer .thread-composer-surface {
max-inline-size: none;
}
+ .automation-calendar-toolbar {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) auto;
+ align-items: center;
+ gap: 0.75rem 1rem;
+ min-block-size: 4rem;
+ padding: 1rem;
+ }
+ .automation-calendar-navigation {
+ grid-column: 2;
+ grid-row: 1;
+ justify-self: end;
+ }
+ .automation-calendar-filters {
+ grid-column: 1 / -1;
+ grid-row: 2;
+ }
+ @container automations (max-width: 20rem) {
+ .automation-calendar-filters .segmented-control {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ inline-size: 100%;
+ border-radius: 1rem;
+ }
+ }
+ @container automations (min-width: 48rem) {
+ .automation-calendar-toolbar {
+ grid-template-columns: minmax(0, 1fr) auto auto;
+ padding-inline: 1.5rem;
+ }
+ .automation-calendar-filters {
+ grid-column: 2;
+ grid-row: 1;
+ }
+ .automation-calendar-navigation { grid-column: 3; }
+ }
+ .thread-composer-collapsible-layout {
+ container: composer-layout / inline-size;
+ }
+ @container composer-layout (min-width: 40rem) {
+ .thread-composer-collapsible[data-compact] {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) auto;
+ align-items: center;
+ }
+ .thread-composer-collapsible[data-compact] .thread-composer-input textarea {
+ display: block;
+ block-size: 3.5rem !important;
+ min-block-size: 3.5rem;
+ padding-block: 1.125rem;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .thread-composer-collapsible[data-compact] .thread-composer-footer {
+ padding: 0.5rem;
+ transition: none;
+ }
+ .thread-composer-collapsible[data-compact] .thread-composer-footer-primary {
+ flex: none;
+ }
+ .thread-composer-collapsible[data-compact] .thread-composer-footer-actions {
+ max-inline-size: none;
+ }
+ }
.automation-meta-row {
display: grid;
grid-template-columns: 1rem minmax(0, 1fr) auto;
@@ -1050,7 +1115,6 @@
.automation-calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, minmax(0, 1fr));
- border-block-end: 1px solid hsl(var(--border) / 0.6);
}
.automation-calendar-weekdays > div {
padding: 8px 10px;
diff --git a/webui/src/i18n/locales/en/common.json b/webui/src/i18n/locales/en/common.json
index 78a3c3cb2..d5641f438 100644
--- a/webui/src/i18n/locales/en/common.json
+++ b/webui/src/i18n/locales/en/common.json
@@ -1088,9 +1088,8 @@
"notEnabled": "Not enabled"
},
"automations": {
- "viewOptions": "Search and filter",
"create": "Create automation",
- "createPrompt": "Describe an automation, for example: summarize project updates every weekday at 9:00",
+ "createPrompt": "What would you like nanobot to schedule?",
"createInput": "Describe an automation",
"createRequest": "Create an automation for this request:\n\n{{request}}",
"errors": {
@@ -1103,8 +1102,8 @@
"planned": "Planned",
"recorded": "Recorded",
"more": "+{{count}} more",
- "noEntries": "No runs in this month.",
- "outsideMonth": "Without a date in this month"
+ "less": "Show less",
+ "noEntries": "No runs in this month."
},
"yourTasks": "Your automations",
"systemTasks": "System tasks",
@@ -1128,7 +1127,6 @@
"updated": "Updated",
"name": "Name"
},
- "search": "Search task, message, linked chat, or schedule",
"queue": "Queue",
"loading": "Loading automations...",
"noMatches": "No automations match this view.",
diff --git a/webui/src/i18n/locales/es/common.json b/webui/src/i18n/locales/es/common.json
index 66a812119..67f9f10d3 100644
--- a/webui/src/i18n/locales/es/common.json
+++ b/webui/src/i18n/locales/es/common.json
@@ -889,9 +889,8 @@
"notEnabled": "No activado"
},
"automations": {
- "viewOptions": "Buscar y filtrar",
"create": "Crear automatización",
- "createPrompt": "Describe una automatización, por ejemplo: resume las novedades del proyecto cada día laborable a las 9:00",
+ "createPrompt": "¿Qué te gustaría programar con nanobot?",
"createInput": "Describe una automatización",
"createRequest": "Crea una automatización para esta solicitud:\n\n{{request}}",
"errors": {
@@ -904,8 +903,8 @@
"planned": "Planificado",
"recorded": "Registrado",
"more": "+{{count}} más",
- "noEntries": "No hay ejecuciones este mes.",
- "outsideMonth": "Sin fecha en este mes"
+ "less": "Mostrar menos",
+ "noEntries": "No hay ejecuciones este mes."
},
"yourTasks": "Tus automatizaciones",
"systemTasks": "Tareas del sistema",
@@ -929,7 +928,6 @@
"updated": "Actualizada",
"name": "Nombre"
},
- "search": "Buscar tarea, mensaje, chat vinculado u horario",
"queue": "Cola",
"loading": "Cargando automatizaciones...",
"noMatches": "No hay automatizaciones que coincidan con esta vista.",
diff --git a/webui/src/i18n/locales/fr/common.json b/webui/src/i18n/locales/fr/common.json
index 3e046c5bb..582c60d30 100644
--- a/webui/src/i18n/locales/fr/common.json
+++ b/webui/src/i18n/locales/fr/common.json
@@ -888,9 +888,8 @@
"notEnabled": "Non activé"
},
"automations": {
- "viewOptions": "Rechercher et filtrer",
"create": "Créer une automatisation",
- "createPrompt": "Décrivez une automatisation, par exemple : résumer l’avancement du projet chaque jour ouvré à 9 h",
+ "createPrompt": "Que voulez-vous planifier avec nanobot ?",
"createInput": "Décrire une automatisation",
"createRequest": "Crée une automatisation pour cette demande :\n\n{{request}}",
"errors": {
@@ -903,8 +902,8 @@
"planned": "Planifié",
"recorded": "Enregistré",
"more": "+{{count}} de plus",
- "noEntries": "Aucune exécution ce mois-ci.",
- "outsideMonth": "Sans date ce mois-ci"
+ "less": "Afficher moins",
+ "noEntries": "Aucune exécution ce mois-ci."
},
"yourTasks": "Vos automatisations",
"systemTasks": "Tâches système",
@@ -928,7 +927,6 @@
"updated": "Mise à jour",
"name": "Nom"
},
- "search": "Rechercher tâche, message, discussion liée ou planning",
"queue": "File",
"loading": "Chargement des automatisations...",
"noMatches": "Aucune automatisation ne correspond à cette vue.",
diff --git a/webui/src/i18n/locales/id/common.json b/webui/src/i18n/locales/id/common.json
index 168813123..bae5d789a 100644
--- a/webui/src/i18n/locales/id/common.json
+++ b/webui/src/i18n/locales/id/common.json
@@ -888,9 +888,8 @@
"notEnabled": "Belum aktif"
},
"automations": {
- "viewOptions": "Cari dan filter",
"create": "Buat otomatisasi",
- "createPrompt": "Jelaskan otomatisasi, misalnya: rangkum perkembangan proyek setiap hari kerja pukul 09.00",
+ "createPrompt": "Apa yang ingin kamu jadwalkan dengan nanobot?",
"createInput": "Jelaskan otomatisasi",
"createRequest": "Buat otomatisasi untuk permintaan ini:\n\n{{request}}",
"errors": {
@@ -903,8 +902,8 @@
"planned": "Terjadwal",
"recorded": "Tercatat",
"more": "+{{count}} lainnya",
- "noEntries": "Tidak ada eksekusi bulan ini.",
- "outsideMonth": "Tanpa tanggal di bulan ini"
+ "less": "Tampilkan lebih sedikit",
+ "noEntries": "Tidak ada eksekusi bulan ini."
},
"yourTasks": "Otomatisasi Anda",
"systemTasks": "Tugas sistem",
@@ -928,7 +927,6 @@
"updated": "Diperbarui",
"name": "Nama"
},
- "search": "Cari tugas, pesan, chat terkait, atau jadwal",
"queue": "Antrean",
"loading": "Memuat otomasi...",
"noMatches": "Tidak ada otomasi yang cocok dengan tampilan ini.",
diff --git a/webui/src/i18n/locales/ja/common.json b/webui/src/i18n/locales/ja/common.json
index aba5e5a80..0ea25474a 100644
--- a/webui/src/i18n/locales/ja/common.json
+++ b/webui/src/i18n/locales/ja/common.json
@@ -888,9 +888,8 @@
"notEnabled": "無効"
},
"automations": {
- "viewOptions": "検索と絞り込み",
"create": "自動タスクを作成",
- "createPrompt": "作成する自動タスクを説明してください。例:平日の9時にプロジェクトの進捗を要約",
+ "createPrompt": "nanobot にいつ、何をしてほしいですか?",
"createInput": "自動タスクを説明",
"createRequest": "次の依頼に対する自動タスクを作成してください:\n\n{{request}}",
"errors": {
@@ -903,8 +902,8 @@
"planned": "予定",
"recorded": "実績",
"more": "ほか{{count}}件",
- "noEntries": "今月の実行はありません。",
- "outsideMonth": "今月の日付なし"
+ "less": "折りたたむ",
+ "noEntries": "今月の実行はありません。"
},
"yourTasks": "自分の自動化",
"systemTasks": "システムタスク",
@@ -928,7 +927,6 @@
"updated": "更新日時",
"name": "名前"
},
- "search": "タスク、メッセージ、関連チャット、予定を検索",
"queue": "キュー",
"loading": "自動タスクを読み込み中...",
"noMatches": "この表示に一致する自動タスクはありません。",
diff --git a/webui/src/i18n/locales/ko/common.json b/webui/src/i18n/locales/ko/common.json
index e512e3153..023ff2d8a 100644
--- a/webui/src/i18n/locales/ko/common.json
+++ b/webui/src/i18n/locales/ko/common.json
@@ -888,9 +888,8 @@
"notEnabled": "비활성화됨"
},
"automations": {
- "viewOptions": "검색 및 필터",
"create": "자동화 만들기",
- "createPrompt": "만들 자동화를 설명하세요. 예: 평일 오전 9시에 프로젝트 진행 상황 요약",
+ "createPrompt": "nanobot이 언제 무엇을 해주면 좋을까요?",
"createInput": "자동화 설명",
"createRequest": "다음 요청에 맞는 자동화를 만들어 주세요:\n\n{{request}}",
"errors": {
@@ -903,8 +902,8 @@
"planned": "예정",
"recorded": "기록",
"more": "+{{count}}개 더",
- "noEntries": "이번 달 실행 기록이 없습니다.",
- "outsideMonth": "이번 달 날짜 없음"
+ "less": "접기",
+ "noEntries": "이번 달 실행 기록이 없습니다."
},
"yourTasks": "내 자동화",
"systemTasks": "시스템 작업",
@@ -928,7 +927,6 @@
"updated": "업데이트",
"name": "이름"
},
- "search": "작업, 메시지, 연결된 채팅 또는 일정 검색",
"queue": "대기열",
"loading": "자동화를 불러오는 중...",
"noMatches": "이 보기와 일치하는 자동화가 없습니다.",
diff --git a/webui/src/i18n/locales/pt-BR/common.json b/webui/src/i18n/locales/pt-BR/common.json
index f8e6c28a9..04134cb94 100644
--- a/webui/src/i18n/locales/pt-BR/common.json
+++ b/webui/src/i18n/locales/pt-BR/common.json
@@ -902,9 +902,8 @@
"notEnabled": "Não habilitado"
},
"automations": {
- "viewOptions": "Buscar e filtrar",
"create": "Criar automação",
- "createPrompt": "Descreva uma automação, por exemplo: resumir o andamento do projeto todo dia útil às 9:00",
+ "createPrompt": "O que você gostaria de agendar com o nanobot?",
"createInput": "Descreva uma automação",
"createRequest": "Crie uma automação para esta solicitação:\n\n{{request}}",
"errors": {
@@ -917,8 +916,8 @@
"planned": "Planejado",
"recorded": "Registrado",
"more": "+{{count}} mais",
- "noEntries": "Nenhuma execução neste mês.",
- "outsideMonth": "Sem data neste mês"
+ "less": "Mostrar menos",
+ "noEntries": "Nenhuma execução neste mês."
},
"yourTasks": "Suas automações",
"systemTasks": "Tarefas do sistema",
@@ -942,7 +941,6 @@
"updated": "Atualizada",
"name": "Nome"
},
- "search": "Buscar tarefa, mensagem, conversa vinculada ou agendamento",
"queue": "Fila",
"loading": "Carregando automações...",
"noMatches": "Nenhuma automação corresponde a esta visualização.",
diff --git a/webui/src/i18n/locales/vi/common.json b/webui/src/i18n/locales/vi/common.json
index 291bfdb9f..09c0cfe9e 100644
--- a/webui/src/i18n/locales/vi/common.json
+++ b/webui/src/i18n/locales/vi/common.json
@@ -888,9 +888,8 @@
"notEnabled": "Chưa bật"
},
"automations": {
- "viewOptions": "Tìm kiếm và lọc",
"create": "Tạo tự động hóa",
- "createPrompt": "Mô tả tác vụ tự động, ví dụ: tóm tắt tiến độ dự án lúc 9:00 mỗi ngày làm việc",
+ "createPrompt": "Bạn muốn nanobot làm gì theo lịch?",
"createInput": "Mô tả tác vụ tự động",
"createRequest": "Tạo một tác vụ tự động cho yêu cầu này:\n\n{{request}}",
"errors": {
@@ -903,8 +902,8 @@
"planned": "Đã lên lịch",
"recorded": "Đã ghi nhận",
"more": "+{{count}} mục khác",
- "noEntries": "Không có lần chạy nào trong tháng này.",
- "outsideMonth": "Không có ngày trong tháng này"
+ "less": "Thu gọn",
+ "noEntries": "Không có lần chạy nào trong tháng này."
},
"yourTasks": "Tác vụ tự động của bạn",
"systemTasks": "Tác vụ hệ thống",
@@ -928,7 +927,6 @@
"updated": "Đã cập nhật",
"name": "Tên"
},
- "search": "Tìm tác vụ, tin nhắn, cuộc trò chuyện liên kết hoặc lịch",
"queue": "Hàng đợi",
"loading": "Đang tải tự động hóa...",
"noMatches": "Không có tự động hóa phù hợp với chế độ xem này.",
diff --git a/webui/src/i18n/locales/zh-CN/common.json b/webui/src/i18n/locales/zh-CN/common.json
index 84dc19c4f..f7f56ba4f 100644
--- a/webui/src/i18n/locales/zh-CN/common.json
+++ b/webui/src/i18n/locales/zh-CN/common.json
@@ -1088,9 +1088,8 @@
"notEnabled": "未启用"
},
"automations": {
- "viewOptions": "搜索与筛选",
"create": "创建自动任务",
- "createPrompt": "描述要创建的自动任务,例如:每个工作日 9:00 汇总项目进展",
+ "createPrompt": "想让 nanobot 定时帮你做什么?",
"createInput": "描述一个自动任务",
"createRequest": "请为以下需求创建自动任务:\n\n{{request}}",
"errors": {
@@ -1103,8 +1102,8 @@
"planned": "计划运行",
"recorded": "实际记录",
"more": "还有 {{count}} 项",
- "noEntries": "本月没有运行记录。",
- "outsideMonth": "本月没有日期的任务"
+ "less": "收起",
+ "noEntries": "本月没有运行记录。"
},
"yourTasks": "你的自动任务",
"systemTasks": "系统任务",
@@ -1128,7 +1127,6 @@
"updated": "更新时间",
"name": "名称"
},
- "search": "搜索任务、消息、关联会话或计划",
"queue": "任务队列",
"loading": "正在加载自动任务...",
"noMatches": "当前视图没有匹配的自动任务。",
diff --git a/webui/src/i18n/locales/zh-TW/common.json b/webui/src/i18n/locales/zh-TW/common.json
index d4bb451e3..fe2806e86 100644
--- a/webui/src/i18n/locales/zh-TW/common.json
+++ b/webui/src/i18n/locales/zh-TW/common.json
@@ -888,9 +888,8 @@
"notEnabled": "未啟用"
},
"automations": {
- "viewOptions": "搜尋與篩選",
"create": "建立自動任務",
- "createPrompt": "描述要建立的自動任務,例如:每個工作日 9:00 彙整專案進度",
+ "createPrompt": "想讓 nanobot 定時幫你做什麼?",
"createInput": "描述自動任務",
"createRequest": "請為以下需求建立自動任務:\n\n{{request}}",
"errors": {
@@ -903,8 +902,8 @@
"planned": "預定執行",
"recorded": "實際記錄",
"more": "另有 {{count}} 項",
- "noEntries": "本月沒有執行記錄。",
- "outsideMonth": "本月沒有日期的任務"
+ "less": "收合",
+ "noEntries": "本月沒有執行記錄。"
},
"yourTasks": "你的自動任務",
"systemTasks": "系統任務",
@@ -928,7 +927,6 @@
"updated": "更新時間",
"name": "名稱"
},
- "search": "搜尋任務、訊息、關聯對話或排程",
"queue": "任務佇列",
"loading": "正在載入自動任務…",
"noMatches": "目前沒有符合條件的自動任務。",
diff --git a/webui/src/tests/app-layout.test.tsx b/webui/src/tests/app-layout.test.tsx
index 30a234b7c..3253949ea 100644
--- a/webui/src/tests/app-layout.test.tsx
+++ b/webui/src/tests/app-layout.test.tsx
@@ -67,6 +67,11 @@ function mockFetchRoutes(routes: Record<string, unknown>): void {
);
}
+function currentMonthTimestamp(day: number, hour = 10, minute = 0): number {
+ const now = new Date();
+ return new Date(now.getFullYear(), now.getMonth(), day, hour, minute).getTime();
+}
+
function baseSettingsPayload() {
return {
agent: {
@@ -1380,7 +1385,7 @@ describe("App layout", () => {
kind: "agent_turn",
},
state: {
- next_run_at_ms: Date.UTC(2026, 3, 17, 10, 0, 0),
+ next_run_at_ms: currentMonthTimestamp(17),
last_status: "ok",
pending: false,
run_history: [],
@@ -1405,7 +1410,7 @@ describe("App layout", () => {
kind: "agent_turn",
},
state: {
- next_run_at_ms: Date.UTC(2026, 3, 17, 11, 30, 0),
+ next_run_at_ms: currentMonthTimestamp(17, 11, 30),
last_status: "ok",
pending: false,
run_history: [],
@@ -1440,22 +1445,30 @@ describe("App layout", () => {
fireEvent.click(automationsButton);
- const heading = await screen.findByRole("heading", { name: "Automations" });
+ const heading = await screen.findByRole(
+ "heading",
+ { name: "Automations" },
+ { timeout: 5_000 },
+ );
expect(heading).toBeInTheDocument();
const automationsMain = heading.closest("main");
expect(automationsMain).not.toBeNull();
expect(within(automationsMain as HTMLElement).queryByText("Settings")).not.toBeInTheDocument();
- expect(screen.getAllByText("Daily repo check").length).toBeGreaterThanOrEqual(1);
+ expect((await screen.findAllByText(
+ "Daily repo check",
+ {},
+ { timeout: 5_000 },
+ )).length).toBeGreaterThanOrEqual(1);
expect(screen.queryByText("Check the repo status")).not.toBeInTheDocument();
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: /Daily repo check/ }));
expect(within(screen.getByRole("dialog", { name: "Daily repo check" })).getByText("Check the repo status")).toBeVisible();
expect(screen.getAllByText("Release prep").length).toBeGreaterThanOrEqual(1);
- fireEvent.click(screen.getByRole("button", { name: "Done", exact: true }));
+ fireEvent.click(screen.getByRole("button", { name: "Close", exact: true }));
expect(screen.getByText("WeChat quiz")).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: /WeChat quiz/ }));
expect(screen.getByText("WeChat")).toBeInTheDocument();
- fireEvent.click(screen.getByRole("button", { name: "Done", exact: true }));
+ fireEvent.click(screen.getByRole("button", { name: "Close", exact: true }));
expect(screen.queryByText("weixin:wx-chat")).not.toBeInTheDocument();
expect(screen.queryByText("memory with dream state")).not.toBeInTheDocument();
expect(screen.getByRole("button", { name: /heartbeat/ })).toBeVisible();
@@ -1467,16 +1480,6 @@ describe("App layout", () => {
);
expect(document.title).toBe("Automations · nanobot");
- const searchInput = within(automationsMain as HTMLElement).getByPlaceholderText(
- "Search task, message, linked chat, or schedule",
- );
- fireEvent.change(searchInput, { target: { value: "WeChat" } });
- await waitFor(() => expect(screen.queryByText("Daily repo check")).not.toBeInTheDocument());
- expect(screen.getAllByText("WeChat quiz").length).toBeGreaterThanOrEqual(1);
-
- fireEvent.change(searchInput, { target: { value: "09-23" } });
- await waitFor(() => expect(screen.queryByText("Daily repo check")).not.toBeInTheDocument());
- expect(screen.getAllByText("WeChat quiz").length).toBeGreaterThanOrEqual(1);
});
it("keeps automation linked-chat titles in sync with live sidebar renames", async () => {
@@ -1498,7 +1501,8 @@ describe("App layout", () => {
"/api/webui/automations": { jobs: [{
id: "reminder", name: "Drink water", enabled: true,
schedule: { kind: "every", every_ms: 60_000 },
- payload: { message: "Take a break" }, state: {},
+ payload: { message: "Take a break" },
+ state: { next_run_at_ms: currentMonthTimestamp(17) },
origin: { session_key: key, channel: "websocket", chat_id: "linked-chat",
title: "Stored title", preview: "Original preview" },
}] },
@@ -1509,7 +1513,8 @@ describe("App layout", () => {
fireEvent.click(within(sidebar).getByRole("button", { name: "Automations" }));
fireEvent.click(await screen.findByRole("button", { name: /Drink water/ }));
const dialog = screen.getByRole("dialog", { name: "Drink water" });
- expect(within(dialog).getByRole("link", { name: "推特大战场" })).toHaveAttribute(
+ expect(within(dialog).getByText("推特大战场")).toBeVisible();
+ expect(within(dialog).getByRole("link", { name: "Open a chat" })).toHaveAttribute(
"href", "#/chat/websocket%3Alinked-chat",
);
for (const title of ["新会话名称", ""]) {
@@ -1520,9 +1525,7 @@ describe("App layout", () => {
});
const expected = title || "Stored title";
expect(within(sidebar).getByText(expected)).toBeInTheDocument();
- expect(within(dialog).getByRole("link", { name: expected })).toHaveAttribute(
- "href", "#/chat/websocket%3Alinked-chat",
- );
+ expect(within(dialog).getByText(expected)).toBeVisible();
}
expect(requestMutationSpy).not.toHaveBeenCalled();
});
@@ -1541,6 +1544,7 @@ describe("App layout", () => {
},
state: {
next_run_at_ms: null,
+ last_run_at_ms: currentMonthTimestamp(12),
last_status: "ok",
pending: false,
run_history: [],
@@ -1613,12 +1617,12 @@ describe("App layout", () => {
"The full content should remain available without forcing the user into a small nested scroll area.",
].join("\n");
const history = [
- { run_at_ms: Date.UTC(2026, 3, 12, 10, 0, 0), status: "error", duration_ms: 900, error: "oldest failure" },
- { run_at_ms: Date.UTC(2026, 3, 13, 10, 0, 0), status: "error", duration_ms: 800, error: "second oldest failure" },
- { run_at_ms: Date.UTC(2026, 3, 14, 10, 0, 0), status: "ok", duration_ms: 700 },
- { run_at_ms: Date.UTC(2026, 3, 15, 10, 0, 0), status: "ok", duration_ms: 600 },
- { run_at_ms: Date.UTC(2026, 3, 16, 10, 0, 0), status: "ok", duration_ms: 500 },
- { run_at_ms: Date.UTC(2026, 3, 17, 10, 0, 0), status: "ok", duration_ms: 400 },
+ { run_at_ms: currentMonthTimestamp(12), status: "error", duration_ms: 900, error: "oldest failure" },
+ { run_at_ms: currentMonthTimestamp(13), status: "error", duration_ms: 800, error: "second oldest failure" },
+ { run_at_ms: currentMonthTimestamp(14), status: "ok", duration_ms: 700 },
+ { run_at_ms: currentMonthTimestamp(15), status: "ok", duration_ms: 600 },
+ { run_at_ms: currentMonthTimestamp(16), status: "ok", duration_ms: 500 },
+ { run_at_ms: currentMonthTimestamp(17), status: "ok", duration_ms: 400 },
];
mockFetchRoutes({
"/api/settings": baseSettingsPayload(),
@@ -1636,7 +1640,7 @@ describe("App layout", () => {
kind: "agent_turn",
},
state: {
- next_run_at_ms: Date.UTC(2026, 3, 18, 10, 0, 0),
+ next_run_at_ms: currentMonthTimestamp(18),
last_status: "ok",
pending: false,
run_history: history,
@@ -1659,7 +1663,11 @@ describe("App layout", () => {
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
fireEvent.click(within(sidebar).getByRole("button", { name: "Automations" }));
- fireEvent.click(await screen.findByRole("button", { name: /Long detail automation/ }));
+ fireEvent.click(await screen.findByRole(
+ "button",
+ { name: /Long detail automation.*Planned/ },
+ { timeout: 5_000 },
+ ));
const detailPanel = await screen.findByRole("dialog", { name: "Long detail automation" });
const message = Array.from(detailPanel.querySelectorAll("section p")).find(
(node) => node.textContent === longMessage,
@@ -1697,13 +1705,13 @@ describe("App layout", () => {
kind: "agent_turn",
},
state: {
- next_run_at_ms: Date.UTC(2026, 3, 17, 10, 0, 0),
- last_run_at_ms: Date.UTC(2026, 3, 16, 10, 0, 0),
+ next_run_at_ms: currentMonthTimestamp(17),
+ last_run_at_ms: currentMonthTimestamp(16),
last_status: "ok",
pending: false,
run_history: [
{
- run_at_ms: Date.UTC(2026, 3, 16, 10, 0, 0),
+ run_at_ms: currentMonthTimestamp(16),
status: "ok",
duration_ms: 500,
},
@@ -1735,7 +1743,7 @@ describe("App layout", () => {
expect(screen.queryByText("任务队列")).not.toBeInTheDocument();
expect(screen.getAllByText("每日检查").length).toBeGreaterThanOrEqual(1);
expect(screen.queryByText("检查仓库状态")).not.toBeInTheDocument();
- fireEvent.click(screen.getByRole("button", { name: /每日检查/ }));
+ fireEvent.click(screen.getByRole("button", { name: /每日检查.*计划运行/ }));
const detail = within(screen.getByRole("dialog", { name: "每日检查" }));
expect(detail.getByText("检查仓库状态")).toBeVisible();
expect(detail.getByText(/每 1天/)).toBeInTheDocument();
diff --git a/webui/src/tests/automations-settings.test.tsx b/webui/src/tests/automations-settings.test.tsx
index 461e3800b..c14b8d40e 100644
--- a/webui/src/tests/automations-settings.test.tsx
+++ b/webui/src/tests/automations-settings.test.tsx
@@ -4,7 +4,7 @@ import userEvent from "@testing-library/user-event";
import { afterEach, beforeEach, describe, expect, it, onTestFinished, vi } from "vitest";
import { AutomationDeleteDialog, AutomationEditDialog, AutomationsSettings } from "@/components/settings/system/AutomationsSettings";
-import type { AutomationFilter, AutomationSort } from "@/components/settings/system/AutomationsSettings";
+import type { AutomationFilter } from "@/components/settings/system/AutomationsSettings";
import i18n from "@/i18n";
import type { SessionAutomationJob, SettingsPayload } from "@/lib/types";
@@ -39,13 +39,11 @@ type Props = Partial<React.ComponentProps<typeof AutomationsSettings>>;
const SYSTEM_TASKS_OPEN_STORAGE_KEY = "nanobot-webui.automation-system-tasks-open";
function Harness({ payload = { jobs: [task, systemTask] }, ...props }: Props) {
- const [query, setQuery] = useState("");
const [filter, setFilter] = useState<AutomationFilter>("all");
- const [sort, setSort] = useState<AutomationSort>("next");
return <AutomationsSettings
- payload={payload} loading={false} query={query} filter={filter} sort={sort}
- actionKey={null} error={null} onQueryChange={setQuery} onFilterChange={setFilter}
- onSortChange={setSort} onAction={() => {}} onRequestEdit={() => {}}
+ payload={payload} loading={false} filter={filter}
+ actionKey={null} error={null} onFilterChange={setFilter}
+ onAction={() => {}} onRequestEdit={() => {}}
onRequestDelete={() => {}} {...props}
/>;
}
@@ -90,16 +88,6 @@ describe("Automation task list and detail sheet", () => {
expect(window.localStorage.getItem(SYSTEM_TASKS_OPEN_STORAGE_KEY)).toBe("true");
});
- it("does not replace a remembered collapse when search reveals system tasks", () => {
- window.localStorage.setItem(SYSTEM_TASKS_OPEN_STORAGE_KEY, "false");
- const view = render(<Harness query="heartbeat" />);
- expect(screen.getByRole("button", { name: /heartbeat/ })).toBeVisible();
- expect(window.localStorage.getItem(SYSTEM_TASKS_OPEN_STORAGE_KEY)).toBe("false");
- view.unmount();
- render(<Harness />);
- expect(screen.getByRole("button", { name: "System tasks 1" })).toHaveAttribute("aria-expanded", "false");
- });
-
it("keeps the system toggle usable when browser storage is unavailable", () => {
vi.spyOn(window.localStorage, "getItem").mockImplementation(() => { throw new Error("Blocked"); });
vi.spyOn(window.localStorage, "setItem").mockImplementation(() => { throw new Error("Blocked"); });
@@ -112,7 +100,7 @@ describe("Automation task list and detail sheet", () => {
expect(toggle).toHaveAttribute("aria-expanded", "true");
});
- it.each(["Done", "Escape", "removed", "Edit", "Edit removed"])("finishes the detail exit before cleanup and handoff: %s", async (action) => {
+ it.each(["Close", "Escape", "removed", "Edit", "Edit removed"])("finishes the detail exit before cleanup and handoff: %s", async (action) => {
// Happy DOM has no CSS animations. Give Radix live animation names so its
// real presence lifecycle runs, including the outer portal's ref boundary.
const getStyle = window.getComputedStyle.bind(window);
@@ -159,7 +147,8 @@ describe("Automation task list and detail sheet", () => {
const user = userEvent.setup();
render(<Harness />);
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
- expect(screen.getByRole("textbox")).toBeVisible();
+ expect(screen.getByRole("group", { name: "Automations" })).toBeVisible();
+ expect(screen.queryByRole("textbox")).not.toBeInTheDocument();
expect(screen.getByRole("button", { name: /^Active/ })).toBeVisible();
expect(screen.getByRole("button", { name: /heartbeat/ })).toBeVisible();
expect(screen.queryByRole("button", { name: "Create in chat" })).not.toBeInTheDocument();
@@ -172,7 +161,7 @@ describe("Automation task list and detail sheet", () => {
"href", "#/chat/websocket%3Ademo",
);
expect(within(dialog).getByRole("button", { name: "More details" })).toHaveAttribute("aria-expanded", "false");
- await user.click(within(dialog).getByRole("button", { name: "Done" }));
+ await user.click(within(dialog).getByRole("button", { name: "Close" }));
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
expect(row).toHaveFocus();
await user.keyboard("{Enter}");
@@ -206,6 +195,70 @@ describe("Automation task list and detail sheet", () => {
);
});
+ it("opens the whole day in a popover and hands off to details without expanding the grid", async () => {
+ const user = userEvent.setup();
+ const crowded = Array.from({ length: 5 }, (_, index): SessionAutomationJob => ({
+ ...task,
+ id: `crowded-${index + 1}`,
+ name: `Crowded ${index + 1}`,
+ state: { next_run_at_ms: now + 540_000 },
+ }));
+ render(<Harness payload={{ jobs: crowded }} />);
+
+ const more = screen.getByRole("button", { name: "+2 more" });
+ const day = more.closest(".automation-calendar-day")!;
+ const dayLabel = day.getAttribute("aria-label")!;
+
+ await user.click(more);
+ const popover = screen.getByRole("dialog", { name: dayLabel });
+ expect(within(popover).getAllByRole("button", { name: /Crowded.*Planned/ })).toHaveLength(5);
+ expect(within(day as HTMLElement).getAllByRole("button", { name: /Crowded.*Planned/ })).toHaveLength(3);
+ expect(more).toHaveAttribute("aria-expanded", "true");
+ await user.keyboard("{Escape}");
+ await waitFor(() => expect(more).toHaveFocus());
+ expect(screen.queryByRole("button", { name: /Crowded 4.*Planned/ })).not.toBeInTheDocument();
+
+ await user.click(more);
+ await user.click(within(screen.getByRole("dialog", { name: dayLabel })).getByRole("button", { name: /Crowded 4.*Planned/ }));
+ const detail = await screen.findByRole("dialog", { name: "Crowded 4" });
+ expect(screen.queryByRole("dialog", { name: dayLabel })).not.toBeInTheDocument();
+ expect(within(detail).getByRole("link", { name: "Open a chat" })).toBeVisible();
+ await user.click(within(detail).getByRole("button", { name: "Close" }));
+ await waitFor(() => expect(more).toHaveFocus());
+ });
+
+ it("keeps the calendar and filters available when a status has no matches", async () => {
+ const user = userEvent.setup();
+ render(<Harness payload={{ jobs: [task] }} />);
+ const month = screen.getByRole("heading", { level: 2 });
+ await user.click(screen.getByRole("button", { name: "Paused 0" }));
+ expect(month).toBeVisible();
+ expect(screen.queryByRole("button", { name: /PR watch.*Planned/ })).not.toBeInTheDocument();
+ await user.click(screen.getByRole("button", { name: "All 1" }));
+ expect(screen.getByRole("button", { name: /PR watch.*Planned/ })).toBeVisible();
+ });
+
+ it("keeps creation compact until focused and preserves an unfocused draft", async () => {
+ const user = userEvent.setup();
+ render(<Harness onStartChat={vi.fn()} settingsSnapshot={modelSettings} />);
+ const input = screen.getByRole("textbox", { name: "Describe an automation" });
+ const surface = input.closest(".thread-composer-surface")!;
+ expect(input).not.toHaveFocus();
+ expect(surface).toHaveAttribute("data-compact", "true");
+ await user.click(input);
+ expect(surface).not.toHaveAttribute("data-compact");
+ await user.type(input, "Review this project every Monday");
+ await user.click(screen.getByRole("button", { name: "Today" }));
+ expect(input).toHaveValue("Review this project every Monday");
+ expect(surface).not.toHaveAttribute("data-compact");
+ await user.clear(input);
+ await user.click(screen.getByRole("button", { name: "Today" }));
+ await waitFor(() => expect(surface).toHaveAttribute("data-compact", "true"));
+ await user.click(screen.getByRole("button", { name: "fast" }));
+ expect(screen.getByRole("dialog", { name: "Switch model for this chat" })).toBeVisible();
+ expect(surface).toHaveAttribute("data-compact", "true");
+ });
+
it("starts an automation conversation from the inline composer without opening a dialog", async () => {
const user = userEvent.setup();
const onStartChat = vi.fn().mockResolvedValue(true);
@@ -268,16 +321,28 @@ describe("Automation task list and detail sheet", () => {
render(<Harness payload={{ jobs: [] }} onStartChat={() => {}} settingsSnapshot={modelSettings} />);
expect(screen.getByRole("textbox", { name: "Describe an automation" })).toHaveAttribute(
"placeholder",
- "Describe an automation, for example: summarize project updates every weekday at 9:00",
+ "What would you like nanobot to schedule?",
);
});
- it("keeps a text-only empty state when only system tasks exist", () => {
+ it("uses a short, conversational Chinese creation prompt", async () => {
+ await act(() => i18n.changeLanguage("zh-CN"));
+ render(<Harness payload={{ jobs: [] }} onStartChat={() => {}} settingsSnapshot={modelSettings} />);
+ expect(screen.getByRole("textbox", { name: "描述一个自动任务" })).toHaveAttribute(
+ "placeholder", "想让 nanobot 定时帮你做什么?",
+ );
+ });
+
+ it("keeps the complete month grid visible when no personal automations exist", () => {
render(<Harness payload={{ jobs: [systemTask] }} />);
- expect(screen.getByText("No automations yet.")).toBeVisible();
+ expect(screen.queryByText("No automations yet.")).not.toBeInTheDocument();
+ const calendar = document.querySelector(".automation-calendar")!;
+ expect(calendar.querySelector(".automation-calendar-grid")).toBeInTheDocument();
+ expect(calendar.querySelectorAll(".automation-calendar-weekdays > div")).toHaveLength(7);
+ expect(calendar.querySelectorAll(".automation-calendar-day").length).toBeGreaterThanOrEqual(35);
expect(screen.queryByRole("button", { name: "Create in chat" })).not.toBeInTheDocument();
expect(screen.queryByRole("button", { name: "Open a chat" })).not.toBeInTheDocument();
- expect(screen.getByRole("region", { name: "Search and filter" })).toBeVisible();
+ expect(screen.getByRole("group", { name: "Automations" })).toBeVisible();
fireEvent.click(screen.getByRole("button", { name: /heartbeat/ }));
const dialog = screen.getByRole("dialog", { name: "heartbeat" });
expect(within(dialog).queryByRole("button", { name: "Edit" })).not.toBeInTheDocument();
@@ -288,7 +353,7 @@ describe("Automation task list and detail sheet", () => {
it("distinguishes a finished one-time task from a task with no scheduled run", () => {
render(<Harness payload={{ jobs: [{ ...task, delete_after_run: true,
- state: { last_status: "ok", next_run_at_ms: null } }] }} />);
+ state: { last_status: "ok", last_run_at_ms: now - 60_000, next_run_at_ms: null } }] }} />);
expect(screen.getByRole("button", { name: /PR watch.*Completed/ })).toBeVisible();
expect(screen.queryByText("No next run")).not.toBeInTheDocument();
});
@@ -310,7 +375,7 @@ describe("Automation task list and detail sheet", () => {
expect(within(dialog).getByText("Every 30 minutes")).toBeVisible();
expect(within(dialog).getByText("Not run yet")).toBeVisible();
expect(within(dialog).getAllByRole("button")).toHaveLength(2);
- expect(within(dialog).getByRole("button", { name: "Done" })).toHaveClass("rounded-control", "h-9");
+ expect(within(dialog).getByRole("button", { name: "Close" })).toHaveClass("rounded-full", "h-7", "w-7");
const toggle = within(dialog).getByRole("button", { name: "More details" });
const metadata = document.getElementById(toggle.getAttribute("aria-controls")!)!;
expect(metadata).toHaveAttribute("data-state", "closed");
@@ -346,22 +411,42 @@ describe("Automation task list and detail sheet", () => {
const title = within(dialog).getByRole("heading", { name: job.name });
expect(title).toHaveClass("text-lg", "leading-6");
expect(title).not.toHaveClass("text-[22px]");
- const done = within(dialog).getByRole("button", { name: "Done" });
- expect(done).toHaveClass("rounded-control", "h-9");
- expect(done).not.toHaveClass("rounded-full");
+ const close = within(dialog).getByRole("button", { name: "Close" });
+ expect(close).toHaveClass("rounded-full", "h-7", "w-7");
const lastRun = within(dialog).getByText("Last run");
expect(lastRun.closest("dl")).not.toHaveClass("divide-y", "border-y");
expect(lastRun.parentElement).toHaveClass("py-2.5");
const details = within(dialog).getByRole("button", { name: "More details" });
- expect(details.parentElement).toHaveClass("border-t");
+ expect(details.parentElement).not.toHaveClass("border-t");
expect(details).toHaveAttribute("aria-expanded", "false");
if (!job.protected) {
+ const taskActions = within(dialog).getByRole("button", { name: "Pause" }).parentElement;
+ expect(within(dialog).getByRole("button", { name: "Run now" }).parentElement).toBe(taskActions);
+ expect(within(dialog).getByRole("button", { name: "Delete" }).parentElement).toBe(taskActions);
const edit = within(dialog).getByRole("button", { name: "Edit" });
- expect(edit.parentElement).toHaveClass("ml-auto", "flex-wrap", "justify-end");
+ expect(edit.parentElement).toHaveClass("sm:ml-auto", "flex-wrap", "justify-end");
expect(within(dialog).getByRole("link", { name: "Open a chat" }).parentElement).toBe(edit.parentElement);
}
});
+ it("keeps the header summary concise and moves timezone into more details", async () => {
+ const user = userEvent.setup();
+ render(<Harness payload={{ jobs: [{
+ ...task,
+ schedule: { kind: "cron", expr: "15 9 * * 1-5", tz: "Asia/Shanghai" },
+ }] }} />);
+
+ await user.click(screen.getByRole("button", { name: /PR watch/ }));
+ const dialog = screen.getByRole("dialog", { name: "PR watch" });
+ const description = within(dialog).getByText("Weekdays at 09:15").parentElement!;
+ expect(description).toHaveTextContent("Next");
+ expect(description).not.toHaveTextContent("Asia/Shanghai");
+
+ await user.click(within(dialog).getByRole("button", { name: "More details" }));
+ expect(within(dialog).getByText("Timezone")).toBeVisible();
+ expect(within(dialog).getByText("Asia/Shanghai")).toBeVisible();
+ });
+
it("uses the existing settings surfaces for the calendar and system task group", async () => {
const user = userEvent.setup();
render(<Harness payload={{ jobs: [task, systemTask, {
@@ -375,9 +460,8 @@ describe("Automation task list and detail sheet", () => {
const list = screen.getByRole("list", { name: "System tasks" });
expect(taskBlock.closest("section")).toHaveClass("rounded-panel", "bg-[hsl(var(--settings-surface))]");
expect(list.closest(".bg-settings-surface")).not.toBe(taskBlock.closest("section"));
- const search = screen.getByRole("textbox");
- expect(search.closest(".rounded-panel")).toBeNull();
- expect(search).toHaveClass("h-10", "bg-settings-surface", "focus-visible:bg-background");
+ const filters = screen.getByRole("group", { name: "Automations" });
+ expect(filters.closest(".automation-calendar-header")).toBeInTheDocument();
expect(screen.getByRole("button", { name: "All 1" }).parentElement).toHaveClass("segmented-control", "flex-wrap");
const heartbeat = within(list).getByRole("button", { name: /heartbeat/ });
expect(heartbeat).toHaveClass("rounded-control", "settings-hover");
@@ -391,7 +475,7 @@ describe("Automation task list and detail sheet", () => {
await waitFor(() => expect(heartbeat).toHaveFocus());
});
- it("keeps separators inside the date grid and uses spacing for calendar metadata", () => {
+ it("keeps separators inside the date grid and omits an outside-month task list", () => {
const outsideTask: SessionAutomationJob = {
...task,
id: "outside-month",
@@ -402,11 +486,14 @@ describe("Automation task list and detail sheet", () => {
render(<Harness payload={{ jobs: [task, outsideTask] }} />);
const calendar = screen.getByRole("button", { name: /PR watch.*Planned/ }).closest("section")!;
- expect(calendar.firstElementChild).not.toHaveClass("border-b");
+ expect(calendar).not.toHaveClass("border");
+ const header = calendar.querySelector(".automation-calendar-header");
+ expect(header).toHaveClass("bg-foreground/[0.025]");
+ expect(header).not.toHaveClass("border-b");
+ expect(header?.querySelector(".automation-calendar-weekdays")).toBeInTheDocument();
expect(calendar.querySelector(".automation-meta-row")).not.toHaveClass("border-t");
- const outside = within(calendar).getByText("Without a date in this month").closest("details")!;
- expect(outside).not.toHaveClass("border-t");
- expect(outside.querySelector("ul")).not.toHaveClass("border-t");
+ expect(calendar.querySelector(":scope > details")).toBeNull();
+ expect(screen.queryByRole("button", { name: /Paused backlog review/ })).not.toBeInTheDocument();
expect(calendar).not.toHaveTextContent("·");
});
@@ -465,59 +552,53 @@ describe("Automation task list and detail sheet", () => {
expect(screen.getByRole("button", { name: /heartbeat/ })).toBe(row);
});
- it("keeps search, status filters and sorting immediately available", async () => {
+ it("keeps status filters immediately available", async () => {
const user = userEvent.setup();
- render(<Harness payload={{ jobs: [task, { ...task, id: "paused", name: "Weekly review", enabled: false }, systemTask] }} />);
- const search = screen.getByRole("textbox");
- expect(search).toBeVisible();
- expect(search).toBeEnabled();
- expect(screen.queryByRole("button", { name: "Search and filter" })).not.toBeInTheDocument();
- await user.type(search, "chat:nanobot");
- expect(screen.getByRole("button", { name: /PR watch/ })).toBeVisible();
- await user.clear(search);
- await user.type(search, "heartbeat");
- expect(screen.getByRole("button", { name: /heartbeat/ })).toBeVisible();
- expect(screen.getByRole("button", { name: "System tasks 1" })).toHaveAttribute("aria-expanded", "true");
- await user.clear(search);
+ render(<Harness payload={{ jobs: [task, {
+ ...task,
+ id: "paused",
+ name: "Weekly review",
+ enabled: false,
+ state: { last_run_at_ms: now - 60_000, last_status: "ok" },
+ }, systemTask] }} />);
+ expect(screen.queryByRole("textbox")).not.toBeInTheDocument();
await user.click(screen.getByRole("button", { name: "Paused 1" }));
expect(screen.queryByRole("button", { name: /PR watch/ })).not.toBeInTheDocument();
expect(screen.getByRole("button", { name: /Weekly review/ })).toBeVisible();
- expect(search).toBeVisible();
expect(screen.getByRole("button", { name: "Paused 1" })).toHaveAttribute("aria-pressed", "true");
await user.click(screen.getByRole("button", { name: "All 2" }));
- await user.click(screen.getByRole("button", { name: "Next run" }));
- await user.click(screen.getByRole("menuitem", { name: "Name" }));
- expect(screen.getByRole("button", { name: "Name", exact: true })).toBeVisible();
+ expect(screen.queryByRole("button", { name: "Next run", exact: true })).not.toBeInTheDocument();
expect(screen.getByRole("button", { name: /PR watch.*Planned/ })).toBeVisible();
});
- it("uses live renamed chat titles in details and search without changing the bound task", async () => {
+ it("uses live renamed chat titles in details without changing the bound task", async () => {
const user = userEvent.setup();
const action = vi.fn();
const payload = { jobs: [task] };
+ const longTitle = "Daily summary with completed work, blockers, and tomorrow's plan from the current conversation";
const { rerender } = render(<Harness payload={payload} onAction={action}
- titleOverrides={{ "websocket:demo": "推特大战场" }} />);
+ titleOverrides={{ "websocket:demo": longTitle }} />);
await user.click(screen.getByRole("button", { name: /PR watch/ }));
const dialog = screen.getByRole("dialog", { name: "PR watch" });
- const chatLink = within(dialog).getByRole("link", { name: "推特大战场" });
- expect(chatLink).toHaveAttribute("href", "#/chat/websocket%3Ademo");
+ const chatLabel = within(dialog).getByText(longTitle);
+ expect(chatLabel.closest("a")).toBeNull();
+ expect(chatLabel).toHaveClass("truncate");
+ expect(chatLabel).toHaveAttribute("title", longTitle);
+ expect(dialog.querySelector(".lucide-chevron-right")).toBeNull();
rerender(<Harness payload={payload} onAction={action}
titleOverrides={{ "websocket:demo": "新会话名称" }} />);
- expect(within(dialog).getByRole("link", { name: "新会话名称" })).toBe(chatLink);
+ expect(within(dialog).getByText("新会话名称")).toBe(chatLabel);
await user.click(within(dialog).getByRole("button", { name: "Pause" }));
expect(action).toHaveBeenCalledWith("disable", expect.objectContaining({
id: task.id, payload: task.payload,
origin: expect.objectContaining({ session_key: "websocket:demo" }),
}));
expect(task.origin?.title).toBe("nanobot-development");
- await user.click(within(dialog).getByRole("button", { name: "Done" }));
- await user.type(screen.getByRole("textbox"), "chat:新会话名称");
- expect(screen.getByRole("button", { name: /PR watch/ })).toBeVisible();
+ await user.click(within(dialog).getByRole("button", { name: "Close" }));
rerender(<Harness payload={payload} titleOverrides={{}} />);
- expect(screen.queryByRole("button", { name: /PR watch/ })).not.toBeInTheDocument();
- await user.clear(screen.getByRole("textbox"));
await user.click(screen.getByRole("button", { name: /PR watch/ }));
- expect(screen.getByRole("link", { name: "nanobot-development" })).toHaveAttribute("href", "#/chat/websocket%3Ademo");
+ expect(screen.getByText("nanobot-development").closest("a")).toBeNull();
+ expect(screen.getByRole("link", { name: "Open a chat" })).toHaveAttribute("href", "#/chat/websocket%3Ademo");
});
it("retains the inspected task across refreshes and closes if it is removed", () => {
@@ -534,43 +615,21 @@ describe("Automation task list and detail sheet", () => {
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
});
- it("keeps controls visible and preserves search when Escape dismisses sorting", async () => {
- const user = userEvent.setup();
- render(<Harness />);
- const search = screen.getByRole("textbox");
- expect(search).not.toHaveFocus();
- await user.tab();
- expect(search).toHaveFocus();
- await user.type(search, "PR");
- await user.keyboard("{Escape}");
- expect(search).toHaveValue("PR");
- expect(search).toHaveFocus();
- expect(search).toBeEnabled();
- fireEvent.keyDown(search, { key: "Escape", isComposing: true });
- expect(search).toBeVisible();
- await user.click(screen.getByRole("button", { name: "Next run", exact: true }));
- await user.keyboard("{Escape}");
- expect(screen.queryByRole("menu")).not.toBeInTheDocument();
- expect(screen.getByRole("button", { name: "Next run", exact: true })).toHaveFocus();
- await user.keyboard("{Escape}");
- expect(screen.getByRole("region", { name: "Search and filter" })).toBeVisible();
- expect(search).toHaveValue("PR");
- });
-
- it("returns focus to search or the page heading when the inspected row is no longer present", async () => {
+ it("returns focus to the page heading when the inspected row is no longer present", async () => {
const user = userEvent.setup();
const { rerender } = render(<Harness filter="active" />);
await user.click(screen.getByRole("button", { name: /PR watch/ }));
rerender(<Harness payload={{ jobs: [{ ...task, enabled: false }] }} filter="active" />);
- await user.click(screen.getByRole("button", { name: "Done" }));
- await waitFor(() => expect(screen.getByRole("textbox")).toHaveFocus());
+ await user.click(screen.getByRole("button", { name: "Close" }));
+ await waitFor(() => expect(screen.getByRole("heading", { name: "Automations" })).toHaveFocus());
rerender(<Harness payload={{ jobs: [task] }} filter="all" />);
await user.click(screen.getByRole("button", { name: /PR watch/ }));
rerender(<Harness payload={{ jobs: [] }} filter="all" />);
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
expect(screen.getByRole("heading", { name: "Automations" })).toHaveFocus();
- expect(screen.getByText("No automations yet.")).toBeVisible();
+ expect(document.querySelectorAll(".automation-calendar-day").length).toBeGreaterThanOrEqual(35);
+ expect(screen.queryByText("No automations yet.")).not.toBeInTheDocument();
expect(screen.queryByRole("button", { name: /PR watch/ })).not.toBeInTheDocument();
});
@@ -594,7 +653,7 @@ describe("Automation task list and detail sheet", () => {
await user.click(details);
expect(details).toHaveAttribute("aria-expanded", "true");
expect(screen.getByRole("dialog")).toBeVisible();
- await user.click(screen.getByRole("button", { name: "Done" }));
+ await user.click(screen.getByRole("button", { name: "Close" }));
}
});
@@ -740,7 +799,9 @@ describe("Automation task list and detail sheet", () => {
it("does not allow running a pending task or resuming an unlinked task", async () => {
const user = userEvent.setup();
- const { rerender } = render(<Harness payload={{ jobs: [{ ...task, state: { pending: true } }] }} />);
+ const { rerender } = render(<Harness payload={{ jobs: [{
+ ...task, state: { pending: true, next_run_at_ms: now + 540_000 },
+ }] }} />);
await user.click(screen.getByRole("button", { name: /PR watch/ }));
expect(screen.getByRole("button", { name: "Run now" })).toBeDisabled();
rerender(<Harness payload={{ jobs: [{ ...task, enabled: false, origin: null }] }} />);
@@ -764,11 +825,11 @@ describe("Automation task list and detail sheet", () => {
it("shows paused failures honestly and does not fabricate successful runs", () => {
render(<Harness payload={{ jobs: [{
- ...task, enabled: false, state: { last_status: "error", last_error: "Connection interrupted" },
+ ...task, enabled: false, state: {
+ last_status: "error", last_error: "Connection interrupted", last_run_at_ms: now - 60_000,
+ },
}, { ...systemTask, state: { last_status: "error" } }] }} />);
- const row = screen.getByRole("button", { name: /PR watch/ });
- expect(row).toHaveTextContent("Needs attention");
- expect(row).toHaveTextContent("Paused");
+ const row = screen.getByRole("button", { name: /PR watch.*Failed/ });
expect(screen.getByRole("button", { name: /System tasks 1 Needs attention/ })).toBeVisible();
fireEvent.click(row);
expect(within(screen.getByRole("dialog")).getByText("Failed")).toBeVisible();
@@ -776,7 +837,11 @@ describe("Automation task list and detail sheet", () => {
});
it("allows expanding long instructions without exposing technical metadata by default", () => {
- render(<Harness payload={{ jobs: [{ ...task, payload: { message: "Long instructions. ".repeat(50) }, state: {} }] }} />);
+ render(<Harness payload={{ jobs: [{
+ ...task,
+ payload: { message: "Long instructions. ".repeat(50) },
+ state: { next_run_at_ms: now + 540_000 },
+ }] }} />);
fireEvent.click(screen.getByRole("button", { name: /PR watch/ }));
const dialog = screen.getByRole("dialog");
expect(within(dialog).getByText("Not run yet")).toBeVisible();
diff --git a/webui/src/tests/settings-automations.test.tsx b/webui/src/tests/settings-automations.test.tsx
index e5b77aca8..713b1c4d4 100644
--- a/webui/src/tests/settings-automations.test.tsx
+++ b/webui/src/tests/settings-automations.test.tsx
@@ -15,18 +15,14 @@ function renderAutomationDetail(channel: string) {
enabled: true,
schedule: { kind: "every", every_ms: 60_000 },
payload: { message: "Summarize updates" },
- state: {},
+ state: { next_run_at_ms: Date.now() + 60_000 },
origin: { channel },
}] }}
loading={false}
- query=""
filter="all"
- sort="name"
actionKey={null}
error={null}
- onQueryChange={vi.fn()}
onFilterChange={vi.fn()}
- onSortChange={vi.fn()}
onAction={vi.fn()}
onRequestEdit={vi.fn()}
onRequestDelete={vi.fn()}
diff --git a/webui/src/tests/settings-system.test.tsx b/webui/src/tests/settings-system.test.tsx
index 55ff89628..f6e96a073 100644
--- a/webui/src/tests/settings-system.test.tsx
+++ b/webui/src/tests/settings-system.test.tsx
@@ -233,11 +233,12 @@ describe("Settings system domains", () => {
});
expect(screen.getByRole("heading", { name: "Automations" })).toBeInTheDocument();
- expect(await screen.findByText("No automations yet.")).toBeInTheDocument();
+ await waitFor(() => expect(document.querySelectorAll(".automation-calendar-day").length).toBeGreaterThanOrEqual(35));
+ expect(screen.queryByText("No automations yet.")).not.toBeInTheDocument();
const input = screen.getByRole("textbox", { name: "Describe an automation" });
expect(input).toHaveAttribute(
"placeholder",
- "Describe an automation, for example: summarize project updates every weekday at 9:00",
+ "What would you like nanobot to schedule?",
);
fireEvent.change(input, { target: { value: "Summarize updates every weekday at 9" } });
fireEvent.click(screen.getByRole("button", { name: "Send message" }));
@@ -263,7 +264,7 @@ describe("Settings system domains", () => {
enabled: true,
schedule: { kind: "cron", expr: "0 9 * * *" },
payload: { message: "Summarize the day" },
- state: {},
+ state: { next_run_at_ms: Date.now() + 60_000 },
}],
});
}
@@ -278,8 +279,9 @@ describe("Settings system domains", () => {
expect(await screen.findByRole("button", { name: /Daily summary/ })).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Paused 0" }));
- expect(await screen.findByText("No automations match this view.")).toBeInTheDocument();
- fireEvent.click(screen.getByRole("button", { name: "Clear filters" }));
+ expect(screen.queryByRole("button", { name: /Daily summary/ })).not.toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "Today" })).toBeVisible();
+ fireEvent.click(screen.getByRole("button", { name: "All 1" }));
expect(await screen.findByRole("button", { name: /Daily summary/ })).toBeInTheDocument();
});
@@ -296,7 +298,8 @@ describe("Settings system domains", () => {
{
id: "paused-job", name: "Paused reminder", enabled: false,
schedule: { kind: "every", every_ms: 86_400_000 },
- payload: { message: "Check the repo" }, state: {},
+ payload: { message: "Check the repo" },
+ state: { last_run_at_ms: Date.now() - 60_000, last_status: "ok" },
},
] });
}