Skip to content

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

feat(cos): add per-app task type enable/disable overrides

Adam Eivy5c9f0c44fc00
diff --git a/client/src/components/cos/tabs/ScheduleTab.jsx b/client/src/components/cos/tabs/ScheduleTab.jsx
index e00877ce04..ccf6506608 100644
--- a/client/src/components/cos/tabs/ScheduleTab.jsx
+++ b/client/src/components/cos/tabs/ScheduleTab.jsx
@@ -1,5 +1,5 @@
import { useState, useEffect, useCallback, useRef } from 'react';
-import { Clock, Play, RotateCcw, ChevronDown, ChevronRight, CheckCircle, XCircle, AlertCircle, RefreshCw, Package } from 'lucide-react';
+import { Clock, Play, RotateCcw, ChevronDown, ChevronRight, CheckCircle, XCircle, AlertCircle, RefreshCw, Package, Settings2 } from 'lucide-react';
import toast from 'react-hot-toast';
import * as api from '../../../services/api';
@@ -455,6 +455,121 @@ function TaskTypeSection({ title, description, tasks, onUpdate, onTrigger, onRes
);
}
+function PerAppOverrides({ apps, taskTypes }) {
+ const [collapsed, setCollapsed] = useState(false);
+ const [overrides, setOverrides] = useState({}); // { appId: [disabledTaskType, ...] }
+ const [updating, setUpdating] = useState(null); // 'appId:taskType' while toggling
+
+ const activeApps = apps?.filter(app => !app.archived) || [];
+
+ const fetchOverrides = useCallback(async () => {
+ const results = {};
+ await Promise.all(activeApps.map(async (app) => {
+ const data = await api.getAppTaskTypes(app.id).catch(() => null);
+ if (data) {
+ results[app.id] = data.disabledTaskTypes || [];
+ }
+ }));
+ setOverrides(results);
+ }, [activeApps.map(a => a.id).join(',')]);
+
+ useEffect(() => {
+ if (activeApps.length > 0) fetchOverrides();
+ }, [fetchOverrides]);
+
+ const handleToggle = async (appId, taskType, currentlyEnabled) => {
+ const key = `${appId}:${taskType}`;
+ setUpdating(key);
+ const result = await api.toggleAppTaskType(appId, taskType, !currentlyEnabled).catch(err => {
+ toast.error(err.message);
+ return null;
+ });
+ if (result?.success) {
+ setOverrides(prev => ({ ...prev, [appId]: result.disabledTaskTypes }));
+ const appName = activeApps.find(a => a.id === appId)?.name || appId;
+ toast.success(`${!currentlyEnabled ? 'Enabled' : 'Disabled'} ${taskType} for ${appName}`);
+ }
+ setUpdating(null);
+ };
+
+ if (activeApps.length === 0 || taskTypes.length === 0) return null;
+
+ return (
+ <div className="space-y-3">
+ <button
+ onClick={() => setCollapsed(!collapsed)}
+ className="flex items-center gap-2 w-full text-left"
+ >
+ {collapsed ? <ChevronRight size={18} /> : <ChevronDown size={18} />}
+ <Settings2 size={18} className="text-gray-400" />
+ <h3 className="text-lg font-semibold text-white">Per-App Task Type Overrides</h3>
+ <span className="text-xs text-gray-500">
+ {activeApps.length} apps
+ </span>
+ </button>
+ {!collapsed && (
+ <>
+ <p className="text-sm text-gray-400 ml-6">
+ Enable or disable specific task types per app. Disabled task types will be skipped during scheduled runs for that app.
+ </p>
+ <div className="ml-6 overflow-x-auto">
+ <table className="w-full text-sm">
+ <thead>
+ <tr className="border-b border-port-border">
+ <th className="text-left py-2 pr-4 text-gray-400 font-medium sticky left-0 bg-port-bg min-w-[140px]">App</th>
+ {taskTypes.map(tt => (
+ <th key={tt} className="px-2 py-2 text-gray-400 font-medium text-center whitespace-nowrap">
+ <span className="text-xs">{tt}</span>
+ </th>
+ ))}
+ </tr>
+ </thead>
+ <tbody>
+ {activeApps.map(app => {
+ const disabled = overrides[app.id] || [];
+ return (
+ <tr key={app.id} className="border-b border-port-border/50 hover:bg-port-card/30">
+ <td className="py-2 pr-4 text-white font-mono text-xs sticky left-0 bg-port-bg">
+ <div className="flex items-center gap-1.5">
+ <Package size={12} className="text-gray-500 flex-shrink-0" />
+ <span className="truncate max-w-[120px]" title={app.name}>{app.name}</span>
+ </div>
+ </td>
+ {taskTypes.map(tt => {
+ const isEnabled = !disabled.includes(tt);
+ const isUpdating = updating === `${app.id}:${tt}`;
+ return (
+ <td key={tt} className="px-2 py-2 text-center">
+ <button
+ onClick={() => handleToggle(app.id, tt, isEnabled)}
+ disabled={isUpdating}
+ className={`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${
+ isEnabled ? 'bg-port-accent' : 'bg-gray-600'
+ } ${isUpdating ? 'opacity-50' : ''}`}
+ title={`${isEnabled ? 'Disable' : 'Enable'} ${tt} for ${app.name}`}
+ aria-label={`${isEnabled ? 'Disable' : 'Enable'} ${tt} for ${app.name}`}
+ >
+ <span
+ className={`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${
+ isEnabled ? 'translate-x-5' : 'translate-x-1'
+ }`}
+ />
+ </button>
+ </td>
+ );
+ })}
+ </tr>
+ );
+ })}
+ </tbody>
+ </table>
+ </div>
+ </>
+ )}
+ </div>
+ );
+}
+
export default function ScheduleTab({ apps }) {
const [schedule, setSchedule] = useState(null);
const [providers, setProviders] = useState(null);
@@ -614,6 +729,11 @@ export default function ScheduleTab({ apps }) {
apps={apps}
/>
+ <PerAppOverrides
+ apps={apps}
+ taskTypes={Object.keys(schedule.appImprovement || {})}
+ />
+
{schedule.lastUpdated && (
<div className="text-xs text-gray-500 text-right">
Schedule last updated: {new Date(schedule.lastUpdated).toLocaleString()}
diff --git a/client/src/services/api.js b/client/src/services/api.js
index 28503d4c30..5b12aa06ab 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -64,6 +64,11 @@ export const openAppInEditor = (id) => request(`/apps/${id}/open-editor`, { meth
export const openAppFolder = (id) => request(`/apps/${id}/open-folder`, { method: 'POST' });
export const refreshAppConfig = (id) => request(`/apps/${id}/refresh-config`, { method: 'POST' });
export const getAppStatus = (id) => request(`/apps/${id}/status`);
+export const getAppTaskTypes = (id) => request(`/apps/${id}/task-types`);
+export const toggleAppTaskType = (id, taskType, enabled) => request(`/apps/${id}/task-types/${taskType}`, {
+ method: 'PUT',
+ body: JSON.stringify({ enabled })
+});
export const getAppLogs = (id, lines = 100, processName) => {
const params = new URLSearchParams({ lines: String(lines) });
if (processName) params.set('process', processName);
diff --git a/server/lib/validation.js b/server/lib/validation.js
index 86bc7a12e4..7d0f0194b7 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -166,7 +166,8 @@ export const appSchema = z.object({
editorCommand: z.string().optional(),
description: z.string().optional(),
archived: z.boolean().optional().default(false),
- pm2Home: z.string().optional() // Custom PM2_HOME path for apps that run in their own PM2 instance
+ pm2Home: z.string().optional(), // Custom PM2_HOME path for apps that run in their own PM2 instance
+ disabledTaskTypes: z.array(z.string()).optional() // Task types disabled for this app (e.g., ['typing', 'accessibility'])
});
// Partial schema for updates
diff --git a/server/routes/apps.js b/server/routes/apps.js
index 5f2fe89d65..33a884c79b 100644
--- a/server/routes/apps.js
+++ b/server/routes/apps.js
@@ -164,6 +164,31 @@ router.post('/:id/unarchive', asyncHandler(async (req, res) => {
res.json(app);
}));
+// GET /api/apps/:id/task-types - Get per-app task type overrides
+router.get('/:id/task-types', asyncHandler(async (req, res) => {
+ const app = await appsService.getAppById(req.params.id);
+ if (!app) {
+ throw new ServerError('App not found', { status: 404, code: 'NOT_FOUND' });
+ }
+ res.json({ appId: app.id, appName: app.name, disabledTaskTypes: app.disabledTaskTypes || [] });
+}));
+
+// PUT /api/apps/:id/task-types/:taskType - Toggle a task type for an app
+router.put('/:id/task-types/:taskType', asyncHandler(async (req, res) => {
+ const { enabled } = req.body;
+ if (typeof enabled !== 'boolean') {
+ throw new ServerError('enabled must be a boolean', { status: 400, code: 'VALIDATION_ERROR' });
+ }
+
+ const result = await appsService.toggleAppTaskType(req.params.id, req.params.taskType, enabled);
+ if (!result) {
+ throw new ServerError('App not found', { status: 404, code: 'NOT_FOUND' });
+ }
+
+ console.log(`📋 ${enabled ? 'Enabled' : 'Disabled'} task type ${req.params.taskType} for ${result.name}`);
+ res.json({ success: true, appId: result.id, taskType: req.params.taskType, enabled, disabledTaskTypes: result.disabledTaskTypes || [] });
+}));
+
// POST /api/apps/:id/start - Start app via PM2
router.post('/:id/start', asyncHandler(async (req, res, next) => {
const app = await appsService.getAppById(req.params.id);
diff --git a/server/services/apps.js b/server/services/apps.js
index 2f4aeed03e..8021910514 100644
--- a/server/services/apps.js
+++ b/server/services/apps.js
@@ -197,6 +197,44 @@ export async function unarchiveApp(id) {
return updateApp(id, { archived: false });
}
+/**
+ * Get disabled task types for an app
+ */
+export async function getAppDisabledTaskTypes(id) {
+ const app = await getAppById(id);
+ return app?.disabledTaskTypes || [];
+}
+
+/**
+ * Check if a task type is enabled for a specific app
+ */
+export async function isTaskTypeEnabledForApp(id, taskType) {
+ const disabled = await getAppDisabledTaskTypes(id);
+ return !disabled.includes(taskType);
+}
+
+/**
+ * Toggle a task type for a specific app (enable/disable)
+ */
+export async function toggleAppTaskType(id, taskType, enabled) {
+ const data = await loadApps();
+ if (!data.apps[id]) return null;
+
+ const disabledTaskTypes = data.apps[id].disabledTaskTypes || [];
+
+ if (enabled && disabledTaskTypes.includes(taskType)) {
+ data.apps[id].disabledTaskTypes = disabledTaskTypes.filter(t => t !== taskType);
+ } else if (!enabled && !disabledTaskTypes.includes(taskType)) {
+ data.apps[id].disabledTaskTypes = [...disabledTaskTypes, taskType];
+ }
+
+ data.apps[id].updatedAt = new Date().toISOString();
+ await saveApps(data);
+ appsEvents.emit('changed', { action: 'update-task-types', timestamp: Date.now() });
+
+ return { id, ...data.apps[id] };
+}
+
/**
* Get reserved ports from all registered apps
*/
diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.js
index fbffe07172..8656dbddde 100644
--- a/server/services/taskSchedule.js
+++ b/server/services/taskSchedule.js
@@ -23,6 +23,7 @@ import { fileURLToPath } from 'url';
import { cosEvents, emitLog } from './cos.js';
import { readJSONFile } from '../lib/fileUtils.js';
import { getAdaptiveCooldownMultiplier } from './taskLearning.js';
+import { isTaskTypeEnabledForApp } from './apps.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
@@ -970,6 +971,14 @@ export async function shouldRunAppImprovementTask(taskType, appId) {
return { shouldRun: false, reason: 'disabled' };
}
+ // Check per-app task type override
+ if (appId) {
+ const enabledForApp = await isTaskTypeEnabledForApp(appId, taskType);
+ if (!enabledForApp) {
+ return { shouldRun: false, reason: 'disabled-for-app' };
+ }
+ }
+
const key = `app-improve:${taskType}`;
const execution = schedule.executions[key] || { lastRun: null, count: 0, perApp: {} };
const appExecution = execution.perApp[appId] || { lastRun: null, count: 0 };