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: render brain scan reports in PortOS
[._.]/ Adam Eivyf202e8fa8187
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 1e263eadf5..9cd4d87c27 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -18,6 +18,7 @@- **CoS agent PRs no longer open with TUI startup noise as their description.** A PR that PortOS opened for a Codex/Antigravity/OpenCode agent led with the session's own lifecycle log — `📟 TUI session started: … (codex …)`, `💡 Open the Shell tab…`, `📟 Prompt pasted…` — before getting to what the agent actually did. The PR description now starts at the agent's completion summary and drops PortOS's status lines, along with the trailing `## Branch` / `## PR` section that only repeats what the PR page already shows.- **Review Hub success-rate alerts now require recent runs.** Low lifetime rates for task types that have been idle no longer appear as current health anomalies; alerts are shown only after enough runs occur in the rolling 30-day performance window.+- **Malware scan reports now open inside PortOS.** Scan links from Brain, the Review Hub, and completed CoS agents render the markdown in a mobile-friendly PortOS page instead of navigating a Home Screen install to the raw `.md` API response. Brain Links also has a Scan Reports filter, so clean and caution results are just as discoverable as dangerous findings.- **Branch reconciler no longer hands long-lived shared branches to the coordinator agent.** `gh-pages` (the GitHub Pages publishing branch) is now protected alongside `main`/`master`/`dev`/`develop`/`release`, so the scheduled `branch-reconcile` task never tries to "open a PR" merging it into the default branch (which would break the published site). The reconciler now reuses the single canonical `PROTECTED_BRANCHES` set in `server/lib/gitArgs.js` instead of its own narrower list, so it also picks up `dev`/`develop` protection.## Changeddiff --git a/client/src/App.jsx b/client/src/App.jsxindex c8e03cbc51..cc26763664 100644--- a/client/src/App.jsx+++ b/client/src/App.jsx@@ -84,6 +84,7 @@ const CreateApp = lazyWithReload(() => import('./pages/CreateApp'));const Templates = lazyWithReload(() => import('./pages/Templates'));const PromptManager = lazyWithReload(() => import('./pages/PromptManager'));const Brain = lazyWithReload(() => import('./pages/Brain'));+const BrainScanReport = lazyWithReload(() => import('./pages/BrainScanReport'));const Security = lazyWithReload(() => import('./pages/Security'));const DigitalTwin = lazyWithReload(() => import('./pages/DigitalTwin'));const Privacy = lazyWithReload(() => import('./pages/Privacy'));@@ -262,6 +263,7 @@ export default function App() {<Route path="calendar" element={<Navigate to="/calendar/agenda" replace />} /><Route path="calendar/:tab" element={<CalendarPage />} /><Route path="brain" element={<Navigate to="/brain/inbox" replace />} />+ <Route path="brain/links/:id/scan-report" element={<BrainScanReport />} /><Route path="brain/:tab" element={<Brain />} /><Route path="digital-twin" element={<Navigate to="/digital-twin/overview" replace />} /><Route path="digital-twin/:tab" element={<DigitalTwin />} />diff --git a/client/src/components/brain/tabs/LinksTab.jsx b/client/src/components/brain/tabs/LinksTab.jsxindex 04739a7449..aa02972079 100644--- a/client/src/components/brain/tabs/LinksTab.jsx+++ b/client/src/components/brain/tabs/LinksTab.jsx@@ -1,4 +1,5 @@import { useState, useEffect, useCallback, useRef } from 'react';+import { Link } from 'react-router-dom';import * as api from '../../../services/api';import {Link2,@@ -21,7 +22,8 @@ import {ChevronDown,ChevronUp,FolderClosed,- GripVertical+ GripVertical,+ FileText} from 'lucide-react';import BrailleSpinner from '../../BrailleSpinner';import toast from '../../ui/Toast';@@ -64,7 +66,7 @@ export default function LinksTab({ onRefresh }) {const [links, setLinks] = useState([]);const [buckets, setBuckets] = useState([]);const [loading, setLoading] = useState(true);- const [filter, setFilter] = useState('all'); // all, github, other, ungrouped+ const [filter, setFilter] = useState('all'); // all, github, scanned, other, ungroupedconst [search, setSearch] = useState('');const [editingId, setEditingId] = useState(null);const [editForm, setEditForm] = useState({});@@ -97,6 +99,7 @@ export default function LinksTab({ onRefresh }) {// Client-side filter (type / bucket membership) then keyword search.const matchesFilter = (link) => {if (filter === 'github') return link.isGitHubRepo;+ if (filter === 'scanned') return Boolean(link.malwareScan?.reportId);if (filter === 'other') return !link.isGitHubRepo;if (filter === 'ungrouped') return !link.bucketId;return true;@@ -416,6 +419,7 @@ export default function LinksTab({ onRefresh }) {{[{ id: 'all', label: 'All', count: links.length },{ id: 'github', label: 'GitHub Repos', icon: GitBranch, count: links.filter(l => l.isGitHubRepo).length },+ { id: 'scanned', label: 'Scan Reports', icon: FileText, count: links.filter(l => l.malwareScan?.reportId).length },{ id: 'other', label: 'Other Links', icon: Link2, count: links.filter(l => !l.isGitHubRepo).length },{ id: 'ungrouped', label: 'Ungrouped', icon: FolderClosed, count: links.filter(l => !l.bucketId).length }].map(tab => {@@ -680,16 +684,14 @@ export default function LinksTab({ onRefresh }) {)}{link.malwareScan?.reportId && (- <a- href={`/api/brain/links/${link.id}/scan-report`}- target="_blank"- rel="noopener noreferrer"+ <Link+ to={api.brainScanReportPath(link.id)}className={`flex items-center gap-1 text-xs ${link.malwareScan.verdict === 'DANGEROUS' ? 'text-port-error' : 'text-port-accent'} hover:underline`}- title="Open malware scan markdown report"+ title="View malware scan report">{link.malwareScan.verdict === 'DANGEROUS' ? <Skull size={12} /> : <ShieldCheck size={12} />}{link.malwareScan.verdict || 'Scan report'}- </a>+ </Link>)}{/* Local path */}diff --git a/client/src/components/cos/tabs/AgentCard.jsx b/client/src/components/cos/tabs/AgentCard.jsxindex 7ca525341f..fe77d8b766 100644--- a/client/src/components/cos/tabs/AgentCard.jsx+++ b/client/src/components/cos/tabs/AgentCard.jsx@@ -805,13 +805,11 @@ export default function AgentCard({ agent, onPause, onKill, onDelete, onResume,{agent.metadata?.taskSummary && <MarkdownOutput content={agent.metadata.taskSummary} />}{agent.metadata?.malwareScan?.reportUrl && (<a- href={agent.metadata.malwareScan.reportUrl}- target="_blank"- rel="noopener noreferrer"+ href={api.normalizeBrainScanReportPath(agent.metadata.malwareScan.reportUrl)}className={`mt-2 inline-flex items-center gap-1 text-xs hover:underline ${agent.metadata.malwareScan.verdict === 'DANGEROUS' ? 'text-port-error' : 'text-port-accent'}`}>{agent.metadata.malwareScan.verdict === 'DANGEROUS' ? <Skull size={13} /> : <ExternalLink size={13} />}- View markdown scan report{agent.metadata.malwareScan.verdict ? ` (${agent.metadata.malwareScan.verdict})` : ''}+ View scan report{agent.metadata.malwareScan.verdict ? ` (${agent.metadata.malwareScan.verdict})` : ''}</a>)}</div>diff --git a/client/src/pages/BrainScanReport.jsx b/client/src/pages/BrainScanReport.jsxnew file mode 100644index 0000000000..dbea14167a--- /dev/null+++ b/client/src/pages/BrainScanReport.jsx@@ -0,0 +1,78 @@+import { useCallback } from 'react';+import { Link, useParams } from 'react-router-dom';+import { ArrowLeft, FileText, RefreshCw, ShieldAlert, ShieldCheck, Skull } from 'lucide-react';+import * as api from '../services/api';+import MarkdownOutput from '../components/cos/MarkdownOutput';+import BrailleSpinner from '../components/BrailleSpinner';+import { useAutoRefetch } from '../hooks/useAutoRefetch';++const VERDICT_STYLES = {+ CLEAN: { Icon: ShieldCheck, className: 'bg-port-success/15 text-port-success border-port-success/30' },+ CAUTION: { Icon: ShieldAlert, className: 'bg-port-warning/15 text-port-warning border-port-warning/30' },+ DANGEROUS: { Icon: Skull, className: 'bg-port-error/15 text-port-error border-port-error/30' }+};++export default function BrainScanReport() {+ const { id } = useParams();+ const fetchReport = useCallback(async () => {+ const [link, report] = await Promise.all([+ api.getBrainLink(id, { silent: true }),+ api.getBrainScanReport(id, { silent: true })+ ]);+ return { link, report };+ }, [id]);+ const { data, loading, refetch } = useAutoRefetch(fetchReport, 30_000);++ if (loading) {+ return <div className="flex justify-center py-16"><BrailleSpinner text="Loading scan report" /></div>;+ }++ if (!data) {+ return (+ <div className="py-12 text-center">+ <p className="text-sm text-gray-400">This scan report is unavailable.</p>+ <Link to="/brain/links" className="mt-3 inline-block text-sm text-port-accent hover:underline">Back to links</Link>+ </div>+ );+ }++ const verdict = data.link.malwareScan?.verdict;+ const verdictStyle = VERDICT_STYLES[verdict];+ const VerdictIcon = verdictStyle?.Icon;++ return (+ <div className="mx-auto max-w-4xl space-y-4">+ <header className="flex flex-wrap items-start justify-between gap-3">+ <div className="min-w-0">+ <Link to="/brain/links" className="mb-2 inline-flex items-center gap-1 text-xs text-gray-500 hover:text-white">+ <ArrowLeft size={14} /> Brain Links+ </Link>+ <div className="flex items-center gap-2">+ <FileText className="text-port-accent" size={24} />+ <h1 className="truncate text-xl font-semibold text-white">{data.link.title}</h1>+ </div>+ <p className="mt-1 break-all text-xs text-gray-500">{data.link.url}</p>+ </div>+ <div className="flex items-center gap-2">+ {verdictStyle && (+ <span className={`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs font-semibold ${verdictStyle.className}`}>+ <VerdictIcon size={14} /> {verdict}+ </span>+ )}+ <button+ type="button"+ onClick={refetch}+ className="inline-flex items-center gap-1 rounded border border-port-border px-2 py-1 text-xs text-gray-400 hover:text-white"+ title="Refresh scan report"+ >+ <RefreshCw size={13} /> Refresh+ </button>+ </div>+ </header>++ <article className="rounded-lg border border-port-border bg-port-card p-4 sm:p-6">+ <MarkdownOutput content={data.report} />+ </article>+ </div>+ );+}diff --git a/client/src/pages/Review.jsx b/client/src/pages/Review.jsxindex 2c830a4021..3071346f56 100644--- a/client/src/pages/Review.jsx+++ b/client/src/pages/Review.jsx@@ -748,13 +748,11 @@ function ReviewItem({ item, config, isEditing, onComplete, onDismiss, onDelete,)}{item.metadata?.reportUrl && (<a- href={item.metadata.reportUrl}- target="_blank"- rel="noopener noreferrer"+ href={api.normalizeBrainScanReportPath(item.metadata.reportUrl)}className={`mt-2 inline-flex items-center gap-1 text-xs hover:underline ${item.metadata.verdict === 'DANGEROUS' ? 'text-port-error' : 'text-port-accent'}`}><FileText size={13} />- View markdown scan report{item.metadata.verdict ? ` (${item.metadata.verdict})` : ''}+ View scan report{item.metadata.verdict ? ` (${item.metadata.verdict})` : ''}</a>)}</div>diff --git a/client/src/services/apiBrain.js b/client/src/services/apiBrain.jsindex be6081ee97..39d625dbc9 100644--- a/client/src/services/apiBrain.js+++ b/client/src/services/apiBrain.js@@ -191,7 +191,7 @@ export const getBrainLinks = (options = {}) => {if (options.offset) params.set('offset', options.offset);return request(`/brain/links?${params}`);};-export const getBrainLink = (id) => request(`/brain/links/${id}`);+export const getBrainLink = (id, options = {}) => request(`/brain/links/${id}`, options);export const createBrainLink = (data, options = {}) => request('/brain/links', {method: 'POST',body: JSON.stringify(data),@@ -215,6 +215,21 @@ export const cloneBrainLink = (id, options = {}) => request(`/brain/links/${id}/export const pullBrainLink = (id, options = {}) => request(`/brain/links/${id}/pull`, { method: 'POST', ...options });export const openBrainLinkFolder = (id, options = {}) => request(`/brain/links/${id}/open-folder`, { method: 'POST', ...options });export const scanBrainLink = (id, options = {}) => request(`/brain/links/${id}/scan`, { method: 'POST', ...options });+export const brainScanReportPath = (id) => `/brain/links/${encodeURIComponent(id)}/scan-report`;+export const getBrainScanReport = (id, options = {}) => request(`/brain/links/${encodeURIComponent(id)}/scan-report`, {+ responseType: 'text',+ ...options+});++// Scan report links created before the in-app viewer used the raw API endpoint.+// Keep old Review and CoS records inside PortOS too, rather than opening a .md+// response in the standalone Home Screen browser context.+export const normalizeBrainScanReportPath = (reportUrl) => {+ const match = typeof reportUrl === 'string'+ ? reportUrl.match(/^\/api\/brain\/links\/([^/]+)\/scan-report$/)+ : null;+ return match ? brainScanReportPath(match[1]) : reportUrl;+};// Brain - Buckets (bookmark groups for links)export const getBrainBuckets = (options = {}) => request('/brain/buckets', options);diff --git a/server/services/malwareScanReports.js b/server/services/malwareScanReports.jsindex d3cc4064fd..8a2ec4a10d 100644--- a/server/services/malwareScanReports.js+++ b/server/services/malwareScanReports.js@@ -39,7 +39,9 @@ export async function finalizeMalwareScan({ agentId, task, success }) {const verdict = extractScanVerdict(report);const status = success && report ? 'completed' : 'failed';const completedAt = new Date().toISOString();- const reportUrl = `/api/brain/links/${scan.linkId}/scan-report`;+ // Keep report links inside the SPA. Opening the raw markdown API response+ // navigates a Home Screen install away from PortOS.+ const reportUrl = `/brain/links/${scan.linkId}/scan-report`;// This module sits on every agent-completion path. Load the Brain/Review// writers only for an actual scan so ordinary tasks do not pull those service// graphs into the completion hot path.@@ -52,7 +54,7 @@ export async function finalizeMalwareScan({ agentId, task, success }) {await brain.updateLink(scan.linkId, {malwareScan: { reportId: scan.reportId, taskId: task.id, status, verdict, completedAt }});- await agents.updateAgent(agentId, { metadata: { malwareScan: { reportUrl, status, verdict } } });+ await agents.updateAgent(agentId, { metadata: { malwareScan: { linkId: scan.linkId, reportUrl, status, verdict } } });if (report) {await review.createItem({