Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Redesign CoS Schedule page as a status card grid with a config drawer
[._.]/ Adam Eivy5ea5f012445a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex deaaf62fe8..e3aca9a5b2 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -1,5 +1,9 @@# Unreleased+## Chief of Staff++- **The CoS → Schedule page is now a scannable card grid instead of a flat expandable list.** Each task type renders as a status card you can read at a glance — a colored status dot (active / on-demand / waiting-on-deps / disabled), a **next-run countdown** ("in 3h", "Mon 9:00") that was previously computed server-side but never shown, an app-coverage bar with the enabled/total count kept front-and-center, and last-run/run-count. Cards sort by status then soonest next run (so what's about to run rises to the top), the All/Enabled toggle is replaced by per-status filters (Active / On-Demand / Waiting / Disabled), and a name filter box jumps to a task quickly. A **Run** button sits on each card — for app-targeting tasks it opens an app picker so the on-demand run carries app context (just like the old per-task controls), and falls back to a plain global run for tasks with no managed apps; **Configure** opens a slide-over drawer with the full per-task settings (interval, provider/model, prompt, agent options, dependencies, pipeline stages, and per-app overrides) — the same controls as before, now in a focused panel that's deep-linkable via `?task=` and closes on Esc/backdrop. Mobile collapses the grid to a single column.+## Local LLMs- **The Hugging Face model search now lets you pick a quantization, and defaults to the highest-fidelity build that fits your machine's memory.** Previously every GGUF repo installed a single auto-chosen Q4-ish quant, hiding larger variants (like a `…-BF16.gguf`) that a big-memory box can comfortably run. Each Hugging Face result now carries a **Quant** menu listing every GGUF variant in the repo (multi-part shards summed into one entry), with a per-quant fit hint — *fits comfortably* / *tight fit* / *exceeds RAM* — measured against your usable memory. The default selection is RAM-aware: PortOS reserves headroom for the OS and KV cache, then picks the largest variant that still fits (so a 128 GB unified-memory Mac defaults to BF16/Q8 where a 16 GB laptop stays on Q4), and you can override it per model. This is purely a file-picker improvement — these are all still GGUF files the existing Ollama/LM Studio runtimes already support; nothing about the GGUF-only requirement changed (raw safetensors/full-precision HF models need a different runtime and remain out of scope). Ollama installs via `hf.co/<repo>:<quant>`; LM Studio via `<repo>@<quant>`.diff --git a/client/src/components/cos/tabs/ScheduleTab.jsx b/client/src/components/cos/tabs/ScheduleTab.jsxindex cb1dafd304..cbccbe1a28 100644--- a/client/src/components/cos/tabs/ScheduleTab.jsx+++ b/client/src/components/cos/tabs/ScheduleTab.jsx@@ -6,6 +6,7 @@ import * as api from '../../../services/api';import Banner from '../../ui/Banner';import { CodeReviewDefaultsProvider } from '../../../hooks/useCodeReviewDefaults';import AppTaskTypeSection from './schedule/AppTaskTypeSection';+import TaskConfigDrawer from './schedule/TaskConfigDrawer';import { TASK_FILTERS, DEFAULT_FILTER_ID } from './schedule/scheduleConstants';export default function ScheduleTab({ apps }) {@@ -23,6 +24,15 @@ export default function ScheduleTab({ apps }) {setSearchParams(params, { replace: true });}, [searchParams, setSearchParams]);+ // The open config drawer is deep-linkable via ?task= per the URL-param convention.+ const selectedTask = searchParams.get('task');+ const setSelectedTask = useCallback((next) => {+ const params = new URLSearchParams(searchParams);+ if (next) params.set('task', next);+ else params.delete('task');+ setSearchParams(params, { replace: true });+ }, [searchParams, setSearchParams]);+const fetchSchedule = useCallback(async () => {const data = await api.getCosSchedule().catch(() => null);setSchedule(data);@@ -115,6 +125,9 @@ export default function ScheduleTab({ apps }) {}const improvementDisabled = schedule.improvementEnabled === false;+ const tasks = schedule.tasks || schedule.appImprovement || schedule.selfImprovement || {};+ const allTaskTypes = Object.keys(tasks);+ const selectedConfig = selectedTask ? tasks[selectedTask] : null;return (<CodeReviewDefaultsProvider>@@ -158,14 +171,10 @@ export default function ScheduleTab({ apps }) {)}<AppTaskTypeSection- tasks={schedule.tasks || schedule.appImprovement || schedule.selfImprovement}- onUpdate={handleUpdateTask}- onTrigger={handleTriggerAppImprovement}- onReset={handleResetTask}- providers={providers}+ tasks={tasks}apps={apps}- onUpdateOverride={handleUpdateAppOverride}- onBulkToggleOverride={handleBulkToggleOverride}+ onTrigger={handleTriggerAppImprovement}+ onSelectTask={setSelectedTask}improvementDisabled={improvementDisabled}filter={filter}onFilterChange={setFilter}@@ -176,6 +185,22 @@ export default function ScheduleTab({ apps }) {Schedule last updated: {new Date(schedule.lastUpdated).toLocaleString()}</div>)}++ <TaskConfigDrawer+ open={!!selectedConfig}+ taskType={selectedTask}+ config={selectedConfig}+ onClose={() => setSelectedTask(null)}+ onUpdate={handleUpdateTask}+ onTrigger={handleTriggerAppImprovement}+ onReset={handleResetTask}+ providers={providers}+ apps={apps}+ onUpdateOverride={handleUpdateAppOverride}+ onBulkToggleOverride={handleBulkToggleOverride}+ allTaskTypes={allTaskTypes}+ improvementDisabled={improvementDisabled}+ /></div></CodeReviewDefaultsProvider>);diff --git a/client/src/components/cos/tabs/schedule/AppTaskCard.jsx b/client/src/components/cos/tabs/schedule/AppTaskCard.jsxnew file mode 100644index 0000000000..8c757c4804--- /dev/null+++ b/client/src/components/cos/tabs/schedule/AppTaskCard.jsx@@ -0,0 +1,80 @@+import { Clock, AlertTriangle, SlidersHorizontal } from 'lucide-react';+import { timeAgo } from '../../../../utils/formatters';+import { describeNextRun, coverageTone } from './scheduleConstants';+import TaskHeader from './TaskHeader';+import RunTaskButton from './RunTaskButton';++// One scheduled task rendered as a status-rich card. Browsing happens here;+// detailed configuration lives in the slide-over drawer (opened via Configure).+export default function AppTaskCard({ taskType, config, apps, onTrigger, onConfigure, improvementDisabled }) {+ const enabledCount = config.enabledAppCount ?? 0;+ const totalCount = config.totalAppCount ?? 0;+ const hasApps = totalCount > 0;+ const coverage = coverageTone(enabledCount, totalCount);+ const coveragePct = hasApps ? Math.round((enabledCount / totalCount) * 100) : 0;+ const nextRun = describeNextRun(config);++ return (+ <div className="flex flex-col border border-port-border rounded-lg bg-port-card hover:border-port-border/60 transition-colors">+ <button+ type="button"+ onClick={() => onConfigure(taskType)}+ className="flex-1 text-left p-4 space-y-3 rounded-t-lg hover:bg-port-card/60 transition-colors"+ >+ <TaskHeader taskType={taskType} config={config} />++ {/* Next run */}+ <div className="flex items-center gap-1.5 text-xs min-w-0">+ <Clock size={12} className="text-gray-500 shrink-0" />+ <span className={`${nextRun.tone} flex items-center gap-1 min-w-0`} title={nextRun.title}>+ {nextRun.warn && <AlertTriangle size={12} className="shrink-0" />}+ <span className="truncate">{nextRun.text}</span>+ </span>+ </div>++ {/* App coverage — kept prominent with a mini bar */}+ {hasApps && (+ <div className="space-y-1">+ <div className="flex items-center justify-between text-xs">+ <span className="text-gray-400">App coverage</span>+ <span className={coverage.text}>{enabledCount}/{totalCount} apps</span>+ </div>+ <div className="h-1.5 w-full rounded-full bg-port-border/60 overflow-hidden">+ <div className={`h-full rounded-full ${coverage.bar}`} style={{ width: `${coveragePct}%` }} />+ </div>+ </div>+ )}++ {/* Last run + dependencies */}+ <div className="text-xs text-gray-500 space-y-0.5">+ <div>+ {config.globalLastRun+ ? `Last run ${timeAgo(config.globalLastRun)} · ${config.globalRunCount || 0}×`+ : 'Never run'}+ </div>+ {config.runAfter?.length > 0 && (+ <div className="truncate">after: {config.runAfter.join(', ')}</div>+ )}+ </div>+ </button>++ {/* Footer actions */}+ <div className="flex items-center gap-2 px-4 py-2.5 border-t border-port-border">+ <RunTaskButton+ taskType={taskType}+ apps={apps}+ onTrigger={onTrigger}+ improvementDisabled={improvementDisabled}+ />+ <button+ type="button"+ onClick={() => onConfigure(taskType)}+ className="ml-auto flex items-center gap-1.5 px-3 py-1.5 text-sm rounded text-gray-300 hover:text-white hover:bg-port-border/50 transition-colors"+ >+ <SlidersHorizontal size={13} />+ Configure+ </button>+ </div>+ </div>+ );+}diff --git a/client/src/components/cos/tabs/schedule/AppTaskCard.test.jsx b/client/src/components/cos/tabs/schedule/AppTaskCard.test.jsxnew file mode 100644index 0000000000..eaf34f5c3b--- /dev/null+++ b/client/src/components/cos/tabs/schedule/AppTaskCard.test.jsx@@ -0,0 +1,87 @@+import { describe, it, expect, vi } from 'vitest';+import { render, screen, fireEvent } from '@testing-library/react';+import AppTaskCard from './AppTaskCard';++const baseConfig = {+ enabled: true,+ type: 'daily',+ enabledAppCount: 3,+ totalAppCount: 5,+ globalRunCount: 12,+ globalLastRun: '2026-06-20T10:00:00Z',+ status: { nextRunAt: '2999-01-01T00:00:00Z' },+};++function renderCard(overrides = {}, props = {}) {+ const onTrigger = vi.fn();+ const onConfigure = vi.fn();+ render(+ <AppTaskCard+ taskType="code-review"+ config={{ ...baseConfig, ...overrides }}+ onTrigger={onTrigger}+ onConfigure={onConfigure}+ {...props}+ />+ );+ return { onTrigger, onConfigure };+}++describe('AppTaskCard', () => {+ it('shows app coverage prominently', () => {+ renderCard();+ expect(screen.getByText('3/5 apps')).toBeTruthy();+ expect(screen.getByText('App coverage')).toBeTruthy();+ });++ it('shows a future next-run countdown for active scheduled tasks', () => {+ renderCard();+ // timeUntil for a year-2999 date returns an "in …" string.+ expect(screen.getByText(/^in /)).toBeTruthy();+ });++ it('shows "Manual trigger only" for on-demand tasks', () => {+ renderCard({ type: 'on-demand' });+ expect(screen.getByText('Manual trigger only')).toBeTruthy();+ });++ it('shows "Paused" for disabled tasks', () => {+ renderCard({ enabled: false });+ expect(screen.getByText('Paused')).toBeTruthy();+ });++ it('shows the dependency wait state', () => {+ renderCard({ status: { reason: 'waiting-on-dependencies', pendingDeps: ['build'] } });+ expect(screen.getByText(/waiting on build/)).toBeTruthy();+ });++ it('fires a global on-demand run when the task has no managed apps', () => {+ const { onTrigger, onConfigure } = renderCard();+ fireEvent.click(screen.getByRole('button', { name: /Run Now/i }));+ fireEvent.click(screen.getByRole('button', { name: /Configure/ }));+ expect(onTrigger).toHaveBeenCalledWith('code-review');+ expect(onConfigure).toHaveBeenCalledWith('code-review');+ });++ it('runs with app context via the app picker when the task targets apps', () => {+ const apps = [{ id: 'app-1', name: 'Widget App' }, { id: 'app-2', name: 'Archived', archived: true }];+ const { onTrigger } = renderCard({}, { apps });+ // With apps present the quick action becomes a "Run on App" picker, not a contextless run.+ fireEvent.click(screen.getByRole('button', { name: /Run on App/i }));+ fireEvent.click(screen.getByRole('button', { name: /Widget App/ }));+ expect(onTrigger).toHaveBeenCalledWith('code-review', 'app-1');+ // Archived apps are excluded from the picker.+ expect(screen.queryByText('Archived')).toBeNull();+ });++ it('does not trigger when improvement is disabled', () => {+ const { onTrigger } = renderCard({}, { improvementDisabled: true });+ fireEvent.click(screen.getByRole('button', { name: /Run Now/i }));+ expect(onTrigger).not.toHaveBeenCalled();+ });++ it('shows never-run state when no prior run', () => {+ renderCard({ globalLastRun: null });+ expect(screen.getByText('Never run')).toBeTruthy();+ });+});diff --git a/client/src/components/cos/tabs/schedule/AppTaskTypeRow.jsx b/client/src/components/cos/tabs/schedule/AppTaskTypeRow.jsxdeleted file mode 100644index a8d4cd5efc..0000000000--- a/client/src/components/cos/tabs/schedule/AppTaskTypeRow.jsx+++ /dev/null@@ -1,113 +0,0 @@-import { useState } from 'react';-import { ChevronDown, ChevronRight, GitMerge } from 'lucide-react';-import { badge } from './scheduleConstants';-import IntervalBadge from './IntervalBadge';-import PipelineStageConfig from './PipelineStageConfig';-import GlobalConfigControls from './GlobalConfigControls';-import PerAppOverrideList from './PerAppOverrideList';--export default function AppTaskTypeRow({ taskType, config, onUpdate, onTrigger, onReset, providers, apps, onUpdateOverride, onBulkToggleOverride, allTaskTypes, improvementDisabled }) {- const [expanded, setExpanded] = useState(false);- const [updating, setUpdating] = useState(false);-- const enabledCount = config.enabledAppCount ?? 0;- const totalCount = config.totalAppCount ?? 0;-- return (- <div className="border border-port-border rounded-lg">- <div- className={`flex items-center gap-3 p-3 bg-port-card hover:bg-port-card/80 cursor-pointer ${expanded ? 'rounded-t-lg' : 'rounded-lg'}`}- onClick={() => setExpanded(!expanded)}- >- <button- className="text-gray-500 hover:text-white"- onClick={(e) => { e.stopPropagation(); setExpanded(!expanded); }}- aria-label={expanded ? 'Collapse' : 'Expand'}- >- {expanded ? <ChevronDown size={16} /> : <ChevronRight size={16} />}- </button>-- <div className="flex-1 min-w-0">- <div className="flex items-center gap-2">- <span className="font-mono text-sm text-white">{taskType}</span>- {!config.enabled && (- <span className={badge('gray')}>Disabled</span>- )}- {config.status?.reason === 'waiting-on-dependencies' && (- <span className={badge('warning')} title={`Waiting for: ${config.status.pendingDeps?.join(', ')}`}>- Waiting on deps- </span>- )}- </div>- <div className="flex items-center gap-2 text-xs text-gray-500 flex-wrap">- {config.globalLastRun && (- <span>Last run: {new Date(config.globalLastRun).toLocaleDateString()} ({config.globalRunCount || 0} total)</span>- )}- {config.runAfter?.length > 0 && (- <span className="text-gray-500">after: {config.runAfter.join(', ')}</span>- )}- </div>- </div>-- <div className="flex items-center gap-2 shrink-0">- {config.taskMetadata?.pipeline?.stages?.length > 0 && (- <span className={badge('purple')} title={config.taskMetadata.pipeline.stages.map(s => s.name).join(' → ')}>- <GitMerge size={11} className="inline mr-1" />- {config.taskMetadata.pipeline.stages.length}-stage- </span>- )}- {totalCount > 0 && (- <span className={badge(- enabledCount === totalCount ? 'success' :- enabledCount === 0 ? 'error' : 'warning'- )}>- {enabledCount}/{totalCount} apps- </span>- )}- <IntervalBadge type={config.type} cronExpression={config.cronExpression} />- </div>- </div>-- {expanded && (- <div className="p-4 border-t border-port-border bg-port-bg/50 space-y-6">- {config.taskMetadata?.pipeline?.stages?.length > 0 && (- <PipelineStageConfig- taskType={taskType}- config={config}- providers={providers}- onUpdate={onUpdate}- updating={updating}- setUpdating={setUpdating}- />- )}-- <div>- <h4 className="text-sm font-medium text-gray-400 mb-3">Global Defaults</h4>- <GlobalConfigControls- taskType={taskType}- config={config}- onUpdate={onUpdate}- onTrigger={onTrigger}- onReset={onReset}- category="appImprovement"- providers={providers}- apps={apps}- updating={updating}- setUpdating={setUpdating}- allTaskTypes={allTaskTypes}- improvementDisabled={improvementDisabled}- />- </div>-- <PerAppOverrideList- taskType={taskType}- config={config}- apps={apps}- onUpdateOverride={onUpdateOverride}- onBulkToggleOverride={onBulkToggleOverride}- />- </div>- )}- </div>- );-}diff --git a/client/src/components/cos/tabs/schedule/AppTaskTypeSection.jsx b/client/src/components/cos/tabs/schedule/AppTaskTypeSection.jsxindex 121d6dadfb..6da2306e6b 100644--- a/client/src/components/cos/tabs/schedule/AppTaskTypeSection.jsx+++ b/client/src/components/cos/tabs/schedule/AppTaskTypeSection.jsx@@ -1,20 +1,32 @@-import AppTaskTypeRow from './AppTaskTypeRow';-import { TASK_FILTERS, DEFAULT_FILTER_ID } from './scheduleConstants';+import { useState } from 'react';+import { Search, X } from 'lucide-react';+import AppTaskCard from './AppTaskCard';+import { TASK_FILTERS, DEFAULT_FILTER_ID, taskSortKey } from './scheduleConstants';-export default function AppTaskTypeSection({ tasks, onUpdate, onTrigger, onReset, providers, apps, onUpdateOverride, onBulkToggleOverride, improvementDisabled, filter, onFilterChange }) {- const taskEntries = Object.entries(tasks || {}).sort(([a], [b]) => a.localeCompare(b));- if (taskEntries.length === 0) return null;+export default function AppTaskTypeSection({ tasks, apps, onTrigger, onSelectTask, improvementDisabled, filter, onFilterChange }) {+ const [search, setSearch] = useState('');+ const taskEntries = Object.entries(tasks || {});const activeFilter = TASK_FILTERS.find(f => f.id === filter) || TASK_FILTERS[0];- const allTaskTypes = taskEntries.map(([taskType]) => taskType);- const visibleEntries = taskEntries.filter(activeFilter.match);const counts = Object.fromEntries(TASK_FILTERS.map(f => [f.id, taskEntries.filter(f.match).length]));+ const query = search.trim().toLowerCase();+ const visibleEntries = taskEntries+ .filter(activeFilter.match)+ .filter(([taskType]) => !query || taskType.toLowerCase().includes(query))+ .sort(([aType, aConfig], [bType, bConfig]) => {+ const a = taskSortKey(aType, aConfig);+ const b = taskSortKey(bType, bConfig);+ return a.order - b.order || a.next - b.next || a.taskType.localeCompare(b.taskType);+ });++ if (taskEntries.length === 0) return null;+return (<div className="space-y-3"><div className="flex items-center gap-2 flex-wrap"><h3 className="text-lg font-semibold text-white">Improvement Tasks</h3>- <div className="flex items-center gap-1 ml-auto">+ <div className="flex items-center gap-1 ml-auto flex-wrap">{TASK_FILTERS.map(f => {const active = activeFilter.id === f.id;return (@@ -35,30 +47,50 @@ export default function AppTaskTypeSection({ tasks, onUpdate, onTrigger, onReset</div></div><p className="text-sm text-gray-400">- Tasks that analyze and improve PortOS and managed apps. Expand a task to configure per-app overrides.+ Tasks that analyze and improve PortOS and managed apps. Click a card to configure schedule and per-app overrides.</p>++ <div className="relative max-w-sm">+ <Search size={14} className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-500 pointer-events-none" />+ <input+ type="text"+ value={search}+ onChange={(e) => setSearch(e.target.value)}+ placeholder="Filter tasks by name…"+ aria-label="Filter tasks by name"+ className="w-full bg-port-card border border-port-border rounded-lg pl-9 pr-9 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-port-accent/50"+ />+ {search && (+ <button+ type="button"+ onClick={() => setSearch('')}+ aria-label="Clear filter"+ className="absolute right-2 top-1/2 -translate-y-1/2 p-1 text-gray-500 hover:text-white"+ >+ <X size={14} />+ </button>+ )}+ </div>+{visibleEntries.length === 0 ? (<div className="text-center py-8 text-gray-500 border border-dashed border-port-border rounded-lg">- {activeFilter.emptyMessage}{' '}- {activeFilter.id !== DEFAULT_FILTER_ID && (- <button onClick={() => onFilterChange(DEFAULT_FILTER_ID)} className="text-port-accent hover:underline">Show all</button>- )}+ {query+ ? <>No tasks match “{search.trim()}”. <button onClick={() => setSearch('')} className="text-port-accent hover:underline">Clear filter</button></>+ : <>{activeFilter.emptyMessage}{' '}+ {activeFilter.id !== DEFAULT_FILTER_ID && (+ <button onClick={() => onFilterChange(DEFAULT_FILTER_ID)} className="text-port-accent hover:underline">Show all</button>+ )}</>}</div>) : (- <div className="space-y-2">+ <div className="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-3">{visibleEntries.map(([taskType, config]) => (- <AppTaskTypeRow+ <AppTaskCardkey={taskType}taskType={taskType}config={config}- onUpdate={onUpdate}- onTrigger={onTrigger}- onReset={onReset}- providers={providers}apps={apps}- onUpdateOverride={onUpdateOverride}- onBulkToggleOverride={onBulkToggleOverride}- allTaskTypes={allTaskTypes}+ onTrigger={onTrigger}+ onConfigure={onSelectTask}improvementDisabled={improvementDisabled}/>))}diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsxindex 0f2077945b..42bcdf8a41 100644--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx@@ -1,5 +1,5 @@-import { useState, useEffect, useRef } from 'react';-import { Play, RotateCcw, ChevronDown, AlertCircle, Package, Info } from 'lucide-react';+import { useState, useEffect } from 'react';+import { RotateCcw, AlertCircle, Info } from 'lucide-react';import CronInput from '../../../CronInput';import { AGENT_OPTIONS, DEFAULT_REVIEW_STOP_MODE, PR_AUTHOR_FILTER_OPTIONS, ISSUE_AUTHOR_FILTER_OPTIONS, ISSUE_AUTHOR_FILTER_TASK_TYPES } from '../../constants';import ReviewerPicker from '../../ReviewerPicker';@@ -8,7 +8,8 @@ import { useCodeReviewDefaults } from '../../../../hooks/useCodeReviewDefaults';import ToggleSwitch from '../../../ToggleSwitch';import { filterSelectableModels } from '../../../../utils/providers';import PromptEditor from './PromptEditor';-import { INTERVAL_DESCRIPTIONS, IMPROVEMENT_DISABLED_TITLE, triggerButtonClass, toggleMetadataField } from './scheduleConstants';+import RunTaskButton from './RunTaskButton';+import { INTERVAL_DESCRIPTIONS, toggleMetadataField } from './scheduleConstants';export default function GlobalConfigControls({ taskType, config, onUpdate, onTrigger, onReset, category: _category, providers, apps, updating, setUpdating, allTaskTypes, improvementDisabled }) {const reviewDefaults = useCodeReviewDefaults();@@ -17,8 +18,6 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTriconst [selectedModel, setSelectedModel] = useState(config.model || '');const [editingPrompt, setEditingPrompt] = useState(false);const [promptValue, setPromptValue] = useState(config.prompt || '');- const [showAppSelector, setShowAppSelector] = useState(false);- const appSelectorRef = useRef(null);useEffect(() => {setSelectedType(config.type);@@ -29,23 +28,6 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTri}}, [config.type, config.providerId, config.model, config.prompt, editingPrompt]);- useEffect(() => {- const handleClickOutside = (event) => {- if (appSelectorRef.current && !appSelectorRef.current.contains(event.target)) {- setShowAppSelector(false);- }- };- if (showAppSelector) {- document.addEventListener('mousedown', handleClickOutside);- return () => document.removeEventListener('mousedown', handleClickOutside);- }- }, [showAppSelector]);-- // Without this, an open dropdown survives a flip to disabled and pops back open when the master flag re-enables.- useEffect(() => {- if (improvementDisabled) setShowAppSelector(false);- }, [improvementDisabled]);-const activeApps = apps?.filter(app => !app.archived) || [];const [cronEditing, setCronEditing] = useState(false);@@ -370,57 +352,12 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTri)}<div className="flex gap-2">- {activeApps.length > 0 ? (- <div className="relative" ref={appSelectorRef}>- {/* Tooltip on the wrapper, not the button: most browsers skip hover events on disabled controls. */}- <span title={improvementDisabled ? IMPROVEMENT_DISABLED_TITLE : 'Run this task on a specific app'} className="inline-block">- <button- onClick={() => !improvementDisabled && setShowAppSelector(!showAppSelector)}- disabled={improvementDisabled}- aria-disabled={improvementDisabled || undefined}- className={triggerButtonClass(improvementDisabled)}- >- <Play size={14} />- Run on App- <ChevronDown size={12} className={`transition-transform ${showAppSelector ? 'rotate-180' : ''}`} />- </button>- </span>- {showAppSelector && !improvementDisabled && (- <div className="absolute bottom-full left-0 mb-1 z-50 w-64 max-w-[calc(100vw-2rem)] max-h-64 overflow-y-auto bg-port-card border border-port-border rounded-lg shadow-lg">- <div className="p-2 border-b border-port-border">- <span className="text-xs text-gray-400">Select an app to run {taskType} on:</span>- </div>- <div className="py-1">- {activeApps.map(app => (- <button- key={app.id}- onClick={() => { onTrigger(taskType, app.id); setShowAppSelector(false); }}- className="w-full px-3 py-2 text-left text-sm hover:bg-port-border/50 flex items-center gap-2 min-h-[40px]"- >- <Package size={14} className="text-gray-400 shrink-0" />- <div className="min-w-0 flex-1">- <div className="text-white truncate">{app.name}</div>- {app.repoPath && <div className="text-xs text-gray-500 truncate">{app.repoPath}</div>}- </div>- </button>- ))}- </div>- </div>- )}- </div>- ) : (- <span title={improvementDisabled ? IMPROVEMENT_DISABLED_TITLE : 'Run this task immediately (bypasses schedule)'} className="inline-block">- <button- onClick={() => onTrigger(taskType)}- disabled={improvementDisabled}- aria-disabled={improvementDisabled || undefined}- className={triggerButtonClass(improvementDisabled)}- >- <Play size={14} />- Run Now- </button>- </span>- )}+ <RunTaskButton+ taskType={taskType}+ apps={apps}+ onTrigger={onTrigger}+ improvementDisabled={improvementDisabled}+ />{config.type === 'once' && status.reason === 'once-completed' && (<buttononClick={() => onReset(taskType)}diff --git a/client/src/components/cos/tabs/schedule/RunTaskButton.jsx b/client/src/components/cos/tabs/schedule/RunTaskButton.jsxnew file mode 100644index 0000000000..5b7063e128--- /dev/null+++ b/client/src/components/cos/tabs/schedule/RunTaskButton.jsx@@ -0,0 +1,84 @@+import { useState, useRef, useEffect } from 'react';+import { Play, ChevronDown, Package } from 'lucide-react';+import { triggerButtonClass, IMPROVEMENT_DISABLED_TITLE } from './scheduleConstants';++// Trigger an on-demand run. When the task targets managed apps, opens a picker+// so the run carries app context; otherwise fires a plain global run. Shared by+// the schedule card and the drawer's global-config controls so both stay in sync.+export default function RunTaskButton({ taskType, apps, onTrigger, improvementDisabled }) {+ const [open, setOpen] = useState(false);+ const ref = useRef(null);+ const activeApps = apps?.filter(app => !app.archived) || [];++ useEffect(() => {+ if (!open) return;+ const onClickOutside = (e) => { if (ref.current && !ref.current.contains(e.target)) setOpen(false); };+ document.addEventListener('mousedown', onClickOutside);+ return () => document.removeEventListener('mousedown', onClickOutside);+ }, [open]);++ // Without this, an open dropdown survives a flip to disabled and pops back open when re-enabled.+ useEffect(() => {+ if (improvementDisabled) setOpen(false);+ }, [improvementDisabled]);++ if (activeApps.length === 0) {+ return (+ <span title={improvementDisabled ? IMPROVEMENT_DISABLED_TITLE : 'Run this task immediately (bypasses schedule)'} className="inline-block">+ <button+ type="button"+ onClick={() => !improvementDisabled && onTrigger(taskType)}+ disabled={improvementDisabled}+ aria-disabled={improvementDisabled || undefined}+ className={triggerButtonClass(improvementDisabled)}+ >+ <Play size={14} />+ Run Now+ </button>+ </span>+ );+ }++ return (+ <div className="relative" ref={ref}>+ {/* Tooltip on the wrapper, not the button: most browsers skip hover events on disabled controls. */}+ <span title={improvementDisabled ? IMPROVEMENT_DISABLED_TITLE : 'Run this task on a specific app'} className="inline-block">+ <button+ type="button"+ onClick={() => !improvementDisabled && setOpen(o => !o)}+ disabled={improvementDisabled}+ aria-disabled={improvementDisabled || undefined}+ aria-expanded={open}+ className={triggerButtonClass(improvementDisabled)}+ >+ <Play size={14} />+ Run on App+ <ChevronDown size={12} className={`transition-transform ${open ? 'rotate-180' : ''}`} />+ </button>+ </span>+ {open && !improvementDisabled && (+ <div className="port-menu-surface absolute bottom-full left-0 mb-1 z-50 w-64 max-w-[calc(100vw-2rem)] max-h-64 overflow-y-auto border border-port-border rounded-lg shadow-lg">+ <div className="p-2 border-b border-port-border">+ <span className="text-xs text-gray-400">Select an app to run {taskType} on:</span>+ </div>+ <div className="py-1">+ {activeApps.map(app => (+ <button+ key={app.id}+ type="button"+ onClick={() => { onTrigger(taskType, app.id); setOpen(false); }}+ className="w-full px-3 py-2 text-left text-sm hover:bg-port-border/50 flex items-center gap-2 min-h-[40px]"+ >+ <Package size={14} className="text-gray-400 shrink-0" />+ <div className="min-w-0 flex-1">+ <div className="text-white truncate">{app.name}</div>+ {app.repoPath && <div className="text-xs text-gray-500 truncate">{app.repoPath}</div>}+ </div>+ </button>+ ))}+ </div>+ </div>+ )}+ </div>+ );+}diff --git a/client/src/components/cos/tabs/schedule/TaskConfigDrawer.jsx b/client/src/components/cos/tabs/schedule/TaskConfigDrawer.jsxnew file mode 100644index 0000000000..1e1206072c--- /dev/null+++ b/client/src/components/cos/tabs/schedule/TaskConfigDrawer.jsx@@ -0,0 +1,80 @@+import { useState } from 'react';+import Drawer from '../../../Drawer';+import TaskHeader from './TaskHeader';+import PipelineStageConfig from './PipelineStageConfig';+import GlobalConfigControls from './GlobalConfigControls';+import PerAppOverrideList from './PerAppOverrideList';++// Slide-over panel holding the full configuration for a single task.+// Receives the live config object so it re-renders against the freshest+// schedule after each onUpdate refetch.+export default function TaskConfigDrawer({+ open,+ taskType,+ config,+ onClose,+ onUpdate,+ onTrigger,+ onReset,+ providers,+ apps,+ onUpdateOverride,+ onBulkToggleOverride,+ allTaskTypes,+ improvementDisabled,+}) {+ const [updating, setUpdating] = useState(false);++ return (+ <Drawer+ open={open && !!config}+ onClose={onClose}+ title={taskType || 'Task'}+ widthClass="sm:w-[560px]"+ closeOnEsc={!updating}+ >+ {config && (+ <div className="space-y-6">+ <TaskHeader taskType={taskType} config={config} />++ {config.taskMetadata?.pipeline?.stages?.length > 0 && (+ <PipelineStageConfig+ taskType={taskType}+ config={config}+ providers={providers}+ onUpdate={onUpdate}+ updating={updating}+ setUpdating={setUpdating}+ />+ )}++ <div>+ <h4 className="text-sm font-medium text-gray-400 mb-3">Global Defaults</h4>+ <GlobalConfigControls+ taskType={taskType}+ config={config}+ onUpdate={onUpdate}+ onTrigger={onTrigger}+ onReset={onReset}+ category="appImprovement"+ providers={providers}+ apps={apps}+ updating={updating}+ setUpdating={setUpdating}+ allTaskTypes={allTaskTypes}+ improvementDisabled={improvementDisabled}+ />+ </div>++ <PerAppOverrideList+ taskType={taskType}+ config={config}+ apps={apps}+ onUpdateOverride={onUpdateOverride}+ onBulkToggleOverride={onBulkToggleOverride}+ />+ </div>+ )}+ </Drawer>+ );+}diff --git a/client/src/components/cos/tabs/schedule/TaskHeader.jsx b/client/src/components/cos/tabs/schedule/TaskHeader.jsxnew file mode 100644index 0000000000..8161f944ac--- /dev/null+++ b/client/src/components/cos/tabs/schedule/TaskHeader.jsx@@ -0,0 +1,26 @@+import { GitMerge } from 'lucide-react';+import { badge, statusDot, getTaskStatusGroup } from './scheduleConstants';+import IntervalBadge from './IntervalBadge';++// Shared task identity row — status dot, monospace name, pipeline badge, and+// interval badge. Used by both the schedule card and the config drawer so the+// header stays consistent in one place.+export default function TaskHeader({ taskType, config }) {+ const group = getTaskStatusGroup(config);+ const stages = config.taskMetadata?.pipeline?.stages;+ return (+ <div className="flex items-start gap-2">+ <span className={`mt-1.5 w-2 h-2 rounded-full shrink-0 ${statusDot(group)}`} title={group} aria-hidden="true" />+ <span className="font-mono text-sm text-white break-all leading-tight flex-1 min-w-0">{taskType}</span>+ <div className="flex items-center gap-1.5 shrink-0">+ {stages?.length > 0 && (+ <span className={badge('purple')} title={stages.map(s => s.name).join(' → ')}>+ <GitMerge size={11} className="inline mr-0.5" />+ {stages.length}+ </span>+ )}+ <IntervalBadge type={config.type} cronExpression={config.cronExpression} />+ </div>+ </div>+ );+}diff --git a/client/src/components/cos/tabs/schedule/scheduleConstants.js b/client/src/components/cos/tabs/schedule/scheduleConstants.jsindex a7f25385e4..93bef9f39c 100644--- a/client/src/components/cos/tabs/schedule/scheduleConstants.js+++ b/client/src/components/cos/tabs/schedule/scheduleConstants.js@@ -1,4 +1,5 @@// Shared constants and pure helpers for the CoS Schedule tab subcomponents.+import { timeUntil } from '../../../../utils/formatters';export const INTERVAL_LABELS = {rotation: 'Rotation',@@ -45,9 +46,70 @@ export const INTERVAL_BADGE_VARIANT = {cron: 'cyan',};+// --- Status grouping -------------------------------------------------------+// A task falls into exactly one status group, used for the status dot, grid+// ordering, and the status filters. Order here is the grid sort order.+export const STATUS_GROUPS = {+ active: { label: 'Active', dot: 'bg-port-success', order: 0 },+ 'on-demand': { label: 'On-Demand', dot: 'bg-gray-400', order: 1 },+ waiting: { label: 'Waiting', dot: 'bg-port-warning', order: 2 },+ disabled: { label: 'Disabled', dot: 'bg-gray-600', order: 3 },+};++// Classify a task config into one status group (mutually exclusive).+// Disabled wins over everything; then dependency-wait; then on-demand type.+export function getTaskStatusGroup(config) {+ if (!config?.enabled) return 'disabled';+ if (config.status?.reason === 'waiting-on-dependencies') return 'waiting';+ if (config.type === 'on-demand') return 'on-demand';+ return 'active';+}++export const statusDot = (group) => STATUS_GROUPS[group]?.dot || STATUS_GROUPS.disabled.dot;++// Sort key for the card grid: group order first, then soonest next run, then name.+export function taskSortKey(taskType, config) {+ const group = getTaskStatusGroup(config);+ const next = config?.status?.nextRunAt ? new Date(config.status.nextRunAt).getTime() : Infinity;+ return { order: STATUS_GROUPS[group]?.order ?? 9, next: Number.isFinite(next) ? next : Infinity, taskType };+}++// Tailwind tone for the per-task app-coverage bar/label (error none, success full, warning partial).+export function coverageTone(enabled, total) {+ if (enabled === 0) return { text: 'text-port-error', bar: 'bg-port-error' };+ if (enabled === total) return { text: 'text-port-success', bar: 'bg-port-success' };+ return { text: 'text-port-warning', bar: 'bg-port-warning' };+}++// Describe a task's "next run" line for the card: text + Tailwind tone, plus an+// optional title and a `warn` flag for the dependency-wait icon. Pure so it can+// be unit-tested without rendering.+export function describeNextRun(config) {+ const group = getTaskStatusGroup(config);+ if (group === 'disabled') return { text: 'Paused', tone: 'text-gray-500' };+ if (group === 'waiting') {+ const deps = config.status?.pendingDeps?.join(', ');+ return {+ text: `waiting on ${deps || 'dependencies'}`,+ tone: 'text-port-warning',+ warn: true,+ title: deps ? `Waiting for: ${deps}` : undefined,+ };+ }+ if (group === 'on-demand') return { text: 'Manual trigger only', tone: 'text-gray-400' };+ const next = config.status?.nextRunAt;+ return {+ text: next ? timeUntil(next, 'soon') : `${INTERVAL_LABELS[config.type] || config.type} — pending`,+ tone: 'text-gray-300',+ };+}+export const TASK_FILTERS = [{ id: 'all', label: 'All', emptyMessage: 'No tasks configured.', match: () => true },- { id: 'enabled', label: 'Enabled', emptyMessage: 'No enabled tasks.', match: ([, config]) => config.enabled },+ { id: 'active', label: 'Active', emptyMessage: 'No active tasks.', match: ([, config]) => getTaskStatusGroup(config) === 'active' },+ { id: 'on-demand', label: 'On-Demand', emptyMessage: 'No on-demand tasks.', match: ([, config]) => getTaskStatusGroup(config) === 'on-demand' },+ { id: 'waiting', label: 'Waiting', emptyMessage: 'No tasks waiting on dependencies.', match: ([, config]) => getTaskStatusGroup(config) === 'waiting' },+ { id: 'disabled', label: 'Disabled', emptyMessage: 'No disabled tasks.', match: ([, config]) => getTaskStatusGroup(config) === 'disabled' },];export const DEFAULT_FILTER_ID = TASK_FILTERS[0].id;diff --git a/client/src/components/cos/tabs/schedule/scheduleConstants.test.js b/client/src/components/cos/tabs/schedule/scheduleConstants.test.jsnew file mode 100644index 0000000000..404a397052--- /dev/null+++ b/client/src/components/cos/tabs/schedule/scheduleConstants.test.js@@ -0,0 +1,97 @@+import { describe, it, expect } from 'vitest';+import { getTaskStatusGroup, taskSortKey, TASK_FILTERS, STATUS_GROUPS, describeNextRun, coverageTone } from './scheduleConstants';++describe('getTaskStatusGroup', () => {+ it('classifies a disabled task as disabled regardless of type', () => {+ expect(getTaskStatusGroup({ enabled: false, type: 'daily' })).toBe('disabled');+ expect(getTaskStatusGroup({ enabled: false, type: 'on-demand' })).toBe('disabled');+ });++ it('classifies a dependency-blocked task as waiting', () => {+ expect(getTaskStatusGroup({ enabled: true, type: 'daily', status: { reason: 'waiting-on-dependencies' } })).toBe('waiting');+ });++ it('classifies an on-demand task', () => {+ expect(getTaskStatusGroup({ enabled: true, type: 'on-demand' })).toBe('on-demand');+ });++ it('classifies a normal enabled scheduled task as active', () => {+ expect(getTaskStatusGroup({ enabled: true, type: 'daily' })).toBe('active');+ });++ it('disabled wins over waiting', () => {+ expect(getTaskStatusGroup({ enabled: false, status: { reason: 'waiting-on-dependencies' } })).toBe('disabled');+ });+});++describe('taskSortKey', () => {+ it('orders active before on-demand before waiting before disabled', () => {+ const active = taskSortKey('a', { enabled: true, type: 'daily' });+ const onDemand = taskSortKey('b', { enabled: true, type: 'on-demand' });+ const waiting = taskSortKey('c', { enabled: true, type: 'daily', status: { reason: 'waiting-on-dependencies' } });+ const disabled = taskSortKey('d', { enabled: false });+ expect(active.order).toBeLessThan(onDemand.order);+ expect(onDemand.order).toBeLessThan(waiting.order);+ expect(waiting.order).toBeLessThan(disabled.order);+ });++ it('sorts active tasks by soonest next run, missing runs last', () => {+ const soon = taskSortKey('a', { enabled: true, type: 'daily', status: { nextRunAt: '2999-01-01T00:00:00Z' } });+ const later = taskSortKey('b', { enabled: true, type: 'daily', status: { nextRunAt: '2999-06-01T00:00:00Z' } });+ const none = taskSortKey('c', { enabled: true, type: 'daily' });+ expect(soon.next).toBeLessThan(later.next);+ expect(later.next).toBeLessThan(none.next);+ expect(none.next).toBe(Infinity);+ });+});++describe('TASK_FILTERS', () => {+ it('has one filter per status group plus All', () => {+ const ids = TASK_FILTERS.map(f => f.id);+ expect(ids).toContain('all');+ Object.keys(STATUS_GROUPS).forEach(g => expect(ids).toContain(g));+ });++ it('status filters match only their group', () => {+ const waiting = TASK_FILTERS.find(f => f.id === 'waiting');+ expect(waiting.match(['x', { enabled: true, status: { reason: 'waiting-on-dependencies' } }])).toBe(true);+ expect(waiting.match(['y', { enabled: true, type: 'daily' }])).toBe(false);+ });+});++describe('describeNextRun', () => {+ it('reports Paused for disabled tasks', () => {+ expect(describeNextRun({ enabled: false }).text).toBe('Paused');+ });++ it('reports manual-only for on-demand tasks', () => {+ expect(describeNextRun({ enabled: true, type: 'on-demand' }).text).toBe('Manual trigger only');+ });++ it('reports the dependency list with a warn flag when waiting', () => {+ const out = describeNextRun({ enabled: true, status: { reason: 'waiting-on-dependencies', pendingDeps: ['build', 'lint'] } });+ expect(out.text).toBe('waiting on build, lint');+ expect(out.warn).toBe(true);+ expect(out.title).toContain('build, lint');+ });++ it('reports a relative countdown for a scheduled task with a next run', () => {+ expect(describeNextRun({ enabled: true, type: 'daily', status: { nextRunAt: '2999-01-01T00:00:00Z' } }).text).toMatch(/^in /);+ });++ it('falls back to an interval-label pending string when no next run is known', () => {+ expect(describeNextRun({ enabled: true, type: 'daily' }).text).toBe('Daily — pending');+ });+});++describe('coverageTone', () => {+ it('is error when no apps are enabled', () => {+ expect(coverageTone(0, 5).bar).toBe('bg-port-error');+ });+ it('is success when all apps are enabled', () => {+ expect(coverageTone(5, 5).bar).toBe('bg-port-success');+ });+ it('is warning for partial coverage', () => {+ expect(coverageTone(2, 5).bar).toBe('bg-port-warning');+ });+});diff --git a/client/src/index.css b/client/src/index.cssindex 0738966b1a..a801c4528f 100644--- a/client/src/index.css+++ b/client/src/index.css@@ -167,6 +167,16 @@ html[data-port-theme] .bg-port-card {background-color: rgb(var(--port-card) / var(--port-card-alpha)) !important;}+/* Floating menus/popovers (e.g. the schedule "Run on App" picker) must stay+ fully opaque even on translucent ("glass") card themes — otherwise the+ content behind the free-floating menu bleeds through and the list becomes+ unreadable. Unlike modals, these have no backdrop to sit on. Use the themed+ card color with no alpha. */+.port-menu-surface,+html[data-port-theme] .port-menu-surface {+ background-color: rgb(var(--port-card)) !important;+}+/** Tailwind opacity modifiers (e.g. bg-port-bg/50, hover:bg-port-card/30) skip* the per-theme alpha tokens unless we restate them here — Tailwind v4 emits