Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(autopilot): redesign modal — simpler schema, consistent schedule UI (#1595)
Naiyuan Qing40cea8454d64
diff --git a/packages/core/types/autopilot.ts b/packages/core/types/autopilot.tsindex a73c013ccd..9c1d6814e9 100644--- a/packages/core/types/autopilot.ts+++ b/packages/core/types/autopilot.ts@@ -11,11 +11,9 @@ export type AutopilotRunSource = "schedule" | "manual" | "webhook" | "api";export interface Autopilot {id: string;workspace_id: string;- project_id: string | null;title: string;description: string | null;assignee_id: string;- priority: string;status: AutopilotStatus;execution_mode: AutopilotExecutionMode;issue_title_template: string | null;@@ -61,8 +59,6 @@ export interface CreateAutopilotRequest {title: string;description?: string;assignee_id: string;- project_id?: string;- priority?: string;execution_mode: AutopilotExecutionMode;issue_title_template?: string;}@@ -71,8 +67,6 @@ export interface UpdateAutopilotRequest {title?: string;description?: string | null;assignee_id?: string;- project_id?: string | null;- priority?: string;status?: AutopilotStatus;execution_mode?: AutopilotExecutionMode;issue_title_template?: string | null;diff --git a/packages/ui/components/ui/time-input.tsx b/packages/ui/components/ui/time-input.tsxnew file mode 100644index 0000000000..411afabf37--- /dev/null+++ b/packages/ui/components/ui/time-input.tsx@@ -0,0 +1,219 @@+"use client";++import * as React from "react";+import { Clock } from "lucide-react";++import { cn } from "@multica/ui/lib/utils";++// Adapted from openstatusHQ/time-picker (MIT).+// Segmented HH:MM input with keyboard arrow increment / digit typing.++type Segment = "hours" | "minutes";++function getValidNumber(+ raw: string,+ { max, min = 0, loop = false }: { max: number; min?: number; loop?: boolean },+): string {+ let n = parseInt(raw, 10);+ if (isNaN(n)) return "00";+ if (!loop) {+ if (n > max) n = max;+ if (n < min) n = min;+ } else {+ if (n > max) n = min;+ if (n < min) n = max;+ }+ return n.toString().padStart(2, "0");+}++function arrowValue(current: string, step: number, seg: Segment): string {+ const max = seg === "hours" ? 23 : 59;+ const n = parseInt(current, 10);+ if (isNaN(n)) return "00";+ return getValidNumber(String(n + step), { max, min: 0, loop: true });+}++function splitTime(value: string): { hh: string; mm: string } {+ const [rawH, rawM] = (value || "").split(":");+ const hh = getValidNumber(rawH ?? "0", { max: 23 });+ const mm = getValidNumber(rawM ?? "0", { max: 59 });+ return { hh, mm };+}++interface SegmentInputProps {+ seg: Segment;+ value: string;+ onValueChange: (next: string) => void;+ onLeftFocus?: () => void;+ onRightFocus?: () => void;+ disabled?: boolean;+ ariaLabel: string;+}++const SegmentInput = React.forwardRef<HTMLInputElement, SegmentInputProps>(+ function SegmentInput(+ { seg, value, onValueChange, onLeftFocus, onRightFocus, disabled, ariaLabel },+ ref,+ ) {+ // Two-digit typing window: first digit pads with leading 0; second digit within+ // 2s replaces the leading 0, clamped to segment max. After 2s, reset.+ const [pendingSecond, setPendingSecond] = React.useState(false);++ React.useEffect(() => {+ if (!pendingSecond) return;+ const t = setTimeout(() => setPendingSecond(false), 2000);+ return () => clearTimeout(t);+ }, [pendingSecond]);++ const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {+ if (e.key === "Tab") return;+ if (e.key === "ArrowRight") {+ e.preventDefault();+ onRightFocus?.();+ return;+ }+ if (e.key === "ArrowLeft") {+ e.preventDefault();+ onLeftFocus?.();+ return;+ }+ if (e.key === "ArrowUp" || e.key === "ArrowDown") {+ e.preventDefault();+ const step = e.key === "ArrowUp" ? 1 : -1;+ onValueChange(arrowValue(value, step, seg));+ setPendingSecond(false);+ return;+ }+ if (e.key >= "0" && e.key <= "9") {+ e.preventDefault();+ const next = pendingSecond+ ? getValidNumber(value.slice(1) + e.key, {+ max: seg === "hours" ? 23 : 59,+ })+ : "0" + e.key;+ onValueChange(next);+ if (pendingSecond) {+ setPendingSecond(false);+ onRightFocus?.();+ } else {+ setPendingSecond(true);+ }+ return;+ }+ if (e.key === "Backspace" || e.key === "Delete") {+ e.preventDefault();+ onValueChange("00");+ setPendingSecond(false);+ }+ };++ return (+ <input+ ref={ref}+ type="text"+ inputMode="numeric"+ maxLength={2}+ value={value}+ disabled={disabled}+ aria-label={ariaLabel}+ onChange={() => {+ // Fully controlled by keydown; ignore native onChange.+ }}+ onKeyDown={handleKeyDown}+ onFocus={(e) => e.currentTarget.select()}+ className="w-7 bg-transparent text-center text-sm tabular-nums outline-none caret-transparent focus:text-foreground"+ />+ );+ },+);++export interface TimeInputProps {+ value: string;+ onChange: (value: string) => void;+ disabled?: boolean;+ className?: string;+ showIcon?: boolean;+ /** Render only the minute segment with an "At :" prefix. Used for hourly schedules. */+ minuteOnly?: boolean;+}++export function TimeInput({+ value,+ onChange,+ disabled,+ className,+ showIcon = true,+ minuteOnly = false,+}: TimeInputProps) {+ const { hh, mm } = splitTime(value);+ const hourRef = React.useRef<HTMLInputElement>(null);+ const minuteRef = React.useRef<HTMLInputElement>(null);++ const setHour = (next: string) => onChange(`${next}:${mm}`);+ const setMinute = (next: string) =>+ onChange(`${minuteOnly ? "00" : hh}:${next}`);++ return (+ <div+ data-slot="time-input"+ onClick={(e) => {+ if (e.target === e.currentTarget) {+ (minuteOnly ? minuteRef : hourRef).current?.focus();+ }+ }}+ className={cn(+ "flex h-8 items-center gap-1 rounded-lg border border-input bg-transparent px-2.5 text-sm transition-colors",+ "focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50",+ "dark:bg-input/30",+ disabled && "pointer-events-none cursor-not-allowed opacity-50",+ className,+ )}+ >+ {minuteOnly ? (+ <>+ {showIcon && (+ <Clock className="pointer-events-none size-3.5 shrink-0 text-muted-foreground" />+ )}+ <span className="pointer-events-none select-none text-muted-foreground">+ at :+ </span>+ <SegmentInput+ ref={minuteRef}+ seg="minutes"+ value={mm}+ onValueChange={setMinute}+ disabled={disabled}+ ariaLabel="Minute"+ />+ </>+ ) : (+ <>+ {showIcon && (+ <Clock className="pointer-events-none size-3.5 shrink-0 text-muted-foreground" />+ )}+ <SegmentInput+ ref={hourRef}+ seg="hours"+ value={hh}+ onValueChange={setHour}+ onRightFocus={() => minuteRef.current?.focus()}+ disabled={disabled}+ ariaLabel="Hour"+ />+ <span className="pointer-events-none select-none text-muted-foreground">+ :+ </span>+ <SegmentInput+ ref={minuteRef}+ seg="minutes"+ value={mm}+ onValueChange={setMinute}+ onLeftFocus={() => hourRef.current?.focus()}+ disabled={disabled}+ ariaLabel="Minute"+ />+ </>+ )}+ </div>+ );+}diff --git a/packages/views/autopilots/components/autopilot-detail-page.tsx b/packages/views/autopilots/components/autopilot-detail-page.tsxindex f87fa8a0de..65d3e5047d 100644--- a/packages/views/autopilots/components/autopilot-detail-page.tsx+++ b/packages/views/autopilots/components/autopilot-detail-page.tsx@@ -338,11 +338,7 @@ export function AutopilotDetailPage({ autopilotId }: { autopilotId: string }) {</div></div><div>- <label className="text-xs text-muted-foreground">Priority</label>- <div className="mt-1 capitalize">{autopilot.priority}</div>- </div>- <div>- <label className="text-xs text-muted-foreground">Execution Mode</label>+ <label className="text-xs text-muted-foreground">Output Mode</label><div className="mt-1">{autopilot.execution_mode === "create_issue" ? "Create Issue" : "Run Only"}</div>@@ -428,7 +424,6 @@ export function AutopilotDetailPage({ autopilotId }: { autopilotId: string }) {title: autopilot.title,description: autopilot.description ?? "",assignee_id: autopilot.assignee_id,- priority: autopilot.priority,execution_mode: autopilot.execution_mode as AutopilotExecutionMode,}}triggers={triggers}diff --git a/packages/views/autopilots/components/autopilot-dialog.tsx b/packages/views/autopilots/components/autopilot-dialog.tsxindex aa13aa51cc..30e09aeb05 100644--- a/packages/views/autopilots/components/autopilot-dialog.tsx+++ b/packages/views/autopilots/components/autopilot-dialog.tsx@@ -1,8 +1,21 @@"use client";-import { useRef, useState } from "react";+import { useEffect, useMemo, useRef, useState } from "react";+import { useQuery } from "@tanstack/react-query";import { toast } from "sonner";-import { Calendar, ChevronRight, Maximize2, Minimize2, Rocket, X as XIcon } from "lucide-react";+import {+ Check,+ ChevronDown,+ ChevronRight,+ Clock,+ FilePlus2,+ Maximize2,+ Minimize2,+ Play,+ Rocket,+ X as XIcon,+ Zap,+} from "lucide-react";import { cn } from "@multica/ui/lib/utils";import {Dialog,@@ -11,7 +24,18 @@ import {} from "@multica/ui/components/ui/dialog";import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";import { Button } from "@multica/ui/components/ui/button";+import {+ Select,+ SelectTrigger,+ SelectValue,+ SelectContent,+ SelectItem,+} from "@multica/ui/components/ui/select";+import { TimeInput } from "@multica/ui/components/ui/time-input";+import { TimezonePicker } from "./pickers/timezone-picker";import { useCurrentWorkspace } from "@multica/core/paths";+import { useWorkspaceId } from "@multica/core/hooks";+import { agentListOptions } from "@multica/core/workspace/queries";import {useCreateAutopilot,useCreateAutopilotTrigger,@@ -21,21 +45,18 @@ import {import type {AutopilotExecutionMode,AutopilotTrigger,- IssuePriority,} from "@multica/core/types";import { TitleEditor, ContentEditor } from "../../editor";-import { PillButton } from "../../common/pill-button";-import { PriorityPicker } from "../../issues/components/pickers";+import { ActorAvatar } from "../../common/actor-avatar";+import { AgentPicker } from "./pickers/agent-picker";import {getDefaultTriggerConfig,+ getLocalTimezone,parseCronExpression,- summarizeTrigger,toCronExpression,type TriggerConfig,+ type TriggerFrequency,} from "./trigger-config";-import { AgentPicker } from "./pickers/agent-picker";-import { ExecutionModePicker } from "./pickers/execution-mode-picker";-import { SchedulePicker } from "./pickers/schedule-picker";// ---------------------------------------------------------------------------// Types@@ -45,7 +66,6 @@ export interface AutopilotInitial {title: string;description: string;assignee_id: string;- priority: string;execution_mode: AutopilotExecutionMode;}@@ -67,20 +87,174 @@ export type AutopilotDialogProps =};// ----------------------------------------------------------------------------// AutopilotDialog — shared Create/Edit dialog for autopilots+// Static data+// ---------------------------------------------------------------------------++const FREQUENCY_OPTIONS: { value: TriggerFrequency; label: string }[] = [+ { value: "hourly", label: "Every hour" },+ { value: "daily", label: "Every day" },+ { value: "weekdays", label: "Every weekday" },+ { value: "weekly", label: "Every week" },+ { value: "custom", label: "Custom cron" },+];++const DAY_OPTIONS: { value: number; label: string; short: string }[] = [+ { value: 0, label: "Sunday", short: "Sun" },+ { value: 1, label: "Monday", short: "Mon" },+ { value: 2, label: "Tuesday", short: "Tue" },+ { value: 3, label: "Wednesday", short: "Wed" },+ { value: 4, label: "Thursday", short: "Thu" },+ { value: 5, label: "Friday", short: "Fri" },+ { value: 6, label: "Saturday", short: "Sat" },+];++const TIMEZONE_OPTIONS = [+ "UTC",+ "America/New_York",+ "America/Chicago",+ "America/Denver",+ "America/Los_Angeles",+ "America/Sao_Paulo",+ "Europe/London",+ "Europe/Paris",+ "Europe/Berlin",+ "Europe/Moscow",+ "Asia/Dubai",+ "Asia/Kolkata",+ "Asia/Singapore",+ "Asia/Shanghai",+ "Asia/Tokyo",+ "Asia/Seoul",+ "Australia/Sydney",+ "Pacific/Auckland",+];++const OUTPUT_MODES: {+ value: AutopilotExecutionMode;+ label: string;+ description: string;+ Icon: typeof FilePlus2;+}[] = [+ {+ value: "create_issue",+ label: "Create issue",+ description: "Each run creates a tracked issue",+ Icon: FilePlus2,+ },+ {+ value: "run_only",+ label: "Run only",+ description: "Silent run, no issue created",+ Icon: Play,+ },+];++// ---------------------------------------------------------------------------+// Next-run computation (local approximation — server stores the authoritative value)+// ---------------------------------------------------------------------------++function computeNextRun(cfg: TriggerConfig, now: Date): Date | null {+ const [hStr, mStr] = cfg.time.split(":");+ const hour = parseInt(hStr ?? "9", 10);+ const minute = parseInt(mStr ?? "0", 10);+ const next = new Date(now);++ switch (cfg.frequency) {+ case "hourly": {+ next.setMinutes(minute, 0, 0);+ if (next <= now) next.setHours(next.getHours() + 1);+ return next;+ }+ case "daily": {+ next.setHours(hour, minute, 0, 0);+ if (next <= now) next.setDate(next.getDate() + 1);+ return next;+ }+ case "weekdays": {+ next.setHours(hour, minute, 0, 0);+ for (let i = 0; i < 8; i++) {+ const dow = next.getDay();+ if (next > now && dow >= 1 && dow <= 5) return next;+ next.setDate(next.getDate() + 1);+ next.setHours(hour, minute, 0, 0);+ }+ return null;+ }+ case "weekly": {+ if (cfg.daysOfWeek.length === 0) return null;+ next.setHours(hour, minute, 0, 0);+ for (let i = 0; i < 8; i++) {+ if (next > now && cfg.daysOfWeek.includes(next.getDay())) return next;+ next.setDate(next.getDate() + 1);+ next.setHours(hour, minute, 0, 0);+ }+ return null;+ }+ case "custom":+ return null;+ }+}++function formatCountdown(target: Date, now: Date): string {+ const diff = Math.max(0, target.getTime() - now.getTime());+ const seconds = Math.floor(diff / 1000);+ const days = Math.floor(seconds / 86400);+ const hours = Math.floor((seconds % 86400) / 3600);+ const minutes = Math.floor((seconds % 3600) / 60);+ if (days > 0) return `${days}d ${hours}h`;+ if (hours > 0) return `${hours}h ${minutes}m`;+ if (minutes > 0) return `${minutes}m`;+ return "<1m";+}++function formatNextRunAbsolute(date: Date, timezone: string): string {+ try {+ return new Intl.DateTimeFormat("en-US", {+ timeZone: timezone,+ weekday: "short",+ month: "short",+ day: "numeric",+ hour: "numeric",+ minute: "2-digit",+ hour12: true,+ }).format(date);+ } catch {+ return date.toLocaleString();+ }+}++// ---------------------------------------------------------------------------+// Live "now" ticker for countdown+// ---------------------------------------------------------------------------++function useNowTicker(intervalMs = 30_000): Date {+ const [now, setNow] = useState(() => new Date());+ useEffect(() => {+ const t = setInterval(() => setNow(new Date()), intervalMs);+ return () => clearInterval(t);+ }, [intervalMs]);+ return now;+}++// ---------------------------------------------------------------------------+// AutopilotDialog// ---------------------------------------------------------------------------export function AutopilotDialog(props: AutopilotDialogProps) {const { open, onOpenChange } = props;const workspaceName = useCurrentWorkspace()?.name;+ const wsId = useWorkspaceId();+ const { data: agents = [] } = useQuery(agentListOptions(wsId));const [isExpanded, setIsExpanded] = useState(false);const isCreate = props.mode === "create";- const initial: Partial<AutopilotInitial> = isCreate ? props.initial ?? {} : props.initial;+ const initial: Partial<AutopilotInitial> = isCreate+ ? props.initial ?? {}+ : props.initial;+const [title, setTitle] = useState(initial.title ?? "");const [description, setDescription] = useState(initial.description ?? "");const [assigneeId, setAssigneeId] = useState<string>(initial.assignee_id ?? "");- const [priority, setPriority] = useState<string>(initial.priority ?? "medium");const [executionMode, setExecutionMode] = useState<AutopilotExecutionMode>(initial.execution_mode ?? "create_issue",);@@ -97,17 +271,13 @@ export function AutopilotDialog(props: AutopilotDialogProps) {return getDefaultTriggerConfig();})();const [triggerConfig, setTriggerConfig] = useState<TriggerConfig>(initialCfg);- // Snapshot initial cron payload at mount so `scheduleDirty` only flips when- // the payload actually changes (prevents phantom trigger creates when the- // user opens the popover, clicks the already-active option, then Saves).+const initialCronRef = useRef(toCronExpression(initialCfg));const initialTimezoneRef = useRef(initialCfg.timezone);const scheduleDirty =toCronExpression(triggerConfig) !== initialCronRef.current ||triggerConfig.timezone !== initialTimezoneRef.current;- // Snapshot the first-trigger id at mount. Parent `triggers` prop can update- // mid-dialog via WS refetch — we want Save to act on the trigger we showed.const firstTriggerIdRef = useRef(!isCreate && props.triggers[0] ? props.triggers[0].id : null,);@@ -115,12 +285,10 @@ export function AutopilotDialog(props: AutopilotDialogProps) {const triggerCount = isCreate ? 0 : props.triggers.length;const schedulePillDisabled = !isCreate && triggerCount >= 2;- const schedulePillLabel = (() => {- if (isCreate) return summarizeTrigger(triggerConfig);- if (triggerCount === 0) return "Add schedule";- if (triggerCount === 1) return summarizeTrigger(triggerConfig);- return `${triggerCount} schedules`;- })();+ const selectedAgent = useMemo(+ () => agents.find((a) => a.id === assigneeId) ?? null,+ [agents, assigneeId],+ );const createAutopilot = useCreateAutopilot();const createTrigger = useCreateAutopilotTrigger();@@ -128,7 +296,8 @@ export function AutopilotDialog(props: AutopilotDialogProps) {const updateTrigger = useUpdateAutopilotTrigger();const [submitting, setSubmitting] = useState(false);- const canSubmit = title.trim().length > 0 && assigneeId.length > 0 && !submitting;+ const canSubmit =+ title.trim().length > 0 && assigneeId.length > 0 && !submitting;const handleSubmit = async () => {if (!canSubmit) return;@@ -139,7 +308,6 @@ export function AutopilotDialog(props: AutopilotDialogProps) {title: title.trim(),description: description.trim() || undefined,assignee_id: assigneeId,- priority,execution_mode: executionMode,});let scheduleOk = true;@@ -162,10 +330,8 @@ export function AutopilotDialog(props: AutopilotDialogProps) {title: title.trim(),description: description.trim() || null,assignee_id: assigneeId,- priority,execution_mode: executionMode,});- // Schedule: patch the trigger we snapshotted at mount, else create one.let scheduleOk = true;if (scheduleDirty && !schedulePillDisabled) {const snapshottedTriggerId = firstTriggerIdRef.current;@@ -210,7 +376,9 @@ export function AutopilotDialog(props: AutopilotDialogProps) {"p-0 gap-0 flex flex-col overflow-hidden","!transition-all !duration-300 !ease-out !-translate-y-1/2","!w-[calc(100vw-2rem)]",- isExpanded ? "!max-w-4xl !h-5/6" : "!max-w-2xl !h-96",+ isExpanded+ ? "!max-w-6xl !h-[calc(100vh-4rem)]"+ : "!max-w-5xl !h-[min(720px,calc(100vh-4rem))]",)}><DialogTitle className="sr-only">@@ -218,14 +386,24 @@ export function AutopilotDialog(props: AutopilotDialogProps) {</DialogTitle>{/* Header */}- <div className="flex items-center justify-between px-5 pt-3 pb-2 shrink-0">- <div className="flex items-center gap-1.5 text-xs">- <span className="text-muted-foreground">{workspaceName}</span>- <ChevronRight className="size-3 text-muted-foreground/50" />- <Rocket className="size-3 text-muted-foreground" />- <span className="font-medium">- {isCreate ? "New autopilot" : "Edit autopilot"}- </span>+ <div className="flex items-center justify-between px-5 pt-3 pb-2 shrink-0 border-b">+ <div className="flex items-center gap-2 text-xs">+ <div className="flex items-center gap-1.5">+ <span className="inline-flex size-5 items-center justify-center rounded-md bg-primary/15 text-primary">+ <Rocket className="size-3" />+ </span>+ <span className="font-medium text-foreground">+ {isCreate ? "New autopilot" : "Edit autopilot"}+ </span>+ </div>+ <span className="text-muted-foreground/60">·</span>+ <span className="text-muted-foreground">A recurring AI task</span>+ {workspaceName && (+ <>+ <ChevronRight className="size-3 text-muted-foreground/40" />+ <span className="text-muted-foreground">{workspaceName}</span>+ </>+ )}</div><div className="flex items-center gap-1"><Tooltip>@@ -257,94 +435,339 @@ export function AutopilotDialog(props: AutopilotDialogProps) {</div></div>- {/* Body re-mounts when switching between autopilots (or create/edit) */}- <div key={contentKey} className="flex-1 flex flex-col min-h-0">- {/* Name */}- <div className="px-5 pb-2 shrink-0">- <TitleEditor- autoFocus={isCreate}- defaultValue={initial.title ?? ""}- placeholder="Autopilot name"- className="text-lg font-semibold"- onChange={setTitle}- onSubmit={handleSubmit}- />- </div>+ {/* Body: two columns (stacks on narrow screens via flex-wrap at container level) */}+ <div+ key={contentKey}+ className="flex-1 min-h-0 flex flex-col lg:flex-row overflow-hidden"+ >+ {/* Left: Runbook */}+ <div className="flex-1 min-h-0 flex flex-col border-b lg:border-b-0 lg:border-r">+ <div className="px-6 pt-5 pb-3 shrink-0">+ <TitleEditor+ autoFocus={isCreate}+ defaultValue={initial.title ?? ""}+ placeholder="Autopilot name"+ className="text-2xl font-semibold tracking-tight"+ onChange={setTitle}+ onSubmit={handleSubmit}+ />+ </div>- {/* Prompt — takes remaining space */}- <div className="relative flex-1 min-h-0 overflow-y-auto px-5">- <ContentEditor- defaultValue={initial.description ?? ""}- placeholder="Step-by-step instructions for the agent..."- onUpdate={setDescription}- debounceMs={300}- showBubbleMenu={false}- />+ <div className="px-6 pb-2 shrink-0 flex items-baseline gap-2">+ <span className="text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase">+ Runbook+ </span>+ <span className="text-xs text-muted-foreground/80">+ Read by the agent on every run+ </span>+ </div>++ <div className="flex-1 min-h-0 px-6 pb-6 flex flex-col">+ <div className="h-full overflow-y-auto rounded-lg border border-border bg-background transition-colors focus-within:border-input px-4 py-3">+ <ContentEditor+ defaultValue={initial.description ?? ""}+ placeholder={`# Goal\nWhat should the agent accomplish?\n\n# Context\nWho is this for? Any constraints?\n\n# Steps\n1. …\n2. …`}+ onUpdate={setDescription}+ debounceMs={300}+ showBubbleMenu={false}+ />+ </div>+ </div></div>- {/* Pill toolbar */}- <div className="flex items-center gap-1.5 px-4 py-2 shrink-0 flex-wrap">- <AgentPicker- agentId={assigneeId || null}+ {/* Right: Configuration */}+ <aside className="w-full lg:w-[340px] shrink-0 overflow-y-auto px-5 py-5 space-y-5 bg-muted/30">+ <AgentSection+ selectedId={assigneeId}onChange={setAssigneeId}- triggerRender={<PillButton />}- align="start"+ selectedName={selectedAgent?.name}+ selectedDescription={selectedAgent?.description}/>- <PriorityPicker- priority={priority as IssuePriority}- onUpdate={(u) => { if (u.priority) setPriority(u.priority); }}- triggerRender={<PillButton />}- align="start"- />- <ExecutionModePicker- mode={executionMode}- onChange={setExecutionMode}- triggerRender={<PillButton />}- align="start"++ <OutputModeSection mode={executionMode} onChange={setExecutionMode} />++ <ScheduleSection+ config={triggerConfig}+ onChange={setTriggerConfig}+ disabled={schedulePillDisabled}+ disabledReason={+ schedulePillDisabled+ ? "This autopilot has multiple schedules — edit them in the detail page."+ : undefined+ }/>- {schedulePillDisabled ? (- <Tooltip>- <TooltipTrigger- render={- <PillButton- disabled- className="opacity-60 cursor-not-allowed"- >- <Calendar className="size-3" />- <span className="truncate">{schedulePillLabel}</span>- </PillButton>- }- />- <TooltipContent side="top">Edit schedules in detail page</TooltipContent>- </Tooltip>- ) : (- <SchedulePicker- config={triggerConfig}- onChange={setTriggerConfig}- triggerRender={- <PillButton>- <Calendar className="size-3" />- <span className="truncate">{schedulePillLabel}</span>- </PillButton>- }- />- )}- </div>+ </aside>+ </div>- {/* Footer */}- <div className="flex items-center justify-end gap-2 px-4 py-3 border-t shrink-0">+ {/* Footer */}+ <div className="flex items-center justify-between gap-3 px-5 py-3 border-t shrink-0 bg-background">+ <div className="flex items-center gap-1.5 text-xs text-muted-foreground min-w-0">+ <Zap className="size-3.5 text-amber-500 shrink-0" />+ <span className="truncate">+ Once saved, runs automatically until paused.+ </span>+ </div>+ <div className="flex items-center gap-2 shrink-0"><Button size="sm" variant="outline" onClick={() => onOpenChange(false)}>Cancel</Button><Button size="sm" onClick={handleSubmit} disabled={!canSubmit}>{submitting- ? isCreate ? "Creating..." : "Saving..."- : isCreate ? "Create autopilot" : "Save"}+ ? isCreate+ ? "Creating..."+ : "Saving..."+ : isCreate+ ? "Create autopilot"+ : "Save"}</Button></div></div>-</DialogContent></Dialog>);}++// ---------------------------------------------------------------------------+// Right column sections+// ---------------------------------------------------------------------------++function SectionLabel({ children }: { children: React.ReactNode }) {+ return (+ <div className="text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase mb-2">+ {children}+ </div>+ );+}++function AgentSection({+ selectedId,+ onChange,+ selectedName,+ selectedDescription,+}: {+ selectedId: string;+ onChange: (id: string) => void;+ selectedName?: string;+ selectedDescription?: string;+}) {+ return (+ <div>+ <SectionLabel>Agent</SectionLabel>+ <AgentPicker+ agentId={selectedId || null}+ onChange={onChange}+ align="start"+ triggerRender={+ <button+ type="button"+ className={cn(+ "w-full flex items-center gap-2.5 rounded-md border bg-background px-3 py-2 text-left",+ "hover:bg-accent/40 transition-colors cursor-pointer",+ )}+ >+ {selectedId ? (+ <ActorAvatar+ actorType="agent"+ actorId={selectedId}+ size={28}+ disableHoverCard+ />+ ) : (+ <span className="inline-flex size-7 items-center justify-center rounded-full bg-muted text-muted-foreground">+ <Rocket className="size-3.5" />+ </span>+ )}+ <span className="flex-1 min-w-0">+ <span className="block text-sm font-medium truncate">+ {selectedName ?? "Select agent"}+ </span>+ {selectedDescription && (+ <span className="block text-xs text-muted-foreground truncate">+ {selectedDescription}+ </span>+ )}+ </span>+ <ChevronDown className="size-3.5 text-muted-foreground shrink-0" />+ </button>+ }+ />+ </div>+ );+}++function OutputModeSection({+ mode,+ onChange,+}: {+ mode: AutopilotExecutionMode;+ onChange: (mode: AutopilotExecutionMode) => void;+}) {+ return (+ <div>+ <SectionLabel>Output mode</SectionLabel>+ <div className="space-y-1.5">+ {OUTPUT_MODES.map((o) => {+ const selected = o.value === mode;+ return (+ <button+ key={o.value}+ type="button"+ onClick={() => onChange(o.value)}+ className={cn(+ "w-full flex items-start gap-2.5 rounded-md border px-3 py-2 text-left cursor-pointer transition-colors",+ selected+ ? "border-primary bg-primary/5"+ : "bg-background hover:bg-accent/40",+ )}+ >+ <span+ className={cn(+ "mt-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-full border",+ selected+ ? "border-primary bg-primary text-primary-foreground"+ : "border-muted-foreground/40 bg-background",+ )}+ >+ {selected && <Check className="size-2.5" strokeWidth={3} />}+ </span>+ <span className="flex-1 min-w-0">+ <span className="block text-sm font-medium">{o.label}</span>+ <span className="block text-xs text-muted-foreground">+ {o.description}+ </span>+ </span>+ </button>+ );+ })}+ </div>+ </div>+ );+}++function ScheduleSection({+ config,+ onChange,+ disabled,+ disabledReason,+}: {+ config: TriggerConfig;+ onChange: (c: TriggerConfig) => void;+ disabled?: boolean;+ disabledReason?: string;+}) {+ const now = useNowTicker();+ const next = useMemo(() => computeNextRun(config, now), [config, now]);+ const timezones = useMemo(() => {+ const local = getLocalTimezone();+ if (TIMEZONE_OPTIONS.includes(local)) return TIMEZONE_OPTIONS;+ return [local, ...TIMEZONE_OPTIONS];+ }, []);++ const selectedDay = config.daysOfWeek[0] ?? 1;++ return (+ <div>+ <SectionLabel>Schedule</SectionLabel>+ <div+ className={cn(+ "space-y-2",+ disabled && "opacity-60 pointer-events-none",+ )}+ >+ {/* Row 1: Frequency + (Day when weekly) */}+ <div className="grid grid-cols-2 gap-2">+ <Select+ value={config.frequency}+ onValueChange={(v) =>+ v && onChange({ ...config, frequency: v as TriggerFrequency })+ }+ >+ <SelectTrigger className="w-full">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {FREQUENCY_OPTIONS.map((f) => (+ <SelectItem key={f.value} value={f.value}>+ {f.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ {config.frequency === "weekly" ? (+ <Select+ value={String(selectedDay)}+ onValueChange={(v) =>+ v && onChange({ ...config, daysOfWeek: [parseInt(v, 10)] })+ }+ >+ <SelectTrigger className="w-full">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {DAY_OPTIONS.map((d) => (+ <SelectItem key={d.value} value={String(d.value)}>+ {d.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ ) : (+ <div />+ )}+ </div>++ {/* Row 2: Time + Timezone (hidden for hourly / custom) */}+ {config.frequency === "custom" ? (+ <input+ type="text"+ value={config.cronExpression}+ onChange={(e) =>+ onChange({ ...config, cronExpression: e.target.value })+ }+ placeholder="0 9 * * 1-5"+ className="w-full rounded-lg border border-input bg-transparent px-2.5 py-1 h-8 text-sm font-mono outline-none transition-colors focus:border-ring focus:ring-3 focus:ring-ring/50 dark:bg-input/30"+ />+ ) : config.frequency === "hourly" ? (+ <TimeInput+ minuteOnly+ value={config.time}+ onChange={(v) => onChange({ ...config, time: v })}+ />+ ) : (+ <div className="grid grid-cols-2 gap-2">+ <TimeInput+ value={config.time}+ onChange={(v) => onChange({ ...config, time: v })}+ />+ <TimezonePicker+ value={config.timezone}+ onChange={(tz) => onChange({ ...config, timezone: tz })}+ options={timezones}+ />+ </div>+ )}++ {/* Next run preview */}+ {next && (+ <div className="flex items-center gap-1.5 text-xs text-muted-foreground pt-1">+ <Clock className="size-3 shrink-0" />+ <span className="truncate">+ Next run:{" "}+ <span className="text-foreground">+ {formatNextRunAbsolute(next, config.timezone)}+ </span>+ </span>+ <span className="ml-auto rounded-sm bg-muted px-1.5 py-0.5 text-[10px] font-medium text-foreground shrink-0">+ {formatCountdown(next, now)}+ </span>+ </div>+ )}+ </div>+ {disabled && disabledReason && (+ <p className="mt-2 text-[11px] text-muted-foreground">+ {disabledReason}+ </p>+ )}+ </div>+ );+}diff --git a/packages/views/autopilots/components/pickers/execution-mode-picker.tsx b/packages/views/autopilots/components/pickers/execution-mode-picker.tsxdeleted file mode 100644index dd2e919dfb..0000000000--- a/packages/views/autopilots/components/pickers/execution-mode-picker.tsx+++ /dev/null@@ -1,76 +0,0 @@-"use client";--import { useState } from "react";-import { FilePlus2, Play } from "lucide-react";-import type { AutopilotExecutionMode } from "@multica/core/types";-import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";-import {- PropertyPicker,- PickerItem,-} from "../../../issues/components/pickers/property-picker";--const OPTIONS: { value: AutopilotExecutionMode; label: string; description: string; Icon: typeof FilePlus2 }[] = [- { value: "create_issue", label: "Create Issue", description: "File an issue with the agent assigned", Icon: FilePlus2 },- { value: "run_only", label: "Run Only", description: "Run the agent without creating an issue", Icon: Play },-];--export function ExecutionModePicker({- mode,- onChange,- trigger: customTrigger,- triggerRender,- align = "start",-}: {- mode: AutopilotExecutionMode;- onChange: (mode: AutopilotExecutionMode) => void;- trigger?: React.ReactNode;- triggerRender?: React.ReactElement;- align?: "start" | "center" | "end";-}) {- const [open, setOpen] = useState(false);- const current = OPTIONS.find((o) => o.value === mode) ?? OPTIONS[0]!;- const CurrentIcon = current.Icon;-- return (- <PropertyPicker- open={open}- onOpenChange={setOpen}- width="w-52"- align={align}- triggerRender={triggerRender}- trigger={- customTrigger ?? (- <>- <CurrentIcon className="size-3 shrink-0" />- <span className="truncate">{current.label}</span>- </>- )- }- >- {OPTIONS.map((o) => {- const Icon = o.Icon;- return (- <Tooltip key={o.value}>- <TooltipTrigger- render={- <PickerItem- selected={o.value === mode}- onClick={() => {- onChange(o.value);- setOpen(false);- }}- >- <Icon className="size-3.5 shrink-0 text-muted-foreground" />- <span>{o.label}</span>- </PickerItem>- }- />- <TooltipContent side="right" sideOffset={8}>- {o.description}- </TooltipContent>- </Tooltip>- );- })}- </PropertyPicker>- );-}diff --git a/packages/views/autopilots/components/pickers/schedule-picker.tsx b/packages/views/autopilots/components/pickers/schedule-picker.tsxdeleted file mode 100644index 76c4569d37..0000000000--- a/packages/views/autopilots/components/pickers/schedule-picker.tsx+++ /dev/null@@ -1,32 +0,0 @@-"use client";--import { useState } from "react";-import {- Popover,- PopoverTrigger,- PopoverContent,-} from "@multica/ui/components/ui/popover";-import {- TriggerConfigSection,- type TriggerConfig,-} from "../trigger-config";--export function SchedulePicker({- config,- onChange,- triggerRender,-}: {- config: TriggerConfig;- onChange: (cfg: TriggerConfig) => void;- triggerRender: React.ReactElement;-}) {- const [open, setOpen] = useState(false);- return (- <Popover open={open} onOpenChange={setOpen}>- <PopoverTrigger render={triggerRender} />- <PopoverContent align="start" className="w-96 p-3">- <TriggerConfigSection config={config} onChange={onChange} />- </PopoverContent>- </Popover>- );-}diff --git a/packages/views/autopilots/components/pickers/timezone-picker.tsx b/packages/views/autopilots/components/pickers/timezone-picker.tsxnew file mode 100644index 0000000000..e4ee90ee8f--- /dev/null+++ b/packages/views/autopilots/components/pickers/timezone-picker.tsx@@ -0,0 +1,131 @@+"use client";++import { useMemo, useState } from "react";+import { Check, ChevronDown, Globe } from "lucide-react";+import { cn } from "@multica/ui/lib/utils";+import {+ PropertyPicker,+ PickerEmpty,+} from "../../../issues/components/pickers/property-picker";++export interface TimezonePickerProps {+ value: string;+ onChange: (tz: string) => void;+ options: string[];+ disabled?: boolean;+ className?: string;+}++function offsetFor(tz: string): string {+ try {+ const parts = new Intl.DateTimeFormat("en-US", {+ timeZone: tz,+ timeZoneName: "shortOffset",+ }).formatToParts(new Date());+ return parts.find((p) => p.type === "timeZoneName")?.value ?? "";+ } catch {+ return "";+ }+}++function cityLabel(tz: string): string {+ if (tz === "UTC") return "UTC";+ return tz.split("/").pop()?.replace(/_/g, " ") ?? tz;+}++export function TimezonePicker({+ value,+ onChange,+ options,+ disabled,+ className,+}: TimezonePickerProps) {+ const [open, setOpen] = useState(false);+ const [filter, setFilter] = useState("");++ const selectedCity = cityLabel(value);+ const selectedOffset = useMemo(() => offsetFor(value), [value]);++ const query = filter.trim().toLowerCase();+ const filteredOptions = useMemo(() => {+ if (!query) return options;+ return options.filter((tz) => {+ const haystack = `${tz} ${cityLabel(tz)} ${offsetFor(tz)}`.toLowerCase();+ return haystack.includes(query);+ });+ }, [options, query]);++ return (+ <PropertyPicker+ open={open}+ onOpenChange={(v) => {+ setOpen(v);+ if (!v) setFilter("");+ }}+ width="w-64"+ align="start"+ searchable+ searchPlaceholder="Search timezone..."+ onSearchChange={setFilter}+ triggerRender={+ <button+ type="button"+ disabled={disabled}+ className={cn(+ "flex h-8 w-full items-center gap-1.5 rounded-lg border border-input bg-transparent px-2.5 text-sm transition-colors outline-none",+ "hover:bg-accent/30",+ "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",+ "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",+ "dark:bg-input/30",+ className,+ )}+ />+ }+ trigger={+ <>+ <Globe className="size-3.5 shrink-0 text-muted-foreground" />+ <span className="flex-1 truncate text-left">{selectedCity}</span>+ {selectedOffset && (+ <span className="shrink-0 text-xs text-muted-foreground tabular-nums">+ {selectedOffset}+ </span>+ )}+ <ChevronDown className="size-3.5 shrink-0 text-muted-foreground" />+ </>+ }+ >+ {filteredOptions.length === 0 ? (+ <PickerEmpty />+ ) : (+ filteredOptions.map((tz) => {+ const off = offsetFor(tz);+ const isSelected = tz === value;+ return (+ <button+ key={tz}+ type="button"+ data-picker-item+ onClick={() => {+ onChange(tz);+ setOpen(false);+ }}+ className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-accent"+ >+ <span className="flex size-3.5 shrink-0 items-center justify-center">+ {isSelected && (+ <Check className="size-3.5 text-foreground" />+ )}+ </span>+ <span className="flex-1 truncate text-left">{cityLabel(tz)}</span>+ {off && (+ <span className="shrink-0 text-xs text-muted-foreground tabular-nums">+ {off}+ </span>+ )}+ </button>+ );+ })+ )}+ </PropertyPicker>+ );+}diff --git a/server/internal/handler/autopilot.go b/server/internal/handler/autopilot.goindex ebe02bf606..79891d9894 100644--- a/server/internal/handler/autopilot.go+++ b/server/internal/handler/autopilot.go@@ -24,11 +24,9 @@ func computeNextRun(cronExpr, timezone string) (time.Time, error) {type AutopilotResponse struct {ID string `json:"id"`WorkspaceID string `json:"workspace_id"`- ProjectID *string `json:"project_id"`Title string `json:"title"`Description *string `json:"description"`AssigneeID string `json:"assignee_id"`- Priority string `json:"priority"`Status string `json:"status"`ExecutionMode string `json:"execution_mode"`IssueTitleTemplate *string `json:"issue_title_template"`@@ -76,11 +74,9 @@ func autopilotToResponse(a db.Autopilot) AutopilotResponse {return AutopilotResponse{ID: uuidToString(a.ID),WorkspaceID: uuidToString(a.WorkspaceID),- ProjectID: uuidToPtr(a.ProjectID),Title: a.Title,Description: textToPtr(a.Description),AssigneeID: uuidToString(a.AssigneeID),- Priority: a.Priority,Status: a.Status,ExecutionMode: a.ExecutionMode,IssueTitleTemplate: textToPtr(a.IssueTitleTemplate),@@ -141,8 +137,6 @@ type CreateAutopilotRequest struct {Title string `json:"title"`Description *string `json:"description"`AssigneeID string `json:"assignee_id"`- ProjectID *string `json:"project_id"`- Priority string `json:"priority"`ExecutionMode string `json:"execution_mode"`IssueTitleTemplate *string `json:"issue_title_template"`}@@ -151,8 +145,6 @@ type UpdateAutopilotRequest struct {Title *string `json:"title"`Description *string `json:"description"`AssigneeID *string `json:"assignee_id"`- ProjectID *string `json:"project_id"`- Priority *string `json:"priority"`Status *string `json:"status"`ExecutionMode *string `json:"execution_mode"`IssueTitleTemplate *string `json:"issue_title_template"`@@ -268,26 +260,14 @@ func (h *Handler) CreateAutopilot(w http.ResponseWriter, r *http.Request) {return}- priority := req.Priority- if priority == "" {- priority = "none"- }-- var projectID pgtype.UUID- if req.ProjectID != nil {- projectID = parseUUID(*req.ProjectID)- }-autopilot, err := h.Queries.CreateAutopilot(r.Context(), db.CreateAutopilotParams{WorkspaceID: parseUUID(workspaceID),Title: req.Title,AssigneeID: parseUUID(req.AssigneeID),- Priority: priority,Status: "active",ExecutionMode: req.ExecutionMode,CreatedByType: "member",CreatedByID: parseUUID(userID),- ProjectID: projectID,Description: ptrToText(req.Description),IssueTitleTemplate: ptrToText(req.IssueTitleTemplate),})@@ -336,15 +316,11 @@ func (h *Handler) UpdateAutopilot(w http.ResponseWriter, r *http.Request) {ID: prev.ID,Description: prev.Description,AssigneeID: prev.AssigneeID,- ProjectID: prev.ProjectID,IssueTitleTemplate: prev.IssueTitleTemplate,}if req.Title != nil {params.Title = pgtype.Text{String: *req.Title, Valid: true}}- if req.Priority != nil {- params.Priority = pgtype.Text{String: *req.Priority, Valid: true}- }if req.Status != nil {params.Status = pgtype.Text{String: *req.Status, Valid: true}}@@ -369,13 +345,6 @@ func (h *Handler) UpdateAutopilot(w http.ResponseWriter, r *http.Request) {params.AssigneeID = parseUUID(*req.AssigneeID)}}- if _, ok := rawFields["project_id"]; ok {- if req.ProjectID != nil {- params.ProjectID = parseUUID(*req.ProjectID)- } else {- params.ProjectID = pgtype.UUID{Valid: false}- }- }autopilot, err := h.Queries.UpdateAutopilot(r.Context(), params)if err != nil {diff --git a/server/internal/service/autopilot.go b/server/internal/service/autopilot.goindex 38f3a59db4..f114a0049c 100644--- a/server/internal/service/autopilot.go+++ b/server/internal/service/autopilot.go@@ -117,7 +117,7 @@ func (s *AutopilotService) dispatchCreateIssue(ctx context.Context, ap db.AutopiTitle: title,Description: description,Status: "todo",- Priority: ap.Priority,+ Priority: "none",AssigneeType: pgtype.Text{String: "agent", Valid: true},AssigneeID: ap.AssigneeID,CreatorType: ap.CreatedByType,@@ -126,7 +126,7 @@ func (s *AutopilotService) dispatchCreateIssue(ctx context.Context, ap db.AutopiPosition: 0,DueDate: pgtype.Timestamptz{},Number: issueNumber,- ProjectID: ap.ProjectID,+ ProjectID: pgtype.UUID{},OriginType: pgtype.Text{String: "autopilot", Valid: true},OriginID: ap.ID,})@@ -190,7 +190,7 @@ func (s *AutopilotService) dispatchRunOnly(ctx context.Context, ap db.Autopilot,task, err := s.Queries.CreateAutopilotTask(ctx, db.CreateAutopilotTaskParams{AgentID: ap.AssigneeID,RuntimeID: agent.RuntimeID,- Priority: priorityToInt(ap.Priority),+ Priority: 0,AutopilotRunID: run.ID,})if err != nil {diff --git a/server/migrations/058_drop_autopilot_priority_and_project_id.down.sql b/server/migrations/058_drop_autopilot_priority_and_project_id.down.sqlnew file mode 100644index 0000000000..e48f3eae26--- /dev/null+++ b/server/migrations/058_drop_autopilot_priority_and_project_id.down.sql@@ -0,0 +1,3 @@+ALTER TABLE autopilot ADD COLUMN project_id UUID REFERENCES project(id) ON DELETE SET NULL;+ALTER TABLE autopilot ADD COLUMN priority TEXT NOT NULL DEFAULT 'medium'+ CHECK (priority IN ('urgent', 'high', 'medium', 'low', 'none'));diff --git a/server/migrations/058_drop_autopilot_priority_and_project_id.up.sql b/server/migrations/058_drop_autopilot_priority_and_project_id.up.sqlnew file mode 100644index 0000000000..07155b453d--- /dev/null+++ b/server/migrations/058_drop_autopilot_priority_and_project_id.up.sql@@ -0,0 +1,6 @@+-- Drop priority and project_id from autopilot.+-- These fields were never useful in the product: project_id was never exposed in the UI,+-- and priority was redundant with the agent's own task queue priority.++ALTER TABLE autopilot DROP COLUMN IF EXISTS priority;+ALTER TABLE autopilot DROP COLUMN IF EXISTS project_id;diff --git a/server/pkg/db/generated/autopilot.sql.go b/server/pkg/db/generated/autopilot.sql.goindex a1e159692f..270719f2de 100644--- a/server/pkg/db/generated/autopilot.sql.go+++ b/server/pkg/db/generated/autopilot.sql.go@@ -100,26 +100,24 @@ func (q *Queries) ClaimDueScheduleTriggers(ctx context.Context) ([]ClaimDueSchedconst createAutopilot = `-- name: CreateAutopilot :oneINSERT INTO autopilot (- workspace_id, project_id, title, description, assignee_id,- priority, status, execution_mode, issue_title_template,+ workspace_id, title, description, assignee_id,+ status, execution_mode, issue_title_template,created_by_type, created_by_id) VALUES (- $1, $9, $2, $10, $3,- $4, $5, $6, $11,- $7, $8-) RETURNING id, workspace_id, project_id, title, description, assignee_id, priority, status, execution_mode, issue_title_template, created_by_type, created_by_id, last_run_at, created_at, updated_at+ $1, $2, $8, $3,+ $4, $5, $9,+ $6, $7+) RETURNING id, workspace_id, title, description, assignee_id, status, execution_mode, issue_title_template, created_by_type, created_by_id, last_run_at, created_at, updated_at`type CreateAutopilotParams struct {WorkspaceID pgtype.UUID `json:"workspace_id"`Title string `json:"title"`AssigneeID pgtype.UUID `json:"assignee_id"`- Priority string `json:"priority"`Status string `json:"status"`ExecutionMode string `json:"execution_mode"`CreatedByType string `json:"created_by_type"`CreatedByID pgtype.UUID `json:"created_by_id"`- ProjectID pgtype.UUID `json:"project_id"`Description pgtype.Text `json:"description"`IssueTitleTemplate pgtype.Text `json:"issue_title_template"`}@@ -129,12 +127,10 @@ func (q *Queries) CreateAutopilot(ctx context.Context, arg CreateAutopilotParamsarg.WorkspaceID,arg.Title,arg.AssigneeID,- arg.Priority,arg.Status,arg.ExecutionMode,arg.CreatedByType,arg.CreatedByID,- arg.ProjectID,arg.Description,arg.IssueTitleTemplate,)@@ -142,11 +138,9 @@ func (q *Queries) CreateAutopilot(ctx context.Context, arg CreateAutopilotParamserr := row.Scan(&i.ID,&i.WorkspaceID,- &i.ProjectID,&i.Title,&i.Description,&i.AssigneeID,- &i.Priority,&i.Status,&i.ExecutionMode,&i.IssueTitleTemplate,@@ -342,7 +336,7 @@ func (q *Queries) FailAutopilotRunsByIssue(ctx context.Context, issueID pgtype.U}const getAutopilot = `-- name: GetAutopilot :one-SELECT id, workspace_id, project_id, title, description, assignee_id, priority, status, execution_mode, issue_title_template, created_by_type, created_by_id, last_run_at, created_at, updated_at FROM autopilot+SELECT id, workspace_id, title, description, assignee_id, status, execution_mode, issue_title_template, created_by_type, created_by_id, last_run_at, created_at, updated_at FROM autopilotWHERE id = $1`@@ -352,11 +346,9 @@ func (q *Queries) GetAutopilot(ctx context.Context, id pgtype.UUID) (Autopilot,err := row.Scan(&i.ID,&i.WorkspaceID,- &i.ProjectID,&i.Title,&i.Description,&i.AssigneeID,- &i.Priority,&i.Status,&i.ExecutionMode,&i.IssueTitleTemplate,@@ -370,7 +362,7 @@ func (q *Queries) GetAutopilot(ctx context.Context, id pgtype.UUID) (Autopilot,}const getAutopilotInWorkspace = `-- name: GetAutopilotInWorkspace :one-SELECT id, workspace_id, project_id, title, description, assignee_id, priority, status, execution_mode, issue_title_template, created_by_type, created_by_id, last_run_at, created_at, updated_at FROM autopilot+SELECT id, workspace_id, title, description, assignee_id, status, execution_mode, issue_title_template, created_by_type, created_by_id, last_run_at, created_at, updated_at FROM autopilotWHERE id = $1 AND workspace_id = $2`@@ -385,11 +377,9 @@ func (q *Queries) GetAutopilotInWorkspace(ctx context.Context, arg GetAutopilotIerr := row.Scan(&i.ID,&i.WorkspaceID,- &i.ProjectID,&i.Title,&i.Description,&i.AssigneeID,- &i.Priority,&i.Status,&i.ExecutionMode,&i.IssueTitleTemplate,@@ -576,7 +566,7 @@ func (q *Queries) ListAutopilotTriggers(ctx context.Context, autopilotID pgtype.const listAutopilots = `-- name: ListAutopilots :many-SELECT id, workspace_id, project_id, title, description, assignee_id, priority, status, execution_mode, issue_title_template, created_by_type, created_by_id, last_run_at, created_at, updated_at FROM autopilot+SELECT id, workspace_id, title, description, assignee_id, status, execution_mode, issue_title_template, created_by_type, created_by_id, last_run_at, created_at, updated_at FROM autopilotWHERE workspace_id = $1AND ($2::text IS NULL OR status = $2)ORDER BY created_at DESC@@ -602,11 +592,9 @@ func (q *Queries) ListAutopilots(ctx context.Context, arg ListAutopilotsParams)if err := rows.Scan(&i.ID,&i.WorkspaceID,- &i.ProjectID,&i.Title,&i.Description,&i.AssigneeID,- &i.Priority,&i.Status,&i.ExecutionMode,&i.IssueTitleTemplate,@@ -699,14 +687,12 @@ UPDATE autopilot SETtitle = COALESCE($2, title),description = COALESCE($3, description),assignee_id = COALESCE($4::uuid, assignee_id),- project_id = $5,- priority = COALESCE($6, priority),- status = COALESCE($7, status),- execution_mode = COALESCE($8, execution_mode),- issue_title_template = $9,+ status = COALESCE($5, status),+ execution_mode = COALESCE($6, execution_mode),+ issue_title_template = $7,updated_at = now()WHERE id = $1-RETURNING id, workspace_id, project_id, title, description, assignee_id, priority, status, execution_mode, issue_title_template, created_by_type, created_by_id, last_run_at, created_at, updated_at+RETURNING id, workspace_id, title, description, assignee_id, status, execution_mode, issue_title_template, created_by_type, created_by_id, last_run_at, created_at, updated_at`type UpdateAutopilotParams struct {@@ -714,8 +700,6 @@ type UpdateAutopilotParams struct {Title pgtype.Text `json:"title"`Description pgtype.Text `json:"description"`AssigneeID pgtype.UUID `json:"assignee_id"`- ProjectID pgtype.UUID `json:"project_id"`- Priority pgtype.Text `json:"priority"`Status pgtype.Text `json:"status"`ExecutionMode pgtype.Text `json:"execution_mode"`IssueTitleTemplate pgtype.Text `json:"issue_title_template"`@@ -727,8 +711,6 @@ func (q *Queries) UpdateAutopilot(ctx context.Context, arg UpdateAutopilotParamsarg.Title,arg.Description,arg.AssigneeID,- arg.ProjectID,- arg.Priority,arg.Status,arg.ExecutionMode,arg.IssueTitleTemplate,@@ -737,11 +719,9 @@ func (q *Queries) UpdateAutopilot(ctx context.Context, arg UpdateAutopilotParamserr := row.Scan(&i.ID,&i.WorkspaceID,- &i.ProjectID,&i.Title,&i.Description,&i.AssigneeID,- &i.Priority,&i.Status,&i.ExecutionMode,&i.IssueTitleTemplate,diff --git a/server/pkg/db/generated/models.go b/server/pkg/db/generated/models.goindex ddfaec4625..3eaebd66a4 100644--- a/server/pkg/db/generated/models.go+++ b/server/pkg/db/generated/models.go@@ -109,11 +109,9 @@ type Attachment struct {type Autopilot struct {ID pgtype.UUID `json:"id"`WorkspaceID pgtype.UUID `json:"workspace_id"`- ProjectID pgtype.UUID `json:"project_id"`Title string `json:"title"`Description pgtype.Text `json:"description"`AssigneeID pgtype.UUID `json:"assignee_id"`- Priority string `json:"priority"`Status string `json:"status"`ExecutionMode string `json:"execution_mode"`IssueTitleTemplate pgtype.Text `json:"issue_title_template"`diff --git a/server/pkg/db/queries/autopilot.sql b/server/pkg/db/queries/autopilot.sqlindex 057cda6935..3c316de3bf 100644--- a/server/pkg/db/queries/autopilot.sql+++ b/server/pkg/db/queries/autopilot.sql@@ -18,13 +18,13 @@ WHERE id = $1 AND workspace_id = $2;-- name: CreateAutopilot :oneINSERT INTO autopilot (- workspace_id, project_id, title, description, assignee_id,- priority, status, execution_mode, issue_title_template,+ workspace_id, title, description, assignee_id,+ status, execution_mode, issue_title_template,created_by_type, created_by_id) VALUES (- $1, sqlc.narg('project_id'), $2, sqlc.narg('description'), $3,- $4, $5, $6, sqlc.narg('issue_title_template'),- $7, $8+ $1, $2, sqlc.narg('description'), $3,+ $4, $5, sqlc.narg('issue_title_template'),+ $6, $7) RETURNING *;-- name: UpdateAutopilot :one@@ -32,8 +32,6 @@ UPDATE autopilot SETtitle = COALESCE(sqlc.narg('title'), title),description = COALESCE(sqlc.narg('description'), description),assignee_id = COALESCE(sqlc.narg('assignee_id')::uuid, assignee_id),- project_id = sqlc.narg('project_id'),- priority = COALESCE(sqlc.narg('priority'), priority),status = COALESCE(sqlc.narg('status'), status),execution_mode = COALESCE(sqlc.narg('execution_mode'), execution_mode),issue_title_template = sqlc.narg('issue_title_template'),