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
size dashboard widgets by their cell, not the viewport
[._.]/ Adam Eivyb6e495a226af
diff --git a/client/src/components/BackupWidget.jsx b/client/src/components/BackupWidget.jsxindex 9110e232ef..b67ad7a484 100644--- a/client/src/components/BackupWidget.jsx+++ b/client/src/components/BackupWidget.jsx@@ -379,16 +379,16 @@ const BackupWidget = memo(function BackupWidget() {const isNever = status?.status === 'never';return (- <div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">+ <div className="@container bg-port-card border border-port-border rounded-xl p-4 @md:p-6">{/* Header */}- <div className="flex items-center justify-between mb-4">- <div className="flex items-center gap-3">+ <div className="flex items-center justify-between gap-2 mb-4">+ <div className="flex min-w-0 items-center gap-3"><div className={`p-2 rounded-lg ${health === 'healthy' ? 'bg-port-success/10' : health === 'warning' ? 'bg-port-warning/10' : 'bg-port-error/10'}`}><HardDrive className={`w-5 h-5 ${text}`} /></div>- <div>- <h3 className="text-lg font-semibold text-white">Backup</h3>- <div className="flex items-center gap-2 text-sm">+ <div className="min-w-0">+ <h3 className="text-base @sm:text-lg font-semibold leading-tight text-white">Backup</h3>+ <div className="flex flex-wrap items-center gap-x-2 gap-y-0.5 text-sm"><span className={`w-2 h-2 rounded-full inline-block ${dot}`} /><span className={text}>{health.charAt(0).toUpperCase() + health.slice(1)}@@ -404,16 +404,16 @@ const BackupWidget = memo(function BackupWidget() {</div><Linkto="/settings"- className="flex items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2"+ className="flex shrink-0 items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2">- <span className="hidden sm:inline">Settings</span>+ <span className="hidden @xs:inline">Settings</span><ChevronRight size={16} /></Link></div>{/* Status info */}{!isNever ? (- <div className="grid grid-cols-2 gap-3 mb-4">+ <div className="grid grid-cols-1 @xs:grid-cols-2 gap-3 mb-4"><div className="bg-port-bg/50 rounded-lg p-3"><div className="flex items-center gap-2 mb-1"><Clock size={14} className="text-gray-400" />@@ -459,7 +459,7 @@ const BackupWidget = memo(function BackupWidget() {)}{/* Actions row */}- <div className="flex items-center gap-2">+ <div className="flex flex-wrap items-center gap-2">{/* Backup Now button */}<buttononClick={handleBackupNow}diff --git a/client/src/components/CosDashboardWidget.jsx b/client/src/components/CosDashboardWidget.jsxindex 4b252b117d..67d23f6aaf 100644--- a/client/src/components/CosDashboardWidget.jsx+++ b/client/src/components/CosDashboardWidget.jsx@@ -163,7 +163,7 @@ const CosDashboardWidget = memo(function CosDashboardWidget() {};return (- <div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">+ <div className="@container bg-port-card border border-port-border rounded-xl p-4 @md:p-6">{/* Header */}<div className="flex items-center justify-between mb-4"><div className="flex items-center gap-3">@@ -188,20 +188,20 @@ const CosDashboardWidget = memo(function CosDashboardWidget() {to="/cos/tasks"className="flex items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2">- <span className="hidden sm:inline">View Details</span>+ <span className="hidden @xs:inline">View Details</span><ChevronRight size={16} /></Link></div>{/* Stats Grid */}- <div className="grid grid-cols-2 sm:grid-cols-3 gap-3">+ <div className="grid grid-cols-2 @sm:grid-cols-3 gap-3">{/* Today's Progress */}<div className="bg-port-bg/50 rounded-lg p-3"><div className="flex items-center gap-2 mb-1"><CheckCircle size={14} className="text-port-success" /><span className="text-xs text-gray-500">Today</span></div>- <div className="text-lg sm:text-xl font-bold text-white">+ <div className="text-lg @sm:text-xl font-bold text-white">{today.succeeded || 0}{today.failed > 0 && (<span className="text-port-error text-sm font-normal">@@ -220,7 +220,7 @@ const CosDashboardWidget = memo(function CosDashboardWidget() {<Clock size={14} className={queue.total > 0 ? 'text-port-warning' : 'text-gray-400'} /><span className="text-xs text-gray-500">Pending</span></div>- <div className="text-lg sm:text-xl font-bold text-white">+ <div className="text-lg @sm:text-xl font-bold text-white">{queue.total || 0}</div>{queue.pendingApprovals > 0 && (@@ -239,7 +239,7 @@ const CosDashboardWidget = memo(function CosDashboardWidget() {<Brain size={14} className={getLearningStatusColor()} /><span className="text-xs text-gray-500">Learning</span></div>- <div className="text-lg sm:text-xl font-bold text-white">+ <div className="text-lg @sm:text-xl font-bold text-white">{learningSummary?.overallSuccessRate != null ? `${learningSummary.overallSuccessRate}%` : '—'}</div>{learningSummary?.skipped > 0 && (@@ -385,7 +385,7 @@ function ActivityCalendar({ data }) {<divkey={day.date}className={`- w-[9px] h-[9px] sm:w-[10px] sm:h-[10px]+ w-[9px] h-[9px] @lg:w-[10px] @lg:h-[10px]rounded-xs transition-colors cursor-default${getColorClass(day)}${day.isToday ? 'ring-1 ring-port-accent' : ''}@@ -408,12 +408,12 @@ function ActivityCalendar({ data }) {{/* Mini Legend — derived from the same table the cells use, so itcannot drift from the scale it claims to explain. */}<div className="flex items-center gap-0.5">- <span className="mr-1 hidden sm:inline">Less</span>+ <span className="mr-1 hidden @sm:inline">Less</span><div className="w-2 h-2 rounded-xs bg-port-border/20" />{HEATMAP_SHADES.slice(1).map((shade) => (<div key={shade} className={`w-2 h-2 rounded-xs ${shade}`} />))}- <span className="ml-1 hidden sm:inline">More</span>+ <span className="ml-1 hidden @sm:inline">More</span></div></div></div>diff --git a/client/src/components/DecisionLogWidget.jsx b/client/src/components/DecisionLogWidget.jsxindex 69571266ed..4d144d08e9 100644--- a/client/src/components/DecisionLogWidget.jsx+++ b/client/src/components/DecisionLogWidget.jsx@@ -237,7 +237,7 @@ const DecisionLogWidget = memo(function DecisionLogWidget() {};return (- <div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">+ <div className="@container bg-port-card border border-port-border rounded-xl p-4 @md:p-6">{/* Header */}<div className="flex items-center justify-between gap-2 mb-4"><div className="flex items-center gap-3 min-w-0">@@ -259,7 +259,7 @@ const DecisionLogWidget = memo(function DecisionLogWidget() {to="/cos/learning"className="flex items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2">- <span className="hidden sm:inline">Details</span>+ <span className="hidden @xs:inline">Details</span><ChevronRight size={16} /></Link></div>diff --git a/client/src/components/GoalProgressWidget.jsx b/client/src/components/GoalProgressWidget.jsxindex 9074d0e50c..f8e71b0e8f 100644--- a/client/src/components/GoalProgressWidget.jsx+++ b/client/src/components/GoalProgressWidget.jsx@@ -81,7 +81,7 @@ const GoalProgressWidget = memo(function GoalProgressWidget() {if (loading || !goals.length) return null;return (- <div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">+ <div className="@container bg-port-card border border-port-border rounded-xl p-4 @md:p-6"><div className="flex items-center justify-between mb-4"><div className="flex items-center gap-3"><Target className="w-6 h-6 text-port-accent" aria-hidden="true" />@@ -96,7 +96,7 @@ const GoalProgressWidget = memo(function GoalProgressWidget() {to="/goals"className="flex items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2">- <span className="hidden sm:inline">View All</span>+ <span className="hidden @xs:inline">View All</span><ChevronRight size={16} /></Link></div>diff --git a/client/src/components/NetworkExposureWidget.jsx b/client/src/components/NetworkExposureWidget.jsxindex f2dc2ad828..6d0163a9c7 100644--- a/client/src/components/NetworkExposureWidget.jsx+++ b/client/src/components/NetworkExposureWidget.jsx@@ -20,7 +20,7 @@ import NetworkSetupGuide from './NetworkSetupGuide.jsx';function CertModeBadge({ mode, host }) {if (mode === 'tailscale') {return (- <div className="flex items-center gap-2 text-sm">+ <div className="flex flex-wrap items-center gap-2 text-sm @xs:justify-end"><ShieldCheck size={14} className="text-port-success" /><span className="text-port-success">Trusted via Tailscale</span>{host && (@@ -31,7 +31,7 @@ function CertModeBadge({ mode, host }) {}if (mode === 'self-signed') {return (- <div className="flex items-center gap-2 text-sm">+ <div className="flex flex-wrap items-center gap-2 text-sm @xs:justify-end"><Shield size={14} className="text-port-warning" /><span className="text-port-warning">Self-signed cert</span></div>@@ -39,14 +39,14 @@ function CertModeBadge({ mode, host }) {}if (mode === 'unknown') {return (- <div className="flex items-center gap-2 text-sm">+ <div className="flex flex-wrap items-center gap-2 text-sm @xs:justify-end"><Shield size={14} className="text-gray-400" /><span className="text-gray-400">HTTPS · cert metadata missing</span></div>);}return (- <div className="flex items-center gap-2 text-sm">+ <div className="flex flex-wrap items-center gap-2 text-sm @xs:justify-end"><ShieldAlert size={14} className="text-port-warning" /><span className="text-port-warning">No TLS — plain HTTP</span></div>@@ -87,15 +87,15 @@ const NetworkExposureWidget = memo(function NetworkExposureWidget() {!httpsEnabled && bind?.audience === 'all-interfaces';return (- <div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">- <div className="flex items-center justify-between mb-4">- <div className="flex items-center gap-3">+ <div className="@container bg-port-card border border-port-border rounded-xl p-4 @md:p-6">+ <div className="flex items-center justify-between gap-2 mb-4">+ <div className="flex min-w-0 items-center gap-3"><div className={`p-2 rounded-lg ${httpsEnabled ? 'bg-port-success/10' : 'bg-port-warning/10'}`}><Globe className={`w-5 h-5 ${schemeColor}`} /></div>- <div>- <h3 className="text-lg font-semibold text-white">Network Exposure</h3>- <div className="flex items-center gap-2 text-sm">+ <div className="min-w-0">+ <h3 className="text-base @sm:text-lg font-semibold leading-tight text-white">Network Exposure</h3>+ <div className="flex flex-wrap items-center gap-x-2 gap-y-0.5 text-sm"><SchemeIcon size={14} className={schemeColor} /><span className={schemeColor}>{scheme.toUpperCase()}</span><span className="text-gray-500">·</span>@@ -124,22 +124,22 @@ const NetworkExposureWidget = memo(function NetworkExposureWidget() {)}<dl className="space-y-3 text-sm">- <div className="flex items-start justify-between gap-3">- <dt className="text-gray-500 flex items-center gap-2">+ <div className="flex flex-col gap-0.5 @xs:flex-row @xs:items-start @xs:justify-between @xs:gap-3">+ <dt className="shrink-0 text-gray-500 flex items-center gap-2"><Shield size={14} />Cert mode</dt>- <dd className="text-right min-w-0">+ <dd className="min-w-0 text-left @xs:text-right"><CertModeBadge mode={cert.mode} host={cert.tailscaleHost} /></dd></div>- <div className="flex items-start justify-between gap-3">- <dt className="text-gray-500 flex items-center gap-2">+ <div className="flex flex-col gap-0.5 @xs:flex-row @xs:items-start @xs:justify-between @xs:gap-3">+ <dt className="shrink-0 text-gray-500 flex items-center gap-2"><Globe size={14} />Bind audience</dt>- <dd className="text-right text-gray-300">+ <dd className="min-w-0 text-left text-gray-300 @xs:text-right">{bind.audience === 'loopback-only' && 'Loopback only'}{bind.audience === 'all-interfaces' && 'All interfaces'}{bind.audience === 'specific-interface' && (@@ -149,12 +149,12 @@ const NetworkExposureWidget = memo(function NetworkExposureWidget() {</div>{loopbackMirror.enabled && (- <div className="flex items-start justify-between gap-3">- <dt className="text-gray-500 flex items-center gap-2">+ <div className="flex flex-col gap-0.5 @xs:flex-row @xs:items-start @xs:justify-between @xs:gap-3">+ <dt className="shrink-0 text-gray-500 flex items-center gap-2"><Unlock size={14} />Loopback HTTP mirror</dt>- <dd className="text-right text-gray-300">+ <dd className="min-w-0 text-left text-gray-300 @xs:text-right">{/* Mirror is bound to 127.0.0.1 server-side, so it's onlyreachable when the browser is on the same host. Anywhereelse (Tailscale IP, LAN), an `http://localhost:5553` link@@ -182,14 +182,14 @@ const NetworkExposureWidget = memo(function NetworkExposureWidget() {</div>)}- <div className="flex items-start justify-between gap-3">- <dt className="text-gray-500 flex items-center gap-2">+ <div className="flex flex-col gap-0.5 @xs:flex-row @xs:items-start @xs:justify-between @xs:gap-3">+ <dt className="shrink-0 text-gray-500 flex items-center gap-2">{mic.available ? <Mic size={14} /> : <MicOff size={14} />}Voice / mic</dt>- <dd className="text-right">+ <dd className="min-w-0 text-left @xs:text-right">{mic.available ? (- <div className="flex items-center gap-1 text-port-success">+ <div className="flex flex-wrap items-center gap-1 text-port-success @xs:justify-end"><CheckCircle size={14} /><span>Available</span><span className="text-gray-500 text-xs">@@ -197,7 +197,7 @@ const NetworkExposureWidget = memo(function NetworkExposureWidget() {</span></div>) : (- <div className="flex items-center gap-1 text-port-warning">+ <div className="flex items-start gap-1 text-port-warning @xs:justify-end"><AlertTriangle size={14} /><span>Blocked — HTTP on non-loopback origin</span></div>@@ -210,7 +210,7 @@ const NetworkExposureWidget = memo(function NetworkExposureWidget() {<div className="flex flex-wrap items-center gap-x-4 gap-y-2"><Linkto="/capabilities"- className="inline-flex min-h-[44px] items-center text-sm text-port-accent hover:text-port-accent/80 sm:min-h-0"+ className="inline-flex min-h-[44px] items-center text-sm text-port-accent hover:text-port-accent/80 @sm:min-h-0">Open setup</Link>@@ -218,7 +218,7 @@ const NetworkExposureWidget = memo(function NetworkExposureWidget() {href={docsUrl}target="_blank"rel="noreferrer"- className="inline-flex min-h-[44px] items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 sm:min-h-0"+ className="inline-flex min-h-[44px] items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 @sm:min-h-0"><span>Port + scheme guide</span><ExternalLink size={12} />diff --git a/client/src/components/SystemHealthWidget.jsx b/client/src/components/SystemHealthWidget.jsxindex fe698d082c..236f20d766 100644--- a/client/src/components/SystemHealthWidget.jsx+++ b/client/src/components/SystemHealthWidget.jsx@@ -74,16 +74,16 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })const thresholds = resolveHealthThresholds(health.thresholds);return (- <div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">+ <div className="@container bg-port-card border border-port-border rounded-xl p-4 @md:p-6">{/* Header */}- <div className="flex items-center justify-between mb-4">- <div className="flex items-center gap-3">- <div className={`p-2 rounded-lg ${healthStyle.bg}`}>+ <div className="flex items-center justify-between gap-2 mb-4">+ <div className="flex min-w-0 items-center gap-3">+ <div className={`shrink-0 p-2 rounded-lg ${healthStyle.bg}`}><Server className={`w-5 h-5 ${healthStyle.color}`} /></div>- <div>- <h3 className="text-lg font-semibold text-white">System Health</h3>- <div className="flex items-center gap-2 text-sm">+ <div className="min-w-0">+ <h3 className="text-base @sm:text-lg font-semibold leading-tight text-white">System Health</h3>+ <div className="flex flex-wrap items-center gap-x-2 gap-y-0.5 text-sm"><HealthIcon size={14} className={healthStyle.color} /><span className={healthStyle.color}>{overallHealth.charAt(0).toUpperCase() + overallHealth.slice(1)}@@ -94,9 +94,9 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })</div></div></div>- <div className="flex items-center gap-3">+ <div className="flex shrink-0 items-center gap-1 @sm:gap-3"><span- className={`hidden md:inline-flex ${healthStyle.color}`}+ className={`hidden @sm:inline-flex ${healthStyle.color}`}title="Live load matrix — top row reflects memory/cpu/proc/apps/disk"><MicroGlyph variant="matrix" size={28} intensity={matrixIntensity} />@@ -115,7 +115,7 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })to="/system-resources/overview"className="flex items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2">- <span className="hidden sm:inline">Details</span>+ <span className="hidden @xs:inline">Details</span><ChevronRight size={16} /></Link></div>@@ -147,14 +147,14 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState }))}{/* Stats Grid */}- <div className="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3">+ <div className="grid grid-cols-2 @sm:grid-cols-3 @2xl:grid-cols-5 gap-3">{/* Memory Usage */}<div className="bg-port-bg/50 rounded-lg p-3">- <div className="flex items-center gap-2 mb-1">- <HardDrive size={14} className="text-purple-400" />- <span className="text-xs text-gray-500">Memory</span>+ <div className="flex min-w-0 items-center gap-2 mb-1">+ <HardDrive size={14} className="hidden shrink-0 text-purple-400 @2xs:block" />+ <span className="truncate text-xs text-gray-500">Memory</span></div>- <div className="text-lg sm:text-xl font-bold text-port-accent">+ <div className="text-lg @sm:text-xl font-bold text-port-accent">{system.memory.usagePercent}%</div><div className="text-xs text-gray-500">@@ -170,11 +170,11 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState }){/* CPU Usage */}<div className="bg-port-bg/50 rounded-lg p-3">- <div className="flex items-center gap-2 mb-1">- <Cpu size={14} className="text-blue-400" />- <span className="text-xs text-gray-500">CPU</span>+ <div className="flex min-w-0 items-center gap-2 mb-1">+ <Cpu size={14} className="hidden shrink-0 text-blue-400 @2xs:block" />+ <span className="truncate text-xs text-gray-500">CPU</span></div>- <div className="text-lg sm:text-xl font-bold text-port-accent">+ <div className="text-lg @sm:text-xl font-bold text-port-accent">{system.cpu.usagePercent}%</div><div className="text-xs text-gray-500">@@ -190,11 +190,11 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState }){/* Processes */}<div className="bg-port-bg/50 rounded-lg p-3">- <div className="flex items-center gap-2 mb-1">- <Activity size={14} className="text-emerald-400" />- <span className="text-xs text-gray-500">Processes</span>+ <div className="flex min-w-0 items-center gap-2 mb-1">+ <Activity size={14} className="hidden shrink-0 text-emerald-400 @2xs:block" />+ <span className="truncate text-xs text-gray-500">Processes</span></div>- <div className="text-lg sm:text-xl font-bold text-white">+ <div className="text-lg @sm:text-xl font-bold text-white">{processes.online}<span className="text-sm font-normal text-gray-500">/{processes.total}</span></div>@@ -214,13 +214,13 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })className="bg-port-bg/50 rounded-lg p-3"title="PM2-managed apps online vs. total. Native projects (Xcode, iOS) have no detectable runtime and are listed separately.">- <div className="flex items-center gap-2 mb-1">- <Zap size={14} className="text-amber-400" />- <span className="text-xs text-gray-500">Services</span>+ <div className="flex min-w-0 items-center gap-2 mb-1">+ <Zap size={14} className="hidden shrink-0 text-amber-400 @2xs:block" />+ <span className="truncate text-xs text-gray-500">Services</span></div>{apps.total > 0 ? (<>- <div className="text-lg sm:text-xl font-bold text-white">+ <div className="text-lg @sm:text-xl font-bold text-white">{apps.online}<span className="text-sm font-normal text-gray-500">/{apps.total}</span></div>@@ -242,7 +242,7 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })</>) : (<>- <div className="text-lg sm:text-xl font-bold text-gray-500">—</div>+ <div className="text-lg @sm:text-xl font-bold text-gray-500">—</div><div className="text-xs text-gray-500">{apps.unmanaged > 0 ? `${apps.unmanaged} native only` : 'No apps'}</div>@@ -257,11 +257,11 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })aria-label="Open disk usage report"className="block rounded-lg bg-port-bg/50 p-3 transition-colors hover:bg-port-bg/80 focus:outline-none focus:ring-2 focus:ring-port-accent/60">- <div className="flex items-center gap-2 mb-1">- <Database size={14} className="text-cyan-400" />- <span className="text-xs text-gray-500">Disk</span>+ <div className="flex min-w-0 items-center gap-2 mb-1">+ <Database size={14} className="hidden shrink-0 text-cyan-400 @2xs:block" />+ <span className="truncate text-xs text-gray-500">Disk</span></div>- <div className={`text-lg sm:text-xl font-bold ${pctTone(system.disk.usagePercent, thresholds.diskWarn, thresholds.diskCritical)}`}>+ <div className={`text-lg @sm:text-xl font-bold ${pctTone(system.disk.usagePercent, thresholds.diskWarn, thresholds.diskCritical)}`}>{system.disk.usagePercent}%</div><div className="text-xs text-gray-500">@@ -280,10 +280,10 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState }){/* CoS Status (if running) */}{cos && (<div className="mt-4 pt-4 border-t border-port-border">- <div className="flex items-center justify-between text-sm">- <div className="flex items-center gap-2">+ <div className="flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-sm">+ <div className="flex min-w-0 items-center gap-2"><div className={`w-2 h-2 rounded-full ${cos.running ? (cos.paused ? 'bg-port-warning' : 'bg-port-success animate-pulse') : 'bg-gray-500'}`} />- <span className="text-gray-300">Chief of Staff</span>+ <span className="truncate text-gray-300">Chief of Staff</span><span className="text-gray-500">{cos.running ? (cos.paused ? 'Paused' : 'Active') : 'Stopped'}</span>diff --git a/client/src/components/UpcomingTasksWidget.jsx b/client/src/components/UpcomingTasksWidget.jsxindex 09286b6bb1..fe3f174014 100644--- a/client/src/components/UpcomingTasksWidget.jsx+++ b/client/src/components/UpcomingTasksWidget.jsx@@ -34,7 +34,7 @@ const UpcomingTasksWidget = memo(function UpcomingTasksWidget() {// which used to be indistinguishable from "nothing is scheduled".if (error) {return (- <div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6" role="status">+ <div className="@container bg-port-card border border-port-border rounded-xl p-4 @md:p-6" role="status"><div className="flex items-center gap-3"><Clock className="w-6 h-6 text-gray-500" aria-hidden="true" /><div>@@ -87,7 +87,7 @@ const UpcomingTasksWidget = memo(function UpcomingTasksWidget() {};return (- <div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">+ <div className="@container bg-port-card border border-port-border rounded-xl p-4 @md:p-6">{/* Header */}<div className="flex items-center justify-between mb-4"><div className="flex items-center gap-3">@@ -109,7 +109,7 @@ const UpcomingTasksWidget = memo(function UpcomingTasksWidget() {to="/cos/schedule"className="flex items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2">- <span className="hidden sm:inline">Schedule</span>+ <span className="hidden @xs:inline">Schedule</span><ChevronRight size={16} /></Link></div>diff --git a/client/src/components/WhileAwayWidget.jsx b/client/src/components/WhileAwayWidget.jsxindex ee9775e283..610063c1a7 100644--- a/client/src/components/WhileAwayWidget.jsx+++ b/client/src/components/WhileAwayWidget.jsx@@ -99,7 +99,7 @@ export default function WhileAwayWidget() {if (loading && !data) {return (- <div className="bg-port-card border border-port-border rounded-xl p-4 flex items-center justify-center min-h-[120px]">+ <div className="@container bg-port-card border border-port-border rounded-xl p-4 flex items-center justify-center min-h-[120px]"><Loader2 className="w-5 h-5 text-gray-500 animate-spin" /></div>);@@ -114,7 +114,7 @@ export default function WhileAwayWidget() {const windowSince = sinceRef.current || data.sinceIso;return (- <div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">+ <div className="@container bg-port-card border border-port-border rounded-xl p-4 @md:p-6">{/* Header */}<div className="flex items-center justify-between mb-3 gap-3"><div className="flex items-center gap-3 min-w-0">@@ -122,7 +122,7 @@ export default function WhileAwayWidget() {<Moon className="w-5 h-5 text-port-accent" /></div><div className="min-w-0">- <h3 className="text-lg font-semibold text-white">While You Were Away</h3>+ <h3 className="text-base @sm:text-lg font-semibold text-white">While You Were Away</h3><p className="text-sm text-gray-500 truncate">{total > 0? `${total} agent run${total !== 1 ? 's' : ''} since ${timeAgo(windowSince)}`@@ -139,7 +139,7 @@ export default function WhileAwayWidget() {aria-label="Mark as seen — reset the window to now"><Eye size={13} />- <span className="hidden sm:inline">Mark as seen</span>+ <span className="hidden @sm:inline">Mark as seen</span></button>)}</div>diff --git a/client/src/components/dashboard/AGENTS.md b/client/src/components/dashboard/AGENTS.mdindex e984acc2b8..47e3a4d189 100644--- a/client/src/components/dashboard/AGENTS.md+++ b/client/src/components/dashboard/AGENTS.md@@ -16,7 +16,7 @@ On drop, `onDragEnd` re-flows the whole grid through `reflowToOrder` so its read**One source of truth for the mobile/desktop seam.** `DashboardGrid` measures its own *container* (`useContainerWidth`), which page padding makes narrower than the viewport — so a Tailwind `sm:` breakpoint disagrees with it in a ~30px band. Anything outside the grid that needs to know which affordance is live (the Dashboard's edit-mode hint) reads it from the `onLayoutModeChange` callback, never from a CSS breakpoint.-**A widget lays out by CONTAINER query, never by viewport breakpoint.** A tile is ~250px wide on a 2560px screen, so every viewport `sm:`/`md:`/`lg:` inside it is unconditionally true and pins the widest layout into the narrowest column. This bites hardest when a component built for a full-width page is reused as a widget — `TaskAddForm` (via `QuickTaskWidget`) kept its wide row and squeezed the description textarea to one character per line. Put `@container` on the **component's own root**, not on the grid cell, and prefix its layout classes `@sm:`/`@md:`/`@lg:`: the same component also renders in drawers, settings panels and full-width pages that provide no container ancestor, where a cell-level container would leave every `@` variant permanently unmatched. Viewport breakpoints remain correct for hover-vs-touch affordances (`md:opacity-0 md:group-hover:opacity-100`), which really are about the device, not the box.+**A widget lays out by CONTAINER query, never by viewport breakpoint.** A tile is ~250px wide on a 2560px screen, so every viewport `sm:`/`md:`/`lg:` inside it is unconditionally true and pins the widest layout into the narrowest column. This bites hardest when a component built for a full-width page is reused as a widget — `TaskAddForm` (via `QuickTaskWidget`) kept its wide row and squeezed the description textarea to one character per line. Put `@container` on the **component's own root**, not on the grid cell, and prefix its layout classes `@sm:`/`@md:`/`@lg:`: the same component also renders in drawers, settings panels and full-width pages that provide no container ancestor, where a cell-level container would leave every `@` variant permanently unmatched. Viewport breakpoints remain correct for hover-vs-touch affordances (`md:opacity-0 md:group-hover:opacity-100`), which really are about the device, not the box — but a widget that needs one has to say so in the allowlist, because **`client/src/dashboardWidgetContainerConventions.test.js` fails on any bare `sm:`/`md:`/`lg:`/`xl:`/`2xl:` variant in a component `widgetRegistry.jsx` lazy-imports.** It scans the registry's own modules, not their whole import closure: a shared primitive that also renders on a real page has a viewport of its own to answer to.**Widget order lives in the grid.** `saveGridEdit` rewrites the layout's `widgets` array into `readingOrderIds(grid)` so LayoutEditor lists widgets in the order the dashboard actually shows them. By default `reconcileGrid` iterates the *grid* and uses `widgets` only for membership — position edits survive a widget toggle or a rename. LayoutEditor's Move up/down buttons therefore have to say so explicitly: `save`/`commitDuplicate` pass `reordered`, which `isReordered()` derives by comparing the draft list against the `unmovedOrder` ref — the order the draft would have had if the user had never pressed Move (`add` appends to it, `remove` filters it, `move` deliberately doesn't touch it). That baseline can't be reconstructed from the widget list after the fact, since nothing in it records which widgets were added this session or in what order; keeping it means a move-up-then-back nets out to `false` while a just-added widget being moved, or any reorder in a layout that started empty, still reads as `true`, and `Dashboard.jsx` forwards it as `reconcileGrid(base, widgets, { reorder })`, which re-flows the reconciled grid to the list order. **Never infer that flag by comparing `widgets` to `readingOrderIds(grid)`** — layouts arranged before `saveGridEdit` started syncing the two can already disagree, so inferring would re-pack a carefully arranged desktop layout on the first unrelated save (#4132).diff --git a/client/src/components/dashboard/builtins/AppsGridWidget.jsx b/client/src/components/dashboard/builtins/AppsGridWidget.jsxindex f84e4a0233..6e64c070fe 100644--- a/client/src/components/dashboard/builtins/AppsGridWidget.jsx+++ b/client/src/components/dashboard/builtins/AppsGridWidget.jsx@@ -7,7 +7,7 @@ export default function AppsGridWidget({ dashboardState }) {const archivedCount = apps.length - activeApps.length;if (apps.length === 0) {return (- <div className="relative bg-port-card border border-port-border rounded-xl p-8 sm:p-12 text-center">+ <div className="@container relative bg-port-card border border-port-border rounded-xl p-8 @lg:p-12 text-center"><div className="flex justify-center mb-4 text-port-accent/70"><MicroGlyph variant="reticle" size={48} state="accent" /></div>@@ -23,11 +23,11 @@ export default function AppsGridWidget({ dashboardState }) {);}return (- <div className="space-y-2">+ <div className="@container space-y-2"><p className="text-xs text-gray-500">{activeApps.length} app{activeApps.length !== 1 ? 's' : ''} registered{archivedCount > 0 ? ` (${archivedCount} archived)` : ''}</p>- <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-3">+ <div className="grid grid-cols-1 @sm:grid-cols-2 @lg:grid-cols-3 @3xl:grid-cols-4 @5xl:grid-cols-5 @7xl:grid-cols-6 gap-3">{sortedApps.map((app) => (<AppTile key={app.id} app={app} onUpdate={refetch} />))}diff --git a/client/src/components/dashboard/builtins/HourlyActivityWidget.jsx b/client/src/components/dashboard/builtins/HourlyActivityWidget.jsxindex 3337d9141e..674bcd662d 100644--- a/client/src/components/dashboard/builtins/HourlyActivityWidget.jsx+++ b/client/src/components/dashboard/builtins/HourlyActivityWidget.jsx@@ -29,8 +29,8 @@ export default function HourlyActivityWidget({ dashboardState }) {if (totalSessions === 0) return null;return (- <div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">- <div className="flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-4">+ <div className="@container bg-port-card border border-port-border rounded-xl p-4 @md:p-6">+ <div className="flex flex-col @sm:flex-row @sm:items-center justify-between gap-2 mb-4"><div className="flex items-center gap-3"><div className="text-2xl" aria-hidden="true">⏰</div><div>@@ -41,7 +41,7 @@ export default function HourlyActivityWidget({ dashboardState }) {{peakDescription && <div className="text-sm text-port-success">{peakDescription}</div>}</div>- <div className="grid grid-cols-6 sm:grid-cols-12 gap-1.5 sm:gap-1" role="img" aria-label="Hourly activity heatmap">+ <div className="grid grid-cols-6 @lg:grid-cols-12 gap-1.5 @lg:gap-1" role="img" aria-label="Hourly activity heatmap">{hourlyActivity.map((count, hour) => (<divkey={hour}@@ -52,11 +52,11 @@ export default function HourlyActivityWidget({ dashboardState }) {))}</div>- <div className="mt-2 grid grid-cols-6 sm:grid-cols-12 gap-1.5 sm:gap-1 text-xs text-gray-500">+ <div className="mt-2 grid grid-cols-6 @lg:grid-cols-12 gap-1.5 @lg:gap-1 text-xs text-gray-500">{hourlyActivity.map((_, hour) => (<div key={hour} className="text-center">- <span className="hidden sm:inline">{hour % 3 === 0 ? formatHourOfDay(hour, { style: 'tiny' }) : ''}</span>- <span className="sm:hidden">{hour % 4 === 0 ? formatHourOfDay(hour, { style: 'tiny' }) : ''}</span>+ <span className="hidden @lg:inline">{hour % 3 === 0 ? formatHourOfDay(hour, { style: 'tiny' }) : ''}</span>+ <span className="@lg:hidden">{hour % 4 === 0 ? formatHourOfDay(hour, { style: 'tiny' }) : ''}</span></div>))}</div>@@ -64,11 +64,11 @@ export default function HourlyActivityWidget({ dashboardState }) {<div className="mt-4 flex items-center justify-end gap-2 text-xs text-gray-500"><span>Less</span><div className="flex gap-1">- <div className="w-4 h-4 sm:w-3 sm:h-3 rounded-xs bg-port-border/30" />- <div className="w-4 h-4 sm:w-3 sm:h-3 rounded-xs bg-port-success/20" />- <div className="w-4 h-4 sm:w-3 sm:h-3 rounded-xs bg-port-success/40" />- <div className="w-4 h-4 sm:w-3 sm:h-3 rounded-xs bg-port-success/70" />- <div className="w-4 h-4 sm:w-3 sm:h-3 rounded-xs bg-port-success" />+ <div className="w-4 h-4 @lg:w-3 @lg:h-3 rounded-xs bg-port-border/30" />+ <div className="w-4 h-4 @lg:w-3 @lg:h-3 rounded-xs bg-port-success/20" />+ <div className="w-4 h-4 @lg:w-3 @lg:h-3 rounded-xs bg-port-success/40" />+ <div className="w-4 h-4 @lg:w-3 @lg:h-3 rounded-xs bg-port-success/70" />+ <div className="w-4 h-4 @lg:w-3 @lg:h-3 rounded-xs bg-port-success" /></div><span>More</span></div>diff --git a/client/src/components/dashboard/builtins/QuickStatsWidget.jsx b/client/src/components/dashboard/builtins/QuickStatsWidget.jsxindex 28c360be98..2fbf0bfc17 100644--- a/client/src/components/dashboard/builtins/QuickStatsWidget.jsx+++ b/client/src/components/dashboard/builtins/QuickStatsWidget.jsx@@ -1,9 +1,9 @@export default function QuickStatsWidget({ dashboardState }) {const { appStats } = dashboardState;return (- <div className="bg-port-card border border-port-border rounded-xl p-4 h-full">+ <div className="@container bg-port-card border border-port-border rounded-xl p-4 h-full"><h3 className="text-sm font-semibold text-white mb-3">Quick Stats</h3>- <div className="grid grid-cols-2 gap-2">+ <div className="grid grid-cols-2 @lg:grid-cols-4 gap-2"><StatCard label="Total Apps" value={appStats.total} icon="📦" /><StatCard label="Online" value={appStats.online} icon="🟢" /><StatCard label="Stopped" value={appStats.stopped} icon="🟡" />@@ -20,9 +20,9 @@ export default function QuickStatsWidget({ dashboardState }) {function StatCard({ label, value, icon }) {return (<div className="bg-port-bg border border-port-border rounded-lg p-3" role="group" aria-label={`${label}: ${value}`}>- <div className="flex items-center gap-2 mb-1">- <span aria-hidden="true" className="text-base">{icon}</span>- <span className="text-xs text-gray-500">{label}</span>+ <div className="flex min-w-0 items-start gap-2 mb-1">+ <span aria-hidden="true" className="shrink-0 text-base leading-tight">{icon}</span>+ <span className="min-w-0 text-xs leading-tight text-gray-500">{label}</span></div><div className="text-xl font-bold text-white">{value}</div></div>diff --git a/client/src/dashboardWidgetContainerConventions.test.js b/client/src/dashboardWidgetContainerConventions.test.jsnew file mode 100644index 0000000000..18aadd73a3--- /dev/null+++ b/client/src/dashboardWidgetContainerConventions.test.js@@ -0,0 +1,111 @@+/**+ * Dashboard widgets lay out by CONTAINER query, never by viewport breakpoint.+ *+ * `client/src/components/dashboard/AGENTS.md` states the rule; this guard is+ * what stops it drifting back. A dashboard cell is a column of a 12-column+ * grid, so a `quarter` widget is ~250px wide no matter how wide the monitor is+ * — and on a 2560px screen every `sm:`/`md:`/`lg:` inside it is unconditionally+ * true. The result is the widest layout pinned into the narrowest column:+ * System Health rendered its five metric tiles `lg:grid-cols-5` at ~40px each,+ * so "Memory"/"CPU"/"Processes" overlapped into an unreadable band, and the+ * `hidden sm:inline` label on "Mark as seen" expanded the button until the+ * While-You-Were-Away heading wrapped one word per line. Both got *worse* on a+ * narrow monitor, because a narrower viewport packs the same columns into less+ * room while still satisfying `sm:`.+ *+ * The rule: a component reachable from `WIDGETS` in `widgetRegistry.jsx` may+ * not carry a bare viewport variant in a class string. Put `@container` on the+ * component's own root and prefix its layout classes `@sm:`/`@md:`/`@lg:` —+ * on the component, not the grid cell, since the same component also renders+ * in drawers and full-width pages that provide no container ancestor.+ *+ * Scope is the registry's own modules (not their whole import closure): those+ * are the components the grid sizes, and a shared primitive used on real pages+ * too has a viewport of its own to answer to. Widgets that genuinely need a+ * viewport variant — a hover-vs-touch affordance is about the device, not the+ * box — go in ALLOWED with the reason.+ */++import { describe, it, expect } from 'vitest';+import { readFileSync, existsSync } from 'fs';+import { join, dirname, normalize } from 'path';+import { fileURLToPath } from 'url';+import { lineOf, maskComments, stringLiterals } from './test/classNameScan.js';++const SRC_ROOT = dirname(fileURLToPath(import.meta.url));+const REGISTRY = 'components/dashboard/widgetRegistry.jsx';++/**+ * Widgets that legitimately answer to the viewport, with the reason they do.+ * A row here is a design call about the *device* (pointer type, screen), never+ * a way past the guard for a layout that is really about the cell's width.+ */+const ALLOWED = new Map();++// `sm:` … `2xl:` at the head of a class token, but not `@sm:` (container) and+// not the tail of some other variant (`group-hover:`, `max-sm:`).+const VIEWPORT_VARIANT = /(?:^|\s)(sm|md|lg|xl|2xl):[\w[\]().\-/:]+/g;++/** Source files of every component the widget registry lazy-imports. */+export function widgetSources(srcRoot = SRC_ROOT) {+ const registry = maskComments(readFileSync(join(srcRoot, REGISTRY), 'utf8'));+ const specifiers = [...registry.matchAll(/lazyWithReload\(\(\) => import\('([^']+)'\)\)/g)]+ .map((m) => m[1]);+ return specifiers.map((specifier) => {+ const base = normalize(join(dirname(REGISTRY), specifier));+ const resolved = ['.jsx', '.js', '/index.jsx']+ .map((ext) => `${base}${ext}`)+ .find((candidate) => existsSync(join(srcRoot, candidate)));+ if (!resolved) throw new Error(`widgetRegistry imports an unresolvable module: ${specifier}`);+ return resolved;+ });+}++export function violationsIn(rawSource, file) {+ const source = maskComments(rawSource);+ return stringLiterals(source).flatMap(({ value, index }) => {+ VIEWPORT_VARIANT.lastIndex = 0;+ return [...value.matchAll(VIEWPORT_VARIANT)]+ .map((m) => `${file}:${lineOf(source, index)} — "${m[0].trim()}"`);+ });+}++const findViolations = (file) => violationsIn(readFileSync(join(SRC_ROOT, file), 'utf8'), file);++describe('dashboard widget container-query conventions', () => {+ const files = widgetSources();++ it('resolves every widget the registry declares', () => {+ // The registry is the contract; a silently-empty scan is a green guard+ // that proves nothing.+ expect(files.length).toBeGreaterThanOrEqual(25);+ expect(files).toContain('components/SystemHealthWidget.jsx');+ expect(files).toContain('components/dashboard/builtins/QuickStatsWidget.jsx');+ });++ it('flags a viewport variant and clears every container form', () => {+ const flagged = (markup) => violationsIn(`<div className="${markup}" />`, 'probe.jsx').length;+ expect(flagged('grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3')).toBe(2);+ expect(flagged('hidden sm:inline')).toBe(1);+ expect(flagged('p-4 sm:p-6')).toBe(1);+ expect(flagged('grid grid-cols-2 @sm:grid-cols-3 @2xl:grid-cols-5 gap-3')).toBe(0);+ expect(flagged('@container rounded-xl p-4 @md:p-6')).toBe(0);+ // Not a viewport variant: the tail of a compound one, or a max-width form.+ expect(flagged('md:opacity-0 group-hover:opacity-100')).toBe(1);+ expect(flagged('max-sm:sr-only')).toBe(0);+ // A doc comment quoting an example class string is not markup.+ expect(violationsIn('// e.g. "p-4 sm:p-6"', 'probe.jsx')).toEqual([]);+ });++ it('never sizes a widget by the viewport', () => {+ const violations = files+ .filter((file) => !ALLOWED.has(file))+ .flatMap((file) => findViolations(file));+ expect(violations).toEqual([]);+ });++ it('keeps the allowlist honest — every exempt widget still has the variant it was exempted for', () => {+ const stale = [...ALLOWED.keys()].filter((file) => findViolations(file).length === 0);+ expect(stale).toEqual([]);+ });+});diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.jsindex 05d1c6a509..25260692e8 100644--- a/scripts/ci-test-plan.js+++ b/scripts/ci-test-plan.js@@ -436,13 +436,14 @@ const structuralTestsFor = (changedFiles, trackedSet) => {// Both `.js` and `.jsx`: the StrictMode mounted-ref bug the first guard covers// reached its widest blast radius through a plain-`.js` hook (`useAsyncAction`),// so a `.jsx`-only trigger would miss the case that matters most, and the- // responsive-grid, popover-clamp, pre-wrap/break, safe-storage,- // heading-truncation, sub-nav, and global-shadow guards read class strings, storage- // accesses, declarations, and JSX markup out of both extensions.+ // responsive-grid, popover-clamp, pre-wrap/break, safe-storage, heading-truncation,+ // sub-nav, dashboard-widget container-query, and global-shadow guards read class+ // strings, storage accesses, declarations, and JSX markup out of both extensions.// None of these files has a source sibling or imports an app module, so nothing// else selects them — without this entry they only ever run on a full suite.if (changedFiles.some((path) => /^client\/src\/.*\.jsx?$/.test(path))) {add('client/src/asyncEffectDisposalConventions.test.js');+ add('client/src/dashboardWidgetContainerConventions.test.js');add('client/src/globalShadowConventions.test.js');add('client/src/headingTruncationConventions.test.js');add('client/src/hooks/mountedRefConventions.test.js');