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(cos): add autonomy level presets for quick behavior configuration
Adam Eivy0c34ebeb8c6d
diff --git a/.changelog/v0.10.x.md b/.changelog/v0.10.x.mdindex 7988b3dcee..e9d1592b32 100644--- a/.changelog/v0.10.x.md+++ b/.changelog/v0.10.x.md@@ -377,6 +377,15 @@ This release introduces a structured changelog documentation system for creating- **Streamlined UI**: Removed the "+ Add Task" button and Cancel button since the form is persistently displayed- **Faster Task Entry**: Users can immediately start typing task descriptions without an extra click+### Chief of Staff - Autonomy Level Presets+- **One-Click Autonomy Modes**: New Autonomy Level control at the top of the Config tab with 4 preset modes (Standby, Assistant, Manager, YOLO)+- **Visual Level Buttons**: Color-coded buttons (green/blue/yellow/red) with ring highlight on active level+- **Level Descriptions**: Each level shows a description explaining its behavior (e.g., "Only processes user-defined tasks from TASKS.md")+- **Parameter Preview**: Hovering over levels shows all 8 controlled parameters, with yellow highlights for values that would change+- **Custom Detection**: "Custom" badge appears when parameters don't match any preset exactly+- **Controlled Parameters**: Each level configures evaluationIntervalMs, maxConcurrentAgents, selfImprovementEnabled, appImprovementEnabled, proactiveMode, idleReviewEnabled, immediateExecution, and comprehensiveAppImprovement+- **New Config Rows**: Added Proactive Mode, Idle Review, Immediate Execution, and Comprehensive App Analysis toggles to Config tab for fine-grained control+### Web Shell PTY Compatibility Fix- **Node.js 25 Support**: Upgraded node-pty from 1.1.0 to 1.2.0-beta.10 to fix `posix_spawnp failed` error on Node.js 25.x- **Error Handling**: Added error handling to shell session creation to catch PTY spawn failures and report them to the client instead of silently failingdiff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.jsindex 7c4f754849..efb6684c82 100644--- a/client/src/components/cos/constants.js+++ b/client/src/components/cos/constants.js@@ -53,3 +53,97 @@ export const MEMORY_TYPE_COLORS = {preference: 'bg-pink-500/20 text-pink-400 border-pink-500/30',context: 'bg-gray-500/20 text-gray-400 border-gray-500/30'};++// Autonomy level presets for CoS behavior+export const AUTONOMY_LEVELS = [+ {+ id: 'standby',+ label: 'Standby',+ color: 'green',+ description: 'Only processes user-defined tasks from TASKS.md',+ params: {+ evaluationIntervalMs: 300000, // 5 min+ maxConcurrentAgents: 1,+ selfImprovementEnabled: false,+ appImprovementEnabled: false,+ proactiveMode: false,+ idleReviewEnabled: false,+ immediateExecution: false,+ comprehensiveAppImprovement: false+ }+ },+ {+ id: 'assistant',+ label: 'Assistant',+ color: 'blue',+ description: 'Processes user tasks plus self-improvement on schedule',+ params: {+ evaluationIntervalMs: 120000, // 2 min+ maxConcurrentAgents: 2,+ selfImprovementEnabled: true,+ appImprovementEnabled: false,+ proactiveMode: false,+ idleReviewEnabled: false,+ immediateExecution: true,+ comprehensiveAppImprovement: false+ }+ },+ {+ id: 'manager',+ label: 'Manager',+ color: 'yellow',+ description: 'Full task processing with app improvements, no proactive mode',+ params: {+ evaluationIntervalMs: 60000, // 1 min+ maxConcurrentAgents: 3,+ selfImprovementEnabled: true,+ appImprovementEnabled: true,+ proactiveMode: false,+ idleReviewEnabled: true,+ immediateExecution: true,+ comprehensiveAppImprovement: true+ }+ },+ {+ id: 'yolo',+ label: 'YOLO',+ color: 'red',+ description: 'Maximum autonomy with proactive task creation and frequent checks',+ params: {+ evaluationIntervalMs: 30000, // 30 sec+ maxConcurrentAgents: 5,+ selfImprovementEnabled: true,+ appImprovementEnabled: true,+ proactiveMode: true,+ idleReviewEnabled: true,+ immediateExecution: true,+ comprehensiveAppImprovement: true+ }+ }+];++// Get params for a specific autonomy level+export const computeAutonomyParams = (levelId) => {+ const level = AUTONOMY_LEVELS.find(l => l.id === levelId);+ return level ? level.params : null;+};++// Detect which autonomy level matches the current config (or null for custom)+export const detectAutonomyLevel = (config) => {+ if (!config) return null;++ for (const level of AUTONOMY_LEVELS) {+ const matches = Object.entries(level.params).every(([key, value]) => {+ return config[key] === value;+ });+ if (matches) return level.id;+ }+ return null; // Custom configuration+};++// Format milliseconds as human-readable interval+export const formatInterval = (ms) => {+ if (ms < 60000) return `${ms / 1000}s`;+ if (ms < 3600000) return `${ms / 60000}min`;+ return `${ms / 3600000}hr`;+};diff --git a/client/src/components/cos/tabs/ConfigTab.jsx b/client/src/components/cos/tabs/ConfigTab.jsxindex 6a39d47072..e7832a5d98 100644--- a/client/src/components/cos/tabs/ConfigTab.jsx+++ b/client/src/components/cos/tabs/ConfigTab.jsx@@ -3,6 +3,135 @@ import { Settings, Activity, CheckCircle, FileText } from 'lucide-react';import toast from 'react-hot-toast';import * as api from '../../../services/api';import ConfigRow from './ConfigRow';+import { AUTONOMY_LEVELS, detectAutonomyLevel, formatInterval } from '../constants';++// Color classes for autonomy level buttons+const LEVEL_COLORS = {+ green: {+ base: 'border-green-500/30 bg-green-500/10 text-green-400 hover:bg-green-500/20',+ active: 'ring-2 ring-green-500 border-green-500 bg-green-500/20'+ },+ blue: {+ base: 'border-blue-500/30 bg-blue-500/10 text-blue-400 hover:bg-blue-500/20',+ active: 'ring-2 ring-blue-500 border-blue-500 bg-blue-500/20'+ },+ yellow: {+ base: 'border-yellow-500/30 bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20',+ active: 'ring-2 ring-yellow-500 border-yellow-500 bg-yellow-500/20'+ },+ red: {+ base: 'border-red-500/30 bg-red-500/10 text-red-400 hover:bg-red-500/20',+ active: 'ring-2 ring-red-500 border-red-500 bg-red-500/20'+ }+};++// Parameter labels for display+const PARAM_LABELS = {+ evaluationIntervalMs: 'Eval',+ maxConcurrentAgents: 'Agents',+ selfImprovementEnabled: 'Self',+ appImprovementEnabled: 'App',+ proactiveMode: 'Proactive',+ idleReviewEnabled: 'Idle',+ immediateExecution: 'Immediate',+ comprehensiveAppImprovement: 'Comprehensive'+};++// Format param value for display+const formatParamValue = (key, value) => {+ if (key === 'evaluationIntervalMs') return formatInterval(value);+ if (typeof value === 'boolean') return value ? 'Yes' : 'No';+ return String(value);+};++// AutonomyControl component+function AutonomyControl({ config, onLevelChange }) {+ const [hoveredLevel, setHoveredLevel] = useState(null);+ const currentLevel = detectAutonomyLevel(config);+ const isCustom = currentLevel === null;++ const handleLevelClick = async (level) => {+ await onLevelChange(level.params);+ toast.success(`Autonomy level set to ${level.label}`);+ };++ // Get the level to show in preview (hovered or current)+ const previewLevel = hoveredLevel+ ? AUTONOMY_LEVELS.find(l => l.id === hoveredLevel)+ : currentLevel+ ? AUTONOMY_LEVELS.find(l => l.id === currentLevel)+ : null;++ // Get current params for comparison+ const currentParams = previewLevel?.params || {};++ return (+ <div className="bg-port-card border border-port-border rounded-lg p-4 mb-6">+ <div className="flex items-center justify-between mb-3">+ <h4 className="text-sm font-medium text-gray-400">Autonomy Level</h4>+ {isCustom && (+ <span className="px-2 py-0.5 text-xs bg-gray-500/20 text-gray-400 rounded border border-gray-500/30">+ Custom+ </span>+ )}+ </div>++ {/* Level buttons */}+ <div className="grid grid-cols-4 gap-2 mb-3">+ {AUTONOMY_LEVELS.map((level) => {+ const isActive = currentLevel === level.id;+ const colorClasses = LEVEL_COLORS[level.color];++ return (+ <button+ key={level.id}+ onClick={() => handleLevelClick(level)}+ onMouseEnter={() => setHoveredLevel(level.id)}+ onMouseLeave={() => setHoveredLevel(null)}+ className={`+ px-3 py-2 text-sm font-medium rounded-lg border transition-all+ ${isActive ? colorClasses.active : colorClasses.base}+ `}+ >+ {level.label}+ </button>+ );+ })}+ </div>++ {/* Description */}+ {previewLevel && (+ <p className="text-sm text-gray-500 mb-3">+ {previewLevel.description}+ </p>+ )}++ {/* Parameters preview - always visible */}+ {previewLevel && (+ <div className="grid grid-cols-4 gap-2 text-xs">+ {Object.entries(previewLevel.params).map(([key, value]) => {+ const isDifferent = hoveredLevel && config && config[key] !== value;+ return (+ <div+ key={key}+ className={`+ px-2 py-1 rounded+ ${isDifferent+ ? 'bg-yellow-500/20 text-yellow-400'+ : 'bg-port-bg text-gray-400'+ }+ `}+ >+ <span className="font-medium">{PARAM_LABELS[key]}:</span>{' '}+ {formatParamValue(key, value)}+ </div>+ );+ })}+ </div>+ )}+ </div>+ );+}export default function ConfigTab({ config, onUpdate, onEvaluate, avatarStyle, setAvatarStyle, evalCountdown }) {const [editing, setEditing] = useState(false);@@ -13,9 +142,20 @@ export default function ConfigTab({ config, onUpdate, onEvaluate, avatarStyle, smaxProcessMemoryMb: config?.maxProcessMemoryMb || 2048,autoStart: config?.autoStart || false,selfImprovementEnabled: config?.selfImprovementEnabled ?? true,- appImprovementEnabled: config?.appImprovementEnabled ?? true+ appImprovementEnabled: config?.appImprovementEnabled ?? true,+ proactiveMode: config?.proactiveMode ?? true,+ idleReviewEnabled: config?.idleReviewEnabled ?? true,+ immediateExecution: config?.immediateExecution ?? true,+ comprehensiveAppImprovement: config?.comprehensiveAppImprovement ?? true});+ const handleLevelChange = async (params) => {+ const updatedData = { ...formData, ...params };+ setFormData(updatedData);+ await api.updateCosConfig(params).catch(err => toast.error(err.message));+ onUpdate();+ };+const handleSave = async () => {await api.updateCosConfig(formData).catch(err => toast.error(err.message));toast.success('Configuration updated');@@ -56,6 +196,9 @@ export default function ConfigTab({ config, onUpdate, onEvaluate, avatarStyle, s</div></div>+ {/* Autonomy Level Control */}+ <AutonomyControl config={config} onLevelChange={handleLevelChange} />+<div className="bg-port-card border border-port-border rounded-lg divide-y divide-port-border"><ConfigRowlabel="Evaluation Interval"@@ -129,6 +272,42 @@ export default function ConfigTab({ config, onUpdate, onEvaluate, avatarStyle, sonChange={v => setFormData(f => ({ ...f, appImprovementEnabled: v }))}tooltip="Allow CoS to improve managed apps (code review, testing, documentation, etc.)"/>+ <ConfigRow+ label="Proactive Mode"+ value={formData.proactiveMode ? 'Enabled' : 'Disabled'}+ editing={editing}+ type="checkbox"+ inputValue={formData.proactiveMode}+ onChange={v => setFormData(f => ({ ...f, proactiveMode: v }))}+ tooltip="Proactively find and create tasks based on mission goals"+ />+ <ConfigRow+ label="Idle Review"+ value={formData.idleReviewEnabled ? 'Enabled' : 'Disabled'}+ editing={editing}+ type="checkbox"+ inputValue={formData.idleReviewEnabled}+ onChange={v => setFormData(f => ({ ...f, idleReviewEnabled: v }))}+ tooltip="Review apps for improvements when no user tasks are pending"+ />+ <ConfigRow+ label="Immediate Execution"+ value={formData.immediateExecution ? 'Enabled' : 'Disabled'}+ editing={editing}+ type="checkbox"+ inputValue={formData.immediateExecution}+ onChange={v => setFormData(f => ({ ...f, immediateExecution: v }))}+ tooltip="Execute new tasks immediately instead of waiting for evaluation interval"+ />+ <ConfigRow+ label="Comprehensive App Analysis"+ value={formData.comprehensiveAppImprovement ? 'Enabled' : 'Disabled'}+ editing={editing}+ type="checkbox"+ inputValue={formData.comprehensiveAppImprovement}+ onChange={v => setFormData(f => ({ ...f, comprehensiveAppImprovement: v }))}+ tooltip="Use comprehensive analysis for managed apps (same as PortOS self-improvement)"+ /></div>{/* Avatar Style */}diff --git a/server/services/cos.js b/server/services/cos.jsindex 965e7b1d09..f1a60999ba 100644--- a/server/services/cos.js+++ b/server/services/cos.js@@ -102,6 +102,7 @@ const DEFAULT_CONFIG = {comprehensiveAppImprovement: true, // Use comprehensive analysis for managed apps (same as PortOS self-improvement)immediateExecution: true, // Execute new tasks immediately, don't wait for intervalproactiveMode: true, // Be proactive about finding work+ autonomyLevel: 'manager', // Default autonomy level preset (standby/assistant/manager/yolo)rehabilitationGracePeriodDays: 7, // Days before auto-retrying skipped task types (learning-based)autoFixThresholds: {maxLinesChanged: 50, // Auto-approve if <= this many lines changed