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
feat([issue-1971]): split CoS task config drawer into tabs
[._.]/ Adam Eivy3279d3032acc
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 5c0d60ecc5..4d4339ee06 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -12,6 +12,10 @@- **[issue-1835] Brain & CoS list endpoints now support opt-in `limit`/`offset` pagination** — `GET /api/brain/people|projects|ideas|admin|memories` and `GET /api/cos/tasks` previously returned their entire backing store with no bound, while sibling endpoints (`GET /api/brain/links`, `GET /api/memory`) already exposed pagination envelopes. Each of these endpoints now accepts `limit`/`offset` query params: when neither is present they return the exact same shape as before (raw array for the brain collections; the `{ user, cos }` grouped structure for tasks), so every existing client keeps working; when a pagination param is passed they return a bounded `{ <collection>, total, limit, offset }` envelope — and for `/api/cos/tasks` the paginated branch windows each source's `tasks` array, adds a `pagination` block, and drops the full-set derived collections (`grouped`, `autoApproved`, `awaitingApproval`) so the response is genuinely bounded rather than re-leaking the whole queue. `limit` defaults to 50 and is clamped to 500. Shared `isPaginationRequested` / `paginateArray` helpers were added to `server/lib/validation.js` alongside the existing `parsePagination`. (#1835)+## Chief of Staff++- **[issue-1971] The task config drawer is now organized into tabs.** The Chief of Staff schedule tab's per-task config panel was a single flat scroll grouped only by `<h4>` headers; it's now a tabbed drawer split into **Stage config** (per-stage provider/model), **Global defaults** (schedule/provider/prompt controls), and **Per-app overrides** — so no single section runs off the bottom of the panel. The Stage config tab only appears for pipeline-backed tasks and the Per-app overrides tab only when there are active apps (each shows a count badge), so there's never an empty tab. The active tab deep-links via a `?taskTab=` URL param (shareable/bookmarkable, reload-safe) and collapses to a `<select>` on mobile; the task identity header (name + badges) stays pinned atop every tab. All config wiring and per-app override interactions are unchanged — layout only — and the drawer still refuses to dismiss on Esc mid-save. (`client/src/components/cos/tabs/schedule/TaskConfigDrawer.jsx`, Closes #1971)+## Media Generation- **[issue-1969] Media Generation Settings is now grouped into tabs.** The image/video backend settings surface — one long flat scroll rendered by the Image Gen, Video Gen, and Storyboard settings drawers — now groups its fields into a pills sub-navigation (Backend / External / Local / Codex CLI / Tokens / Expose / Test) that collapses to a `<select>` on mobile, so no single section is page-length. The grouping is internal to `ImageGenTab` (built on the shared `TabPills`), so it renders identically in every host drawer with no tabs-within-tabs; the active sub-tab deep-links via a `?mediaTab=` search param (`useDrawerTab`) so an open section is shareable and reload-safe. The Save + Test Connection bar stays pinned below the tabs on every section. All existing controls, save/test behavior, and label wiring are unchanged. The Local tab is kept mounted (hidden) once visited so switching tabs during a long-running pip install (e.g. a 10-minute torch upgrade) no longer tears down its stream and cancels the install. (`client/src/components/settings/ImageGenTab.jsx`, Closes #1969)diff --git a/client/src/components/cos/tabs/schedule/TaskConfigDrawer.jsx b/client/src/components/cos/tabs/schedule/TaskConfigDrawer.jsxindex 1e1206072c..720e3d4b4a 100644--- a/client/src/components/cos/tabs/schedule/TaskConfigDrawer.jsx+++ b/client/src/components/cos/tabs/schedule/TaskConfigDrawer.jsx@@ -1,5 +1,6 @@import { useState } from 'react';import Drawer from '../../../Drawer';+import useDrawerTab from '../../../../hooks/useDrawerTab';import TaskHeader from './TaskHeader';import PipelineStageConfig from './PipelineStageConfig';import GlobalConfigControls from './GlobalConfigControls';@@ -8,6 +9,16 @@ 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.+//+// The (formerly page-length) config is split into deep-linkable tabs so no+// single section runs off the bottom of the drawer:+// - Stage config — per-stage provider/model (only when the task has a+// pipeline; count = number of stages)+// - Global defaults — schedule/provider/prompt controls (always present)+// - Per-app overrides — per-app enablement (only when there are active apps;+// count = number of active apps)+// The active tab lives in the `taskTab` URL param so it survives reload and is+// shareable. TaskHeader (identity + badges) stays at the top of every tab.export default function TaskConfigDrawer({open,taskType,@@ -25,19 +36,39 @@ export default function TaskConfigDrawer({}) {const [updating, setUpdating] = useState(false);+ const stages = config?.taskMetadata?.pipeline?.stages || [];+ const hasStages = stages.length > 0;+ const activeApps = apps?.filter(app => !app.archived) || [];+ const hasOverrides = activeApps.length > 0;++ // Tabs are dynamic: a task without a pipeline hides Stage config, and an+ // install with no active apps hides Per-app overrides — never an empty tab.+ const tabs = [+ hasStages && { id: 'stages', label: 'Stage config', count: stages.length },+ { id: 'global', label: 'Global defaults' },+ hasOverrides && { id: 'overrides', label: 'Per-app overrides', count: activeApps.length },+ ].filter(Boolean);+ const tabIds = tabs.map(t => t.id);+ const defaultTab = hasStages ? 'stages' : 'global';+ const [activeTab, setActiveTab] = useDrawerTab('taskTab', defaultTab, tabIds);+return (<Draweropen={open && !!config}onClose={onClose}title={taskType || 'Task'}- widthClass="sm:w-[560px]"+ size="md"+ tabs={tabs}+ activeTab={activeTab}+ onTabChange={setActiveTab}+ // Don't allow an Esc keystroke to discard a config change mid-save.closeOnEsc={!updating}>{config && (<div className="space-y-6"><TaskHeader taskType={taskType} config={config} />- {config.taskMetadata?.pipeline?.stages?.length > 0 && (+ {activeTab === 'stages' && hasStages && (<PipelineStageConfigtaskType={taskType}config={config}@@ -48,8 +79,7 @@ export default function TaskConfigDrawer({/>)}- <div>- <h4 className="text-sm font-medium text-gray-400 mb-3">Global Defaults</h4>+ {activeTab === 'global' && (<GlobalConfigControlstaskType={taskType}config={config}@@ -64,15 +94,17 @@ export default function TaskConfigDrawer({allTaskTypes={allTaskTypes}improvementDisabled={improvementDisabled}/>- </div>+ )}- <PerAppOverrideList- taskType={taskType}- config={config}- apps={apps}- onUpdateOverride={onUpdateOverride}- onBulkToggleOverride={onBulkToggleOverride}- />+ {activeTab === 'overrides' && hasOverrides && (+ <PerAppOverrideList+ taskType={taskType}+ config={config}+ apps={apps}+ onUpdateOverride={onUpdateOverride}+ onBulkToggleOverride={onBulkToggleOverride}+ />+ )}</div>)}</Drawer>diff --git a/client/src/components/cos/tabs/schedule/TaskConfigDrawer.test.jsx b/client/src/components/cos/tabs/schedule/TaskConfigDrawer.test.jsxnew file mode 100644index 0000000000..1334d3d8fc--- /dev/null+++ b/client/src/components/cos/tabs/schedule/TaskConfigDrawer.test.jsx@@ -0,0 +1,118 @@+import { describe, it, expect, vi, afterEach } from 'vitest';+import { render, screen, fireEvent, cleanup } from '@testing-library/react';+import { MemoryRouter } from 'react-router-dom';++// Stub the three config sections + the identity header so the test pins the+// tabbed *layout* TaskConfigDrawer owns (which section shows on which tab, tab+// visibility, deep-link default) without pulling in each section's provider/API+// wiring. Each stub echoes a prop so we can assert the drawer still forwards the+// live config/props through unchanged.+vi.mock('./TaskHeader', () => ({+ default: ({ taskType }) => <div data-testid="task-header">{taskType}</div>,+}));+vi.mock('./PipelineStageConfig', () => ({+ default: ({ taskType }) => <div data-testid="stage-config">stages:{taskType}</div>,+}));+vi.mock('./GlobalConfigControls', () => ({+ default: ({ taskType }) => <div data-testid="global-config">global:{taskType}</div>,+}));+vi.mock('./PerAppOverrideList', () => ({+ default: ({ taskType }) => <div data-testid="override-list">overrides:{taskType}</div>,+}));++import TaskConfigDrawer from './TaskConfigDrawer';++const STAGED_CONFIG = {+ type: 'interval',+ taskMetadata: { pipeline: { stages: [{ name: 'Implement' }, { name: 'Review' }] } },+};+const APPS = [{ id: 'app-1', name: 'One' }, { id: 'app-2', name: 'Two', archived: true }];++function renderDrawer(props = {}, initialEntries = ['/']) {+ return render(+ <MemoryRouter initialEntries={initialEntries}>+ <TaskConfigDrawer+ open+ taskType="do:next"+ config={STAGED_CONFIG}+ apps={APPS}+ providers={[]}+ onClose={() => {}}+ onUpdate={() => {}}+ onTrigger={() => {}}+ onReset={() => {}}+ onUpdateOverride={() => {}}+ onBulkToggleOverride={() => {}}+ {...props}+ />+ </MemoryRouter>+ );+}++afterEach(() => {+ cleanup();+ vi.clearAllMocks();+});++describe('TaskConfigDrawer tabbed layout', () => {+ it('renders the taskType as the drawer title and keeps the header on every tab', async () => {+ renderDrawer();+ expect(screen.getByRole('dialog', { name: 'do:next' })).toBeInTheDocument();+ expect(screen.getByTestId('task-header')).toHaveTextContent('do:next');+ });++ it('shows all three section tabs with stage/app counts when both are present', () => {+ renderDrawer();+ expect(screen.getByRole('tab', { name: /Stage config/ })).toBeInTheDocument();+ expect(screen.getByRole('tab', { name: /Global defaults/ })).toBeInTheDocument();+ expect(screen.getByRole('tab', { name: /Per-app overrides/ })).toBeInTheDocument();+ // Counts surface: 2 stages, 1 active (non-archived) app.+ expect(screen.getByRole('tab', { name: /Stage config/ })).toHaveTextContent('2');+ expect(screen.getByRole('tab', { name: /Per-app overrides/ })).toHaveTextContent('1');+ });++ it('opens on Stage config and mounts only the active tab section', () => {+ renderDrawer();+ expect(screen.getByTestId('stage-config')).toBeInTheDocument();+ expect(screen.queryByTestId('global-config')).not.toBeInTheDocument();+ expect(screen.queryByTestId('override-list')).not.toBeInTheDocument();+ });++ it('switches to Global defaults and Per-app overrides on tab click', () => {+ renderDrawer();+ fireEvent.click(screen.getByRole('tab', { name: /Global defaults/ }));+ expect(screen.getByTestId('global-config')).toHaveTextContent('global:do:next');+ expect(screen.queryByTestId('stage-config')).not.toBeInTheDocument();++ fireEvent.click(screen.getByRole('tab', { name: /Per-app overrides/ }));+ expect(screen.getByTestId('override-list')).toHaveTextContent('overrides:do:next');+ expect(screen.queryByTestId('global-config')).not.toBeInTheDocument();+ });++ it('honors a deep-linked active tab from the taskTab URL param', () => {+ renderDrawer({}, ['/?taskTab=overrides']);+ expect(screen.getByTestId('override-list')).toBeInTheDocument();+ expect(screen.queryByTestId('stage-config')).not.toBeInTheDocument();+ });++ it('degrades a stale/invalid taskTab param to the default tab', () => {+ renderDrawer({}, ['/?taskTab=bogus']);+ expect(screen.getByTestId('stage-config')).toBeInTheDocument();+ });++ it('hides the Stage config tab and defaults to Global when the task has no pipeline', () => {+ renderDrawer({ config: { type: 'interval' } });+ expect(screen.queryByRole('tab', { name: /Stage config/ })).not.toBeInTheDocument();+ expect(screen.getByTestId('global-config')).toBeInTheDocument();+ });++ it('hides the Per-app overrides tab when there are no active apps', () => {+ renderDrawer({ apps: [{ id: 'a', name: 'A', archived: true }] });+ expect(screen.queryByRole('tab', { name: /Per-app overrides/ })).not.toBeInTheDocument();+ });++ it('renders nothing when config is not yet loaded', () => {+ const { container } = renderDrawer({ config: null });+ expect(container.querySelector('[role="dialog"]')).toBeNull();+ });+});