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
fix: address PR review feedback
Adam Eivyf5684a45ca72
diff --git a/client/src/components/AppTile.jsx b/client/src/components/AppTile.jsxindex b0b3a5bb7a..8a802c09c7 100644--- a/client/src/components/AppTile.jsx+++ b/client/src/components/AppTile.jsx@@ -1,4 +1,4 @@-import { useState, memo, useCallback, useMemo } from 'react';+import { useState, memo } from 'react';import StatusBadge from './StatusBadge';import AppIcon from './AppIcon';import * as api from '../services/api';diff --git a/client/src/components/NotificationDropdown.jsx b/client/src/components/NotificationDropdown.jsxindex de9a9432c9..0ad0f1e883 100644--- a/client/src/components/NotificationDropdown.jsx+++ b/client/src/components/NotificationDropdown.jsx@@ -1,6 +1,6 @@import { useState, useRef, useEffect } from 'react';import { useNavigate } from 'react-router-dom';-import { Bell, X, Check, CheckCheck, Trash2, Brain, ListTodo, AlertTriangle, Code } from 'lucide-react';+import { Bell, X, CheckCheck, Trash2, Brain, ListTodo, AlertTriangle, Code } from 'lucide-react';const NOTIFICATION_TYPE_CONFIG = {memory_approval: {diff --git a/client/src/components/cos/tabs/TasksTab.jsx b/client/src/components/cos/tabs/TasksTab.jsxindex b000e9184a..ae8f10eab9 100644--- a/client/src/components/cos/tabs/TasksTab.jsx+++ b/client/src/components/cos/tabs/TasksTab.jsx@@ -1,4 +1,4 @@-import { useState, useEffect, useRef, useMemo, useCallback } from 'react';+import { useState, useEffect, useRef, useMemo } from 'react';import { Plus, RefreshCw, Image, X, ChevronDown, ChevronRight } from 'lucide-react';import toast from 'react-hot-toast';import {@@ -43,14 +43,6 @@ export default function TasksTab({ tasks, onRefresh, providers, apps }) {const awaitingApproval = useMemo(() => tasks.cos?.awaitingApproval || [], [tasks.cos?.awaitingApproval]);// Split tasks into pending (includes in_progress, blocked) and completed- const pendingUserTasks = useMemo(() =>- userTasks.filter(t => t.status !== 'completed'),- [userTasks]- );- const completedUserTasks = useMemo(() =>- userTasks.filter(t => t.status === 'completed'),- [userTasks]- );const pendingSystemTasks = useMemo(() =>cosTasks.filter(t => t.status !== 'completed'),[cosTasks]diff --git a/docs/API.md b/docs/API.mdindex fd4af3a8c7..f1328ff1ad 100644--- a/docs/API.md+++ b/docs/API.md@@ -8,9 +8,19 @@ PortOS exposes a REST API on port 5554 and WebSocket events via Socket.IO.http://localhost:5554/api```-## Authentication+## Security Model-No authentication is required. PortOS relies on network-level security (Tailscale) for access control.+PortOS is designed for personal/developer use on trusted networks. It implements the following security measures:++- **Network isolation**: By default, access should be restricted to trusted networks (e.g., Tailscale VPN, localhost)+- **Command allowlist**: Shell command execution is restricted to an approved allowlist (see `server/lib/commandAllowlist.js`)+- **Input validation**: All API inputs are validated using Zod schemas+- **No application-level authentication**: PortOS assumes network-level access control++**Important**: Do not expose PortOS APIs directly to untrusted networks. For production deployments, consider:+- Binding to `127.0.0.1` instead of `0.0.0.0`+- Running behind an authenticated reverse proxy+- Using Tailscale or similar VPN for remote access## REST Endpointsdiff --git a/server/lib/errorHandler.test.js b/server/lib/errorHandler.test.jsindex b556d26683..f332986ba8 100644--- a/server/lib/errorHandler.test.js+++ b/server/lib/errorHandler.test.js@@ -1,4 +1,4 @@-import { describe, it, expect, vi, beforeEach } from 'vitest';+import { describe, it, expect, vi } from 'vitest';import {ServerError,normalizeError,diff --git a/server/routes/cos.test.js b/server/routes/cos.test.jsindex 5ffc03b1a2..35be470f32 100644--- a/server/routes/cos.test.js+++ b/server/routes/cos.test.js@@ -1,4 +1,4 @@-import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';+import { describe, it, expect, vi, beforeEach } from 'vitest';import express from 'express';import request from 'supertest';import cosRoutes from './cos.js';diff --git a/server/services/agents.test.js b/server/services/agents.test.jsindex e18cebe1a0..a37c6aa4bc 100644--- a/server/services/agents.test.js+++ b/server/services/agents.test.js@@ -1,4 +1,4 @@-import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';+import { describe, it, expect, beforeEach } from 'vitest';/*** Tests for the agents service logicdiff --git a/server/services/cos.js b/server/services/cos.jsindex 8d4569f6a8..6ace479a06 100644--- a/server/services/cos.js+++ b/server/services/cos.js@@ -17,7 +17,7 @@ import { getActiveProvider } from './providers.js';import { parseTasksMarkdown, groupTasksByStatus, getNextTask, getAutoApprovedTasks, getAwaitingApprovalTasks, updateTaskStatus, generateTasksMarkdown } from '../lib/taskParser.js';import { isAppOnCooldown, getNextAppForReview, markAppReviewStarted, markIdleReviewStarted } from './appActivity.js';import { getAllApps } from './apps.js';-import { shouldSkipTaskType, getAdaptiveCooldownMultiplier, getSkippedTaskTypes, getPerformanceSummary, recordLearningInsight } from './taskLearning.js';+import { getAdaptiveCooldownMultiplier, getSkippedTaskTypes, getPerformanceSummary } from './taskLearning.js';const execAsync = promisify(exec);diff --git a/server/services/selfImprovement.js b/server/services/selfImprovement.jsindex 1b535da4b2..787e5dd56c 100644--- a/server/services/selfImprovement.js+++ b/server/services/selfImprovement.js@@ -12,7 +12,7 @@* - Generate improvement tasks*/-import { cosEvents, addTask, getConfig } from './cos.js';+import { cosEvents, getConfig } from './cos.js';// Known routes to analyzeconst ROUTES = [@@ -70,127 +70,6 @@ function emitLog(level, message, data = {}) {cosEvents.emit('log', logEntry);}-/**- * Generate a self-improvement analysis prompt for Opus- */-function generateAnalysisPrompt(analysisType, context) {- const baseInstructions = `You are analyzing PortOS, a developer dashboard application. Your goal is to identify real, actionable improvements.--CRITICAL RULES:-1. Only report issues you can actually see or detect-2. Be specific - include exact file paths, line numbers, component names-3. Prioritize issues by impact (security > functionality > UX > style)-4. For each issue, provide a concrete fix, not just a description-5. Use the heavy/opus model for all coding tasks - quality matters more than cost`;-- const typePrompts = {- [ANALYSIS_TYPES.UI_BUGS]: `${baseInstructions}--TASK: Analyze the UI for bugs and issues.--Page Context:-${context.pageSnapshot || 'No snapshot available'}--Console Messages:-${context.consoleMessages || 'None captured'}--Network Errors:-${context.networkErrors || 'None captured'}--Look for:-- JavaScript errors in console-- Failed network requests-- Broken links or missing images-- Form validation issues-- State management bugs-- Race conditions in data loading`,-- [ANALYSIS_TYPES.MOBILE_RESPONSIVE]: `${baseInstructions}--TASK: Analyze mobile responsiveness issues.--Desktop Snapshot (1440px):-${context.desktopSnapshot || 'No snapshot'}--Tablet Snapshot (768px):-${context.tabletSnapshot || 'No snapshot'}--Mobile Snapshot (375px):-${context.mobileSnapshot || 'No snapshot'}--Look for:-- Text overflow or truncation-- Buttons too small to tap-- Horizontal scrolling-- Elements overlapping-- Navigation issues on small screens-- Touch target sizing-- Font sizes too small on mobile`,-- [ANALYSIS_TYPES.SECURITY]: `${baseInstructions}--TASK: Security audit of the codebase.--Focus on:-- XSS vulnerabilities (especially in React components)-- Command injection (check all exec/spawn calls)-- Path traversal in file operations-- Hardcoded secrets or API keys-- Missing input validation-- CSRF protection-- Unsafe eval or Function() usage-- SQL/NoSQL injection points--Examine these critical areas:-- server/routes/*.js - all API endpoints-- server/services/*.js - business logic-- client/src/services/api.js - client API calls`,-- [ANALYSIS_TYPES.CODE_QUALITY]: `${baseInstructions}--TASK: Code quality and maintainability review.--Focus on:-- DRY violations (duplicated code)-- Functions over 50 lines that should be split-- Missing error handling-- Inconsistent patterns-- Dead code or unused imports-- TODO/FIXME comments that need addressing-- Console.log statements that should be removed-- Missing or outdated comments`- };-- return typePrompts[analysisType] || baseInstructions;-}--/**- * Create a self-improvement task for CoS- */-async function createImprovementTask(analysisType, description, priority = 'MEDIUM') {- const taskDescription = `[Self-Improvement] ${description}--Analysis Type: ${analysisType}-Model: Use claude-opus-4-5-20251101 (heavy)--Instructions:-- Thoroughly analyze the issue-- Implement a fix if possible-- Run tests to verify the fix-- Commit the changes with a clear message`;-- const task = await addTask({- description: taskDescription,- priority,- context: `Auto-generated by self-improvement system`,- model: 'claude-opus-4-5-20251101',- approvalRequired: false // Auto-approved for self-improvement- }, 'internal');-- emitLog('success', `Created improvement task: ${task.id}`, { taskId: task.id, type: analysisType });- return task;-}-/*** Run a full self-improvement cycle* This is called when CoS is idle and wants to improve itselfdiff --git a/server/services/subAgentSpawner.test.js b/server/services/subAgentSpawner.test.jsindex ee227b19e4..c4271db0c5 100644--- a/server/services/subAgentSpawner.test.js+++ b/server/services/subAgentSpawner.test.js@@ -1,4 +1,4 @@-import { describe, it, expect, vi, beforeEach } from 'vitest';+import { describe, it, expect } from 'vitest';/*** Tests for the subAgentSpawner servicediff --git a/server/services/weeklyDigest.js b/server/services/weeklyDigest.jsindex eab88c4d8f..e76e07648e 100644--- a/server/services/weeklyDigest.js+++ b/server/services/weeklyDigest.js@@ -11,7 +11,6 @@ import { existsSync } from 'fs';import { join, dirname } from 'path';import { fileURLToPath } from 'url';import { cosEvents, emitLog, getAgents } from './cos.js';-import { getLearningInsights, getAllTaskDurations } from './taskLearning.js';const __filename = fileURLToPath(import.meta.url);const __dirname = dirname(__filename);