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
chore: delete orphaned API routes and fold nav.system-resources into nav.system-health (#10021)
Adam Eivy5f5dcd9db180
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsxindex f25b009fc8..d027c9914c 100644--- a/client/src/components/Layout.jsx+++ b/client/src/components/Layout.jsx@@ -133,6 +133,16 @@ const navRowForPath = (path) => {const presentedNavRows = Object.keys(NAV_PRESENTATION).map(navRowForPath);+// A row whose destination is one tab of a group stays active across the whole+// group by declaring the prefix its sibling tabs share.+const activePrefixByPath = new Map(+ presentedNavRows.filter((row) => row.activePathPrefix).map((row) => [row.to, row.activePathPrefix])+);+const pathWithinRow = (pathname, rowPath) => {+ const prefix = activePrefixByPath.get(rowPath) ?? rowPath;+ return pathname === prefix || pathname.startsWith(prefix + '/');+};+const sectionNavItem = (section) => {const children = presentedNavRows.filter((row) => row.section === section && !row.single)@@ -491,7 +501,7 @@ export default function Layout() {resolvedNavItems.forEach(item => {if (item.children) {const isChildActive = item.children.some(child =>- child.to && (location.pathname === child.to || location.pathname.startsWith(child.to + '/'))+ child.to && pathWithinRow(location.pathname, child.to));if (isChildActive) {setExpandedSections(prev => ({ ...prev, [item.label]: true }));@@ -536,7 +546,7 @@ export default function Layout() {const owningTab = getSectionNavTabForPath('Models', location.pathname);return owningTab?.to === path || matchedCommand.path === path;}- return location.pathname === path || location.pathname.startsWith(path + '/');+ return pathWithinRow(location.pathname, path);};const isSectionActive = (item) => {diff --git a/client/src/components/Layout.test.jsx b/client/src/components/Layout.test.jsxindex 7030b6eb0e..be9788c44d 100644--- a/client/src/components/Layout.test.jsx+++ b/client/src/components/Layout.test.jsx@@ -399,7 +399,7 @@ describe('Layout — System Resources location state', () => {await renderLayout('/system-resources/storage');const link = screen.getByRole('link', { name: 'System Resources' });- expect(link).toHaveAttribute('href', '/system-resources');+ expect(link).toHaveAttribute('href', '/system-resources/overview');expect(link.className).toContain('text-port-accent');});});diff --git a/client/src/lib/navPresentation.js b/client/src/lib/navPresentation.jsindex 59ebbce126..8456bef9c9 100644--- a/client/src/lib/navPresentation.js+++ b/client/src/lib/navPresentation.js@@ -213,7 +213,8 @@ export const NAV_PRESENTATION = {'/devtools/quota-burn': { icon: Flame },'/security': { icon: Camera },'/shell': { icon: SquareTerminal },- '/system-resources': { icon: Activity },+ // Stays lit on every System Resources tab, not only the Overview it links to.+ '/system-resources/overview': { icon: Activity, activePathPrefix: '/system-resources' },'/uploads': { icon: Upload },'/devtools/usage': { icon: BarChart3 },'/devtools/video-download': { icon: Film },diff --git a/client/src/pages/SystemHealthPage.jsx b/client/src/pages/SystemHealthPage.jsxindex be14414dfa..ecab833b9a 100644--- a/client/src/pages/SystemHealthPage.jsx+++ b/client/src/pages/SystemHealthPage.jsx@@ -46,7 +46,7 @@ const DRILL_INS = ['disk', 'process', 'apps'].map(type => REMEDIATION[type]);// Icon per tab id. The manifest (`tabGroup: 'system-resources'`) owns// id/label/order — this page owns only how each tab looks; the short page-local-// labels (vs the manifest's "System Resources Overview"/"Storage Report"/+// labels (vs the manifest's "System Resources"/"Storage Report"/// "Active Queues", which need the qualifier to be unambiguous in ⌘K) come from// the manifest's `tabLabel`. The downloaded-model inventory used to be a fourth// tab here. It answered the same question Models → Status answers, in adiff --git a/client/src/pages/SystemHealthPage.test.jsx b/client/src/pages/SystemHealthPage.test.jsxindex 8172d1ad8f..e56002274a 100644--- a/client/src/pages/SystemHealthPage.test.jsx+++ b/client/src/pages/SystemHealthPage.test.jsx@@ -295,7 +295,7 @@ describe('SystemHealthPage remediation links', () => {// means to render, and that every manifest tab has a presentation entry (icon)// in SystemHealthPage.jsx, which would otherwise only surface as a thrown// import-time error. The short labels come from the manifest's `tabLabel`; ⌘K-// and voice still show "System Resources Overview"/"Storage Report"/"Active+// and voice still show "System Resources"/"Storage Report"/"Active// Queues" so each is unambiguous out of page context.describe('RESOURCE_TABS ↔ nav manifest', () => {it('renders the system-resources tabGroup in page order with a presentation entry each', () => {diff --git a/docs/API.md b/docs/API.mdindex f8f7da7cc6..770613afd1 100644--- a/docs/API.md+++ b/docs/API.md@@ -257,6 +257,7 @@ Context tools remain read-only. Semantic reads and writes are independent, defau| GET | `/cos/learning` | Get learning insights and recommendations || GET | `/cos/learning/durations` | Get task duration estimates by type || POST | `/cos/learning/backfill` | Backfill learning data from history |+| POST | `/cos/learning/recalculate-durations` | Manual repair: rebuild the success-only duration ETAs (and the execution-scoped buckets) from the agent archive. No UI or scheduled caller — run it by hand after a bulk edit or purge of the archive |### CoS Jobs (Autonomous Jobs)@@ -488,6 +489,7 @@ settings controls and source-closed UI prompts are tracked separately in #7664.| PUT | `/digital-twin/documents/:id` | Update document || DELETE | `/digital-twin/documents/:id` | Delete document || GET | `/digital-twin/export/formats` | List available export formats |+| POST | `/digital-twin/feedback/recalculate` | Manual refresh: recompute the suggested per-document weight adjustments from feedback history (also described in [the twin feature doc](features/digital-twin.md)) || POST | `/digital-twin/export` | Export the twin in the requested format || GET | `/digital-twin/tests` | Get the behavioral test suite || POST | `/digital-twin/tests/run` | Run behavioral tests against one provider/model |diff --git a/server/lib/hostControlRoutes.js b/server/lib/hostControlRoutes.jsindex edf1a73da9..1125e7b6cc 100644--- a/server/lib/hostControlRoutes.js+++ b/server/lib/hostControlRoutes.js@@ -13,7 +13,7 @@* the host, or when it sets what one will run (a repo path, a start command, a* task prompt, a shell job). Read-only GETs stay open. Mutating routes in the* same families that are deliberately left OUT:- * - apps: delete/archive/unarchive, detect-icons, scope-adherence — they+ * - apps: delete/archive/unarchive, scope-adherence — they* change only PortOS's own records or read files; nothing runs.* - CoS: stop/pause/kill/terminate/delete and feedback — they reduce or* annotate execution, never start it; task reorder/refresh/enhance,diff --git a/server/lib/navManifest.js b/server/lib/navManifest.jsindex 2802533c5d..2c6a069035 100644--- a/server/lib/navManifest.js+++ b/server/lib/navManifest.js@@ -380,8 +380,7 @@ const RAW_NAV_COMMANDS = [{ id: 'nav.loops', path: '/loops', label: 'Loops', section: 'Dev Tools', aliases: ['loops'] },{ id: 'nav.devtools.processes', path: '/devtools/processes', label: 'Processes', section: 'Dev Tools', aliases: ['devtools-processes', 'processes'] },{ id: 'nav.security', path: '/security', label: 'Security Camera', section: 'Dev Tools', aliases: ['security-camera', 'camera-monitor', 'security-feed'], keywords: ['camera', 'webcam', 'microphone', 'audio level', 'feed'] },- { id: 'nav.system-resources', path: '/system-resources', label: 'System Resources', section: 'Dev Tools' },- { id: 'nav.system-health', path: '/system-resources/overview', label: 'System Resources Overview', section: 'Dev Tools', tabGroup: 'system-resources', tabId: 'overview', tabLabel: 'Overview', previousPaths: ['/system-health'], aliases: ['system-resources', 'system-health', 'system-status', 'memory-usage', 'cpu-usage'], keywords: ['health', 'memory', 'cpu', 'disk', 'thresholds', 'top processes', 'resource usage', 'build', 'commit', 'running build', 'stale build', 'which code is running'] },+ { id: 'nav.system-health', path: '/system-resources/overview', label: 'System Resources', section: 'Dev Tools', tabGroup: 'system-resources', tabId: 'overview', tabLabel: 'Overview', previousPaths: ['/system-health', '/system-resources'], aliases: ['system-resources', 'system-health', 'system-status', 'memory-usage', 'cpu-usage'], keywords: ['health', 'memory', 'cpu', 'disk', 'thresholds', 'top processes', 'resource usage', 'build', 'commit', 'running build', 'stale build', 'which code is running'] },{ id: 'nav.system-resources.storage', path: '/system-resources/storage', label: 'Storage Report', section: 'Dev Tools', tabGroup: 'system-resources', tabId: 'storage', tabLabel: 'Storage', aliases: ['disk-usage', 'storage-report', 'disk-cleanup'], keywords: ['disk', 'storage', 'space', 'cleanup', 'cache', 'data usage', 'ai triage'] },{ id: 'nav.system-resources.queues', path: '/system-resources/queues', label: 'Active Queues', section: 'Dev Tools', tabGroup: 'system-resources', tabId: 'queues', tabLabel: 'Queues', aliases: ['active-queues', 'job-queues', 'pending-jobs', 'render-queue'], keywords: ['media jobs', 'agent tasks', 'pending', 'running', 'cancel', 'run now'] },{ id: 'nav.uploads', path: '/uploads', label: 'Uploads', section: 'Dev Tools', aliases: ['uploads'] },diff --git a/server/routes/apps/icons.js b/server/routes/apps/icons.jsindex 530f4576d6..8f00fa67d9 100644--- a/server/routes/apps/icons.js+++ b/server/routes/apps/icons.js@@ -2,7 +2,6 @@* App icon serving + detection.** GET /:id/icon → image bytes (ETag / CSP-guarded SVG)- * POST /detect-icons → { success, detected, total } (all apps)* POST /:id/detect-icon → { success, detected, appIconPath } (single app)*/@@ -93,29 +92,6 @@ router.get('/:id/icon', loadApp, asyncHandler(async (req, res) => {res.send(isRaster ? await getRasterIcon(app.id, iconPath, iconStat, size, iconData) : iconData);}));-// POST /api/apps/detect-icons - Detect and persist app icons for all apps-router.post('/detect-icons', asyncHandler(async (req, res) => {- const apps = await appsService.getAllApps();- let detected = 0;-- for (const app of apps) {- if (!app.repoPath || !await pathExists(app.repoPath)) continue;- // Skip apps that already have a valid icon path- if (app.appIconPath && await pathExists(app.appIconPath)) continue;-- const iconPath = await detectAppIcon(app.repoPath, app.type);- if (iconPath) {- await appsService.updateApp(app.id, { appIconPath: iconPath });- detected++;- console.log(`🎨 Detected icon for ${app.name}: ${iconPath.split('/').pop()}`);- }- }-- if (detected > 0) notifyAppsChanged('detect-icons');- console.log(`🎨 Icon detection complete: ${detected}/${apps.length} apps`);- res.json({ success: true, detected, total: apps.length });-}));-// POST /api/apps/:id/detect-icon - Detect and persist app icon for a single approuter.post('/:id/detect-icon', loadApp, asyncHandler(async (req, res) => {const app = req.loadedApp;diff --git a/server/routes/apps/index.js b/server/routes/apps/index.jsindex 7ee35adea4..73b85aaa03 100644--- a/server/routes/apps/index.js+++ b/server/routes/apps/index.js@@ -21,7 +21,7 @@** Route ordering is safe across sub-routers: every param route is either the* single-segment `/:id` or a deeper `/:id/...`, and the static routes- * (`/detect-icons`, `/bulk-task-type/:taskType`) differ from `/:id` by method or+ * (`/bulk-task-type/:taskType`) differ from `/:id` by method or* segment count, so no sub-router can shadow another's routes. The only* order-sensitive pair (`/:id/task-types/all` before `/:id/task-types/:taskType`)* lives entirely inside `taskTypes.js`.diff --git a/server/routes/cosLearningRoutes.js b/server/routes/cosLearningRoutes.jsindex 4d50ac49fe..b825b8ab6d 100644--- a/server/routes/cosLearningRoutes.js+++ b/server/routes/cosLearningRoutes.js@@ -168,12 +168,6 @@ router.get('/learning/recommendations/:taskType', asyncHandler(async (req, res)res.json(recommendations);}));-// POST /api/cos/learning/recalculate-model-tiers - Rebuild byModelTier from routingAccuracy-router.post('/learning/recalculate-model-tiers', asyncHandler(async (req, res) => {- const result = await taskLearning.recalculateModelTierMetrics();- res.json({ success: true, ...result });-}));-// POST /api/cos/learning/recalculate-durations - Rebuild success-only duration stats from agent archiverouter.post('/learning/recalculate-durations', asyncHandler(async (req, res) => {const result = await taskLearning.recalculateDurationStats();diff --git a/server/routes/cosLearningRoutes.test.js b/server/routes/cosLearningRoutes.test.jsindex 3856284f25..c63f81a384 100644--- a/server/routes/cosLearningRoutes.test.js+++ b/server/routes/cosLearningRoutes.test.js@@ -17,7 +17,6 @@ vi.mock('../services/taskLearning.js', () => ({recordLearningInsight: vi.fn(),getAllPromptRecommendations: vi.fn(),getPromptImprovementRecommendations: vi.fn(),- recalculateModelTierMetrics: vi.fn(),recalculateDurationStats: vi.fn(),getConfidenceLevels: vi.fn(),getTaskTypeConfidence: vi.fn(),@@ -313,17 +312,6 @@ describe('CoS Learning Routes', () => {});});- describe('POST /api/cos/learning/recalculate-model-tiers', () => {- it('should recalculate model tier metrics', async () => {- taskLearning.recalculateModelTierMetrics.mockResolvedValue({ recalculated: 5 });-- const response = await request(app).post('/api/cos/learning/recalculate-model-tiers');-- expect(response.status).toBe(200);- expect(response.body.success).toBe(true);- });- });-describe('POST /api/cos/learning/recalculate-durations', () => {it('should recalculate duration stats', async () => {taskLearning.recalculateDurationStats.mockResolvedValue({ recalculated: 3 });diff --git a/server/routes/jira.js b/server/routes/jira.jsindex 4628d3dacf..9da34ffd79 100644--- a/server/routes/jira.js+++ b/server/routes/jira.js@@ -252,18 +252,6 @@ router.get('/instances/:instanceId/tickets/:ticketId/transitions', asyncHandler(res.json(transitions);}));-/**- * DELETE /api/jira/instances/:instanceId/tickets/:ticketId- * Delete a JIRA ticket- */-router.delete('/instances/:instanceId/tickets/:ticketId', asyncHandler(async (req, res) => {- const result = await jiraService.deleteTicket(- req.params.instanceId,- req.params.ticketId- );- res.json(result);-}));-/*** POST /api/jira/instances/:instanceId/tickets/:ticketId/transition* Transition JIRA ticket statusdiff --git a/server/routes/jira.test.js b/server/routes/jira.test.jsindex a90a6920c4..917716c057 100644--- a/server/routes/jira.test.js+++ b/server/routes/jira.test.js@@ -12,7 +12,6 @@ vi.mock('../services/jira.js', () => ({updateTicket: vi.fn(),addComment: vi.fn(),getTransitions: vi.fn(),- deleteTicket: vi.fn(),transitionTicket: vi.fn(),getMyCurrentSprintTickets: vi.fn(),fetchMyCurrentSprintTickets: vi.fn(),@@ -257,24 +256,22 @@ describe('ticket id path-traversal guard', () => {beforeEach(() => vi.clearAllMocks());- it.each(bad)('rejects %s on delete, comment and transition with no upstream call', async (id) => {+ it.each(bad)('rejects %s on comment, transition and update with no upstream call', async (id) => {const app = makeApp();const responses = [- await request(app).delete(`${base}/${id}`),await request(app).post(`${base}/${id}/comments`).send({ comment: 'hi' }),await request(app).post(`${base}/${id}/transition`).send({ transitionId: '1' }),await request(app).put(`${base}/${id}`).send({ summary: 'x' })];responses.forEach((r) => expect(r.status).toBe(400));- expect(jiraService.deleteTicket).not.toHaveBeenCalled();expect(jiraService.addComment).not.toHaveBeenCalled();expect(jiraService.transitionTicket).not.toHaveBeenCalled();expect(jiraService.updateTicket).not.toHaveBeenCalled();});it('still accepts issue keys and numeric ids', async () => {- jiraService.deleteTicket.mockResolvedValue({ success: true });- expect((await request(makeApp()).delete(`${base}/ABC-123`)).status).toBe(200);- expect((await request(makeApp()).delete(`${base}/10001`)).status).toBe(200);+ jiraService.getIssue.mockResolvedValue({ key: 'ABC-123' });+ expect((await request(makeApp()).get(`${base}/ABC-123`)).status).toBe(200);+ expect((await request(makeApp()).get(`${base}/10001`)).status).toBe(200);});});diff --git a/server/routes/lmstudio.js b/server/routes/lmstudio.jsindex 596796cb5d..1ad1873e99 100644--- a/server/routes/lmstudio.js+++ b/server/routes/lmstudio.js@@ -165,22 +165,4 @@ router.put('/config', asyncHandler(async (req, res) => {res.json({ success: true, config })}))-/**- * GET /api/lmstudio/thinking-stats- * Get local thinking statistics- */-router.get('/thinking-stats', (req, res) => {- const stats = localThinking.getStats()- res.json(stats)-})--/**- * POST /api/lmstudio/reset-cache- * Reset LM Studio cached state- */-router.post('/reset-cache', (req, res) => {- lmStudioManager.resetCache()- res.json({ success: true, message: 'Cache reset' })-})-export default routerdiff --git a/server/routes/lmstudio.test.js b/server/routes/lmstudio.test.jsindex cf43b468e1..432340c9bf 100644--- a/server/routes/lmstudio.test.js+++ b/server/routes/lmstudio.test.js@@ -13,8 +13,7 @@ vi.mock('../services/lmStudioManager.js', () => ({unloadModel: vi.fn(),quickCompletion: vi.fn(),getEmbeddings: vi.fn(),- updateConfig: vi.fn(),- resetCache: vi.fn()+ updateConfig: vi.fn()}));vi.mock('../services/localThinking.js', () => ({diff --git a/server/services/jira.js b/server/services/jira.jsindex 71e3bdf6b9..78790ec84c 100644--- a/server/services/jira.js+++ b/server/services/jira.js@@ -689,23 +689,6 @@ export async function getTransitions(instanceId, ticketId) {}));}-/**- * Delete a JIRA ticket- */-export async function deleteTicket(instanceId, ticketId) {- const config = await getInstances();- const instance = config.instances[instanceId];-- if (!instance) {- throw instanceNotFound(instanceId);- }-- const client = createJiraClient(instance);- await client.delete(`/rest/api/2/issue/${encodeURIComponent(ticketId)}`);-- return { success: true, ticketId };-}-/*** Transition JIRA ticket (change status)*/@@ -1094,7 +1077,6 @@ export default {updateTicket,addComment,getTransitions,- deleteTicket,transitionTicket,getMyCurrentSprintTickets,fetchMyCurrentSprintTickets,