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(cybercity): add weather system, shooting stars, billboards, and HUD vitals
Adam Eivy78532f823ca8
diff --git a/.changelog/v0.12.x.md b/.changelog/v0.12.x.mdindex ff64e02eba..9fbea59026 100644--- a/.changelog/v0.12.x.md+++ b/.changelog/v0.12.x.md@@ -195,6 +195,43 @@ This release adds branch management and automated release workflow capabilities- `client/src/components/city/BuildingCluster.jsx` — Added position callback for data stream/traffic/road coordination- `client/src/pages/CyberCity.jsx` — Added scanline overlay, building click navigation via React Router+### CyberCity — Immersive Atmosphere & Live Intel+- **Dynamic weather system**: Rain particles and lightning flashes respond to system health — clear skies when all apps are online, increasing rain intensity as more systems go down, with dramatic lightning flashes during critical states. Rain uses custom GPU shaders for elongated drop effects with depth-aware sizing+- **Shooting stars**: Occasional bright meteors streak across the sky with glowing heads and fading trails — 3 staggered slots spawn at random intervals with randomized colors (white, blue-white, golden, cyan), directions, and speeds for a living sky that rewards idle watching+- **Holographic billboards**: Floating neon-framed displays positioned around the downtown perimeter showing rotating real-time system data — online/total counts, uptime percentage, CoS engine status, today's completed tasks, and active work streak. Messages cycle every 6 seconds with gentle bobbing animation+- **Enhanced HUD vitals panel**: New "VITALS" section below the clock showing session uptime, weather status (derived from system health ratio: CLEAR/FAIR/OVERCAST/RAIN/STORM), active agent count, stopped/archived counts, today's task completions, and work streak — all updating in real-time with color-coded status indicators+- **Productivity data integration**: CyberCity now fetches CoS quick-summary data (refreshed every 60s) and flows it through to billboards and HUD, making the city a live operational dashboard++**Client changes**:+- `client/src/components/city/CityWeather.jsx` — GPU shader rain particles with health-reactive intensity + lightning flash system+- `client/src/components/city/CityShootingStars.jsx` — Staggered shooting star spawner with glowing head meshes and shader trail lines+- `client/src/components/city/CityBillboards.jsx` — Floating holographic billboards with neon frames, cycling messages, and support poles+- `client/src/components/city/CityHud.jsx` — Added VITALS panel with uptime, weather, agents, stopped, archived, tasks, and streak stats+- `client/src/components/city/CityScene.jsx` — Integrated weather, billboards, and shooting stars into the 3D scene+- `client/src/pages/CyberCity.jsx` — Added productivity data fetching and prop threading to scene and HUD++### Digital Twin — Genome Section+- **Genome tab**: New "Genome" tab on the Digital Twin page for uploading and analyzing 23andMe raw genome data+- **File upload**: Drag-and-drop or file picker for 23andMe TSV exports (~600K SNPs), parsed and indexed locally with 1-hour in-memory cache for O(1) rsid lookups+- **15 curated health markers**: Pre-built database covering longevity (FOXO3A, IGF1R, CETP, IPMK), tumor suppression (TP53), iron metabolism (HFE H63D, C282Y), methylation (MTHFR C677T/A1298C, COMT, AHCY), caffeine sensitivity (ADA), detoxification (CYP2B6, SOD2), and inflammation (IL-6)+- **Genotype classification**: Each marker's genotype is automatically classified as beneficial, typical, concern, or major_concern with evidence-based implications+- **Category-grouped display**: Markers displayed in collapsible cards grouped by health category with color-coded status badges, expandable details, implications, and editable personal notes+- **SNP search**: Look up any rsid in your genome data with instant results and optional save-to-markers+- **Full CRUD**: Save custom markers, edit notes (with debounced auto-save), delete individual markers, or wipe all genome data with confirmation+- **Privacy-first**: All data stored locally on the server — genome file never leaves the machine++**Server changes**:+- `server/lib/curatedGenomeMarkers.js` — Curated SNP database with 15 markers, category config, `classifyGenotype()` and `formatGenotype()` functions+- `server/lib/genomeValidation.js` — Zod schemas for upload, search, save, and notes update+- `server/services/genome.js` — Core service with lazy-loaded in-memory Map index, upload/scan/search/CRUD/delete operations+- `server/routes/genome.js` — 8 REST endpoints mounted at `/api/digital-twin/genome`++**Client changes**:+- `client/src/components/digital-twin/tabs/GenomeTab.jsx` — Main tab with upload drop-zone, stats bar, curated markers view, SNP search, and delete confirmation+- `client/src/components/digital-twin/GenomeCategoryCard.jsx` — Reusable collapsible card for marker category groups with status summary+- `client/src/components/digital-twin/constants.js` — Added Genome tab with Dna icon+- `client/src/services/api.js` — Added 8 genome API functions+## Fixes### Codex CLI Provider — Wrong Argument Conventiondiff --git a/client/src/components/city/CityBillboards.jsx b/client/src/components/city/CityBillboards.jsxnew file mode 100644index 0000000000..c6aa74a976--- /dev/null+++ b/client/src/components/city/CityBillboards.jsx@@ -0,0 +1,237 @@+import { useRef, useMemo } from 'react';+import { useFrame } from '@react-three/fiber';+import { Text } from '@react-three/drei';+import * as THREE from 'three';+import { CITY_COLORS, PIXEL_FONT_URL } from './cityConstants';++// A single floating holographic billboard that cycles through messages+function Billboard({ position, rotation, messages, color, width = 3.5, height = 1.8, speed = 0.08 }) {+ const groupRef = useRef();+ const borderRef = useRef();+ const textRef = useRef();+ const stateRef = useRef({ index: 0, lastSwitch: 0 });++ const displayText = useRef(messages[0]?.text || '');+ const displayLabel = useRef(messages[0]?.label || '');++ useFrame(({ clock }) => {+ if (!groupRef.current) return;+ const t = clock.getElapsedTime();++ // Gentle bob+ groupRef.current.position.y = position[1] + Math.sin(t * 0.5 + position[0]) * 0.15;++ // Border pulse+ if (borderRef.current) {+ borderRef.current.material.opacity = 0.15 + Math.sin(t * 1.5) * 0.08;+ }++ // Cycle through messages every ~6 seconds+ const state = stateRef.current;+ if (t - state.lastSwitch > 6) {+ state.index = (state.index + 1) % messages.length;+ state.lastSwitch = t;+ displayText.current = messages[state.index]?.text || '';+ displayLabel.current = messages[state.index]?.label || '';+ // Force text update via key change won't work here, so we update ref+ if (textRef.current) {+ textRef.current.text = displayText.current;+ }+ }+ });++ // Static frame geometry+ const borderGeom = useMemo(() => {+ const shape = new THREE.Shape();+ shape.moveTo(-width / 2, -height / 2);+ shape.lineTo(width / 2, -height / 2);+ shape.lineTo(width / 2, height / 2);+ shape.lineTo(-width / 2, height / 2);+ shape.lineTo(-width / 2, -height / 2);++ const hole = new THREE.Path();+ const inset = 0.08;+ hole.moveTo(-width / 2 + inset, -height / 2 + inset);+ hole.lineTo(width / 2 - inset, -height / 2 + inset);+ hole.lineTo(width / 2 - inset, height / 2 - inset);+ hole.lineTo(-width / 2 + inset, height / 2 - inset);+ hole.lineTo(-width / 2 + inset, -height / 2 + inset);+ shape.holes.push(hole);++ return new THREE.ShapeGeometry(shape);+ }, [width, height]);++ return (+ <group ref={groupRef} position={position} rotation={rotation}>+ {/* Billboard background panel */}+ <mesh>+ <planeGeometry args={[width, height]} />+ <meshBasicMaterial color="#020208" transparent opacity={0.7} side={THREE.DoubleSide} />+ </mesh>++ {/* Neon border frame */}+ <mesh ref={borderRef} geometry={borderGeom} position={[0, 0, 0.01]}>+ <meshBasicMaterial color={color} transparent opacity={0.2} side={THREE.DoubleSide} />+ </mesh>++ {/* Top label */}+ <Text+ position={[0, height / 2 - 0.28, 0.02]}+ fontSize={0.15}+ color={color}+ anchorX="center"+ anchorY="middle"+ font={PIXEL_FONT_URL}+ maxWidth={width - 0.4}+ >+ {displayLabel.current}+ </Text>++ {/* Main text - cycling content */}+ <Text+ ref={textRef}+ position={[0, -0.05, 0.02]}+ fontSize={0.22}+ color="#ffffff"+ anchorX="center"+ anchorY="middle"+ font={PIXEL_FONT_URL}+ maxWidth={width - 0.6}+ >+ {displayText.current}+ </Text>++ {/* Accent line under label */}+ <mesh position={[0, height / 2 - 0.45, 0.01]}>+ <planeGeometry args={[width - 0.4, 0.02]} />+ <meshBasicMaterial color={color} transparent opacity={0.4} />+ </mesh>++ {/* Support pole / projector beam */}+ <mesh position={[0, -height / 2 - 0.3, 0]}>+ <cylinderGeometry args={[0.02, 0.04, 0.6, 6]} />+ <meshBasicMaterial color={color} transparent opacity={0.2} />+ </mesh>+ </group>+ );+}++export default function CityBillboards({ positions, apps, cosStatus, productivityData }) {+ // Build billboard messages from real system data+ const billboardConfig = useMemo(() => {+ if (!positions || positions.size < 2) return [];++ const onlineApps = apps.filter(a => !a.archived && a.overallStatus === 'online');+ const stoppedApps = apps.filter(a => !a.archived && a.overallStatus === 'stopped');+ const totalActive = apps.filter(a => !a.archived).length;+ const colors = CITY_COLORS.neonAccents;++ // Find downtown bounding box for billboard placement+ const entries = [];+ positions.forEach((pos) => {+ if (pos.district === 'downtown') entries.push(pos);+ });+ if (entries.length < 2) return [];++ let minX = Infinity, maxX = -Infinity, minZ = Infinity, maxZ = -Infinity;+ entries.forEach(p => {+ minX = Math.min(minX, p.x);+ maxX = Math.max(maxX, p.x);+ minZ = Math.min(minZ, p.z);+ maxZ = Math.max(maxZ, p.z);+ });++ const uptime = totalActive > 0+ ? `${Math.round(onlineApps.length / totalActive * 100)}%`+ : '---';++ const systemMessages = [+ { label: 'SYSTEM STATUS', text: `${onlineApps.length} ONLINE / ${totalActive} TOTAL` },+ { label: 'UPTIME', text: uptime },+ { label: 'COS ENGINE', text: cosStatus?.running ? 'ACTIVE' : 'STANDBY' },+ ];++ if (stoppedApps.length > 0) {+ systemMessages.push({+ label: 'ATTENTION',+ text: `${stoppedApps.length} SYSTEM${stoppedApps.length > 1 ? 'S' : ''} STOPPED`,+ });+ }++ const activityMessages = [+ { label: 'CYBERCITY', text: 'DIGITAL INFRASTRUCTURE' },+ { label: 'PORTOS', text: 'PERSONAL OPERATING SYSTEM' },+ ];++ if (productivityData) {+ if (productivityData.todaySucceeded > 0) {+ activityMessages.push({+ label: 'TODAY',+ text: `${productivityData.todaySucceeded} TASKS COMPLETED`,+ });+ }+ if (productivityData.currentDailyStreak > 0) {+ activityMessages.push({+ label: 'STREAK',+ text: `${productivityData.currentDailyStreak} DAY${productivityData.currentDailyStreak > 1 ? 'S' : ''} ACTIVE`,+ });+ }+ }++ const billboards = [];+ const pad = 4;++ // Billboard 1 - Left side facing inward+ billboards.push({+ id: 'bb-left',+ position: [minX - pad, 6, (minZ + maxZ) / 2],+ rotation: [0, Math.PI / 2, 0],+ messages: systemMessages,+ color: colors[0],+ });++ // Billboard 2 - Right side facing inward+ billboards.push({+ id: 'bb-right',+ position: [maxX + pad, 7.5, (minZ + maxZ) / 2],+ rotation: [0, -Math.PI / 2, 0],+ messages: activityMessages,+ color: colors[1],+ });++ // Billboard 3 - Front facing into the city (only if enough buildings)+ if (entries.length >= 4) {+ const frontMessages = onlineApps.slice(0, 6).map(a => ({+ label: 'ONLINE',+ text: (a.name || '').toUpperCase(),+ }));+ if (frontMessages.length > 0) {+ billboards.push({+ id: 'bb-front',+ position: [(minX + maxX) / 2, 8.5, minZ - pad - 1],+ rotation: [0, 0, 0],+ messages: frontMessages.length > 1 ? frontMessages : [{ label: 'STATUS', text: 'ALL SYSTEMS NOMINAL' }],+ color: colors[5],+ });+ }+ }++ return billboards;+ }, [positions, apps, cosStatus, productivityData]);++ if (billboardConfig.length === 0) return null;++ return (+ <group>+ {billboardConfig.map(bb => (+ <Billboard+ key={bb.id}+ position={bb.position}+ rotation={bb.rotation}+ messages={bb.messages}+ color={bb.color}+ />+ ))}+ </group>+ );+}diff --git a/client/src/components/city/CityHud.jsx b/client/src/components/city/CityHud.jsxindex f1187b4222..92777c694c 100644--- a/client/src/components/city/CityHud.jsx+++ b/client/src/components/city/CityHud.jsx@@ -1,21 +1,53 @@-import { useState, useEffect } from 'react';+import { useState, useEffect, useMemo } from 'react';import CityActivityLog from './CityActivityLog';import CityAgentBar from './CityAgentBar';-export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, connected, apps }) {+// Format uptime from page load+const formatUptime = (seconds) => {+ const h = Math.floor(seconds / 3600);+ const m = Math.floor((seconds % 3600) / 60);+ const s = Math.floor(seconds % 60);+ if (h > 0) return `${h}h ${m}m`;+ if (m > 0) return `${m}m ${s}s`;+ return `${s}s`;+};++// Weather status text based on system health+const getWeatherStatus = (onlineRatio) => {+ if (onlineRatio >= 1.0) return { text: 'CLEAR', color: 'text-emerald-400' };+ if (onlineRatio >= 0.8) return { text: 'FAIR', color: 'text-cyan-400' };+ if (onlineRatio >= 0.5) return { text: 'OVERCAST', color: 'text-amber-400' };+ if (onlineRatio >= 0.2) return { text: 'RAIN', color: 'text-orange-400' };+ return { text: 'STORM', color: 'text-red-400' };+};++export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, connected, apps, productivityData }) {const [time, setTime] = useState(new Date());+ const [uptimeSeconds, setUptimeSeconds] = useState(0);useEffect(() => {- const interval = setInterval(() => setTime(new Date()), 1000);+ const interval = setInterval(() => {+ setTime(new Date());+ setUptimeSeconds(prev => prev + 1);+ }, 1000);return () => clearInterval(interval);}, []);const activeApps = apps.filter(a => !a.archived && a.overallStatus === 'online').length;+ const stoppedApps = apps.filter(a => !a.archived && a.overallStatus === 'stopped').length;const totalApps = apps.filter(a => !a.archived).length;+ const archivedApps = apps.filter(a => a.archived).length;++ const onlineRatio = totalApps > 0 ? activeApps / totalApps : 1;+ const weather = useMemo(() => getWeatherStatus(onlineRatio), [onlineRatio]);++ const activeAgentCount = (cosAgents || []).filter(a =>+ a.status === 'running' || a.state === 'coding' || a.state === 'thinking' || a.state === 'investigating'+ ).length;return (<div className="absolute inset-0 pointer-events-none overflow-hidden">- {/* Top-left: Clock + system status */}+ {/* Top-left: Clock + system status + vitals */}<div className="absolute top-3 left-3 pointer-events-auto"><div className="bg-black/70 backdrop-blur-sm border border-cyan-500/30 rounded-lg px-4 py-2.5"><div className="font-pixel text-cyan-400 text-lg tracking-wider">@@ -25,6 +57,67 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, con{activeApps}/{totalApps} SYSTEMS ONLINE</div></div>++ {/* System Vitals panel */}+ <div className="mt-2 bg-black/70 backdrop-blur-sm border border-cyan-500/20 rounded-lg px-3 py-2 space-y-1">+ <div className="font-pixel text-[9px] text-cyan-500/60 tracking-wider mb-1">VITALS</div>++ {/* Uptime */}+ <div className="flex items-center justify-between gap-4">+ <span className="font-pixel text-[9px] text-gray-500 tracking-wide">UPTIME</span>+ <span className="font-pixel text-[10px] text-cyan-400">{formatUptime(uptimeSeconds)}</span>+ </div>++ {/* Weather (system health) */}+ <div className="flex items-center justify-between gap-4">+ <span className="font-pixel text-[9px] text-gray-500 tracking-wide">WEATHER</span>+ <span className={`font-pixel text-[10px] ${weather.color}`}>{weather.text}</span>+ </div>++ {/* Active agents */}+ <div className="flex items-center justify-between gap-4">+ <span className="font-pixel text-[9px] text-gray-500 tracking-wide">AGENTS</span>+ <span className={`font-pixel text-[10px] ${activeAgentCount > 0 ? 'text-emerald-400' : 'text-gray-600'}`}>+ {activeAgentCount} ACTIVE+ </span>+ </div>++ {/* Stopped count */}+ {stoppedApps > 0 && (+ <div className="flex items-center justify-between gap-4">+ <span className="font-pixel text-[9px] text-gray-500 tracking-wide">STOPPED</span>+ <span className="font-pixel text-[10px] text-amber-400">{stoppedApps}</span>+ </div>+ )}++ {/* Archived */}+ {archivedApps > 0 && (+ <div className="flex items-center justify-between gap-4">+ <span className="font-pixel text-[9px] text-gray-500 tracking-wide">ARCHIVED</span>+ <span className="font-pixel text-[10px] text-gray-600">{archivedApps}</span>+ </div>+ )}++ {/* Productivity - today's tasks */}+ {productivityData?.todaySucceeded > 0 && (+ <div className="flex items-center justify-between gap-4">+ <span className="font-pixel text-[9px] text-gray-500 tracking-wide">TASKS</span>+ <span className="font-pixel text-[10px] text-purple-400">+ {productivityData.todaySucceeded} TODAY+ </span>+ </div>+ )}++ {/* Streak */}+ {productivityData?.currentDailyStreak > 0 && (+ <div className="flex items-center justify-between gap-4">+ <span className="font-pixel text-[9px] text-gray-500 tracking-wide">STREAK</span>+ <span className={`font-pixel text-[10px] ${productivityData.currentDailyStreak >= 3 ? 'text-orange-400' : 'text-gray-400'}`}>+ {productivityData.currentDailyStreak}d+ </span>+ </div>+ )}+ </div></div>{/* Top-center: CyberCity title */}diff --git a/client/src/components/city/CityScene.jsx b/client/src/components/city/CityScene.jsxindex c589d2f5c1..1d7fde3ebe 100644--- a/client/src/components/city/CityScene.jsx+++ b/client/src/components/city/CityScene.jsx@@ -10,14 +10,20 @@ import BuildingCluster from './BuildingCluster';import CityDataStreams from './CityDataStreams';import CityTraffic from './CityTraffic';import CityRoads from './CityRoads';+import CityWeather from './CityWeather';+import CityBillboards from './CityBillboards';+import CityShootingStars from './CityShootingStars';-export default function CityScene({ apps, agentMap, onBuildingClick }) {+export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus, productivityData }) {const [positions, setPositions] = useState(null);const handlePositionsReady = useCallback((pos) => {setPositions(pos);}, []);+ const stoppedCount = apps.filter(a => !a.archived && a.overallStatus !== 'online').length;+ const totalCount = apps.filter(a => !a.archived).length;+return (<Canvascamera={{ position: [0, 18, 30], fov: 50 }}@@ -28,6 +34,7 @@ export default function CityScene({ apps, agentMap, onBuildingClick }) {><CityLights /><CityStarfield />+ <CityShootingStars /><CityCelestial /><CityGround /><CityRoads positions={positions} />@@ -39,6 +46,13 @@ export default function CityScene({ apps, agentMap, onBuildingClick }) {/><CityDataStreams positions={positions} /><CityTraffic positions={positions} />+ <CityBillboards+ positions={positions}+ apps={apps}+ cosStatus={cosStatus}+ productivityData={productivityData}+ />+ <CityWeather stoppedCount={stoppedCount} totalCount={totalCount} /><CityParticles /><OrbitControlsmaxPolarAngle={Math.PI / 2.2}diff --git a/client/src/components/city/CityShootingStars.jsx b/client/src/components/city/CityShootingStars.jsxnew file mode 100644index 0000000000..0622b5de5e--- /dev/null+++ b/client/src/components/city/CityShootingStars.jsx@@ -0,0 +1,196 @@+import { useRef, useMemo } from 'react';+import { useFrame } from '@react-three/fiber';+import * as THREE from 'three';++// Vertex shader for shooting star trail+const TRAIL_VERT = `+ attribute float trailPosition;+ varying float vTrailPos;+ void main() {+ vTrailPos = trailPosition;+ vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);+ gl_Position = projectionMatrix * mvPosition;+ }+`;++const TRAIL_FRAG = `+ varying float vTrailPos;+ uniform vec3 uColor;+ uniform float uOpacity;+ void main() {+ // Fade trail from bright head to transparent tail+ float alpha = smoothstep(0.0, 0.3, vTrailPos) * (1.0 - vTrailPos) * uOpacity;+ gl_FragColor = vec4(uColor, alpha * 0.8);+ }+`;++// A single shooting star with glowing head and fading trail+function ShootingStar({ index }) {+ const groupRef = useRef();+ const headRef = useRef();+ const trailRef = useRef();+ const matRef = useRef();++ const state = useRef({+ active: false,+ nextSpawn: 3 + index * 5 + Math.random() * 10,+ progress: 0,+ speed: 0,+ startPos: [0, 0, 0],+ direction: [0, 0, 0],+ color: [1, 1, 1],+ length: 8,+ });++ const trailPoints = useMemo(() => {+ const segments = 20;+ const positions = new Float32Array(segments * 3);+ const trailPos = new Float32Array(segments);+ for (let i = 0; i < segments; i++) {+ trailPos[i] = i / (segments - 1); // 0 = head, 1 = tail+ }+ return { positions, trailPos, segments };+ }, []);++ const colors = useMemo(() => [+ [1.0, 1.0, 1.0], // white+ [0.6, 0.8, 1.0], // blue-white+ [1.0, 0.7, 0.3], // golden+ [0.4, 1.0, 0.9], // cyan+ ], []);++ useFrame(({ clock }) => {+ const t = clock.getElapsedTime();+ const s = state.current;++ if (!s.active) {+ if (t > s.nextSpawn) {+ // Spawn a new shooting star+ s.active = true;+ s.progress = 0;+ s.speed = 0.6 + Math.random() * 0.8;+ s.length = 6 + Math.random() * 6;++ // Random start position in upper sky hemisphere+ const theta = Math.random() * Math.PI * 2;+ const phi = Math.random() * 0.4; // Near top+ const r = 55 + Math.random() * 20;+ s.startPos = [+ r * Math.sin(phi) * Math.cos(theta),+ r * Math.cos(phi) + 10,+ r * Math.sin(phi) * Math.sin(theta),+ ];++ // Direction: downward and across+ const dx = (Math.random() - 0.5) * 2;+ const dy = -0.5 - Math.random() * 0.5;+ const dz = (Math.random() - 0.5) * 2;+ const len = Math.sqrt(dx * dx + dy * dy + dz * dz);+ s.direction = [dx / len, dy / len, dz / len];++ s.color = colors[Math.floor(Math.random() * colors.length)];+ }+ if (headRef.current) headRef.current.visible = false;+ if (trailRef.current) trailRef.current.visible = false;+ return;+ }++ // Advance the star+ s.progress += s.speed * 0.016; // ~60fps delta++ if (s.progress > 1.5) {+ // Star has crossed the sky+ s.active = false;+ s.nextSpawn = t + 5 + Math.random() * 15;+ return;+ }++ // Current head position+ const totalDist = s.length * 8;+ const headX = s.startPos[0] + s.direction[0] * totalDist * s.progress;+ const headY = s.startPos[1] + s.direction[1] * totalDist * s.progress;+ const headZ = s.startPos[2] + s.direction[2] * totalDist * s.progress;++ // Update head glow+ if (headRef.current) {+ headRef.current.visible = true;+ headRef.current.position.set(headX, headY, headZ);+ headRef.current.material.opacity = Math.min(1, (1 - s.progress) * 2);+ }++ // Update trail geometry+ if (trailRef.current) {+ trailRef.current.visible = true;+ const posAttr = trailRef.current.geometry.attributes.position;+ for (let i = 0; i < trailPoints.segments; i++) {+ const tp = (i / (trailPoints.segments - 1)) * s.length;+ posAttr.array[i * 3] = headX - s.direction[0] * tp;+ posAttr.array[i * 3 + 1] = headY - s.direction[1] * tp;+ posAttr.array[i * 3 + 2] = headZ - s.direction[2] * tp;+ }+ posAttr.needsUpdate = true;+ }++ if (matRef.current) {+ matRef.current.uniforms.uColor.value.set(s.color[0], s.color[1], s.color[2]);+ matRef.current.uniforms.uOpacity.value = Math.min(1, (1 - s.progress) * 2.5);+ }+ });++ return (+ <group ref={groupRef}>+ {/* Glowing head */}+ <mesh ref={headRef} visible={false}>+ <sphereGeometry args={[0.15, 8, 8]} />+ <meshBasicMaterial+ color="#ffffff"+ transparent+ opacity={1}+ blending={THREE.AdditiveBlending}+ depthWrite={false}+ />+ </mesh>++ {/* Trail line */}+ <line ref={trailRef} visible={false}>+ <bufferGeometry>+ <bufferAttribute+ attach="attributes-position"+ count={trailPoints.segments}+ array={trailPoints.positions}+ itemSize={3}+ />+ <bufferAttribute+ attach="attributes-trailPosition"+ count={trailPoints.segments}+ array={trailPoints.trailPos}+ itemSize={1}+ />+ </bufferGeometry>+ <shaderMaterial+ ref={matRef}+ vertexShader={TRAIL_VERT}+ fragmentShader={TRAIL_FRAG}+ uniforms={{+ uColor: { value: new THREE.Color(1, 1, 1) },+ uOpacity: { value: 1.0 },+ }}+ transparent+ blending={THREE.AdditiveBlending}+ depthWrite={false}+ />+ </line>+ </group>+ );+}++export default function CityShootingStars() {+ return (+ <group>+ {/* 3 potential shooting stars, staggered spawn times */}+ <ShootingStar index={0} />+ <ShootingStar index={1} />+ <ShootingStar index={2} />+ </group>+ );+}diff --git a/client/src/components/city/CityWeather.jsx b/client/src/components/city/CityWeather.jsxnew file mode 100644index 0000000000..8360ced18a--- /dev/null+++ b/client/src/components/city/CityWeather.jsx@@ -0,0 +1,138 @@+import { useRef, useMemo } from 'react';+import { useFrame } from '@react-three/fiber';+import * as THREE from 'three';++// Rain particle shader - elongated drops falling downward+const RAIN_VERT = `+ attribute float speed;+ attribute float offset;+ uniform float uTime;+ varying float vAlpha;+ void main() {+ vec3 pos = position;+ // Animate downward, looping+ float t = mod(uTime * speed + offset, 1.0);+ pos.y = mix(25.0, -2.0, t);+ vAlpha = smoothstep(0.0, 0.1, t) * smoothstep(1.0, 0.8, t);+ vec4 mvPosition = modelViewMatrix * vec4(pos, 1.0);+ // Elongated point to simulate a rain streak+ gl_PointSize = 2.5 * (150.0 / -mvPosition.z);+ gl_Position = projectionMatrix * mvPosition;+ }+`;++const RAIN_FRAG = `+ varying float vAlpha;+ void main() {+ // Elongated vertical drop shape+ vec2 uv = gl_PointCoord - vec2(0.5);+ float d = length(vec2(uv.x * 3.0, uv.y));+ if (d > 0.5) discard;+ float alpha = smoothstep(0.5, 0.1, d) * vAlpha * 0.4;+ gl_FragColor = vec4(0.4, 0.7, 1.0, alpha);+ }+`;++// Lightning flash - brief bright flash across the scene+function LightningFlash({ active }) {+ const lightRef = useRef();+ const flashState = useRef({ nextFlash: 0, intensity: 0, flickerCount: 0 });++ useFrame(({ clock }) => {+ if (!lightRef.current || !active) {+ if (lightRef.current) lightRef.current.intensity = 0;+ return;+ }+ const t = clock.getElapsedTime();+ const state = flashState.current;++ if (t > state.nextFlash && state.intensity === 0) {+ // Trigger new flash (every 8-20 seconds when active)+ state.intensity = 2.0 + Math.random() * 3.0;+ state.flickerCount = 2 + Math.floor(Math.random() * 3);+ state.nextFlash = t + 8 + Math.random() * 12;+ }++ if (state.intensity > 0) {+ // Rapid decay with flicker+ state.intensity *= 0.85;+ if (state.flickerCount > 0 && state.intensity < 0.5) {+ state.intensity = 1.5 + Math.random() * 2;+ state.flickerCount--;+ }+ if (state.intensity < 0.05) state.intensity = 0;+ }++ lightRef.current.intensity = state.intensity;+ });++ return (+ <pointLight+ ref={lightRef}+ position={[Math.random() * 40 - 20, 30, Math.random() * 40 - 20]}+ color="#b4d4ff"+ intensity={0}+ distance={100}+ decay={1.5}+ />+ );+}++export default function CityWeather({ stoppedCount = 0, totalCount = 1 }) {+ const pointsRef = useRef();+ const matRef = useRef();++ // Weather intensity based on system health (more stopped = more rain)+ const healthRatio = totalCount > 0 ? stoppedCount / totalCount : 0;+ const rainIntensity = healthRatio; // 0 = clear, 1 = heavy rain+ const showLightning = healthRatio > 0.3;++ const rainCount = Math.floor(rainIntensity * 400);++ const { positions, speeds, offsets } = useMemo(() => {+ const count = 400; // Max particles, we'll show a subset based on intensity+ const pos = new Float32Array(count * 3);+ const spd = new Float32Array(count);+ const off = new Float32Array(count);++ for (let i = 0; i < count; i++) {+ pos[i * 3] = (Math.random() - 0.5) * 60;+ pos[i * 3 + 1] = Math.random() * 25;+ pos[i * 3 + 2] = (Math.random() - 0.5) * 60;+ spd[i] = 0.3 + Math.random() * 0.5;+ off[i] = Math.random();+ }++ return { positions: pos, speeds: spd, offsets: off };+ }, []);++ useFrame(({ clock }) => {+ if (matRef.current) {+ matRef.current.uniforms.uTime.value = clock.getElapsedTime();+ }+ });++ if (rainCount < 5) return null;++ return (+ <group>+ <points ref={pointsRef}>+ <bufferGeometry drawRange={{ start: 0, count: rainCount }}>+ <bufferAttribute attach="attributes-position" count={positions.length / 3} array={positions} itemSize={3} />+ <bufferAttribute attach="attributes-speed" count={speeds.length} array={speeds} itemSize={1} />+ <bufferAttribute attach="attributes-offset" count={offsets.length} array={offsets} itemSize={1} />+ </bufferGeometry>+ <shaderMaterial+ ref={matRef}+ vertexShader={RAIN_VERT}+ fragmentShader={RAIN_FRAG}+ uniforms={{ uTime: { value: 0 } }}+ transparent+ blending={THREE.AdditiveBlending}+ depthWrite={false}+ />+ </points>+ {showLightning && <LightningFlash active={showLightning} />}+ </group>+ );+}diff --git a/client/src/pages/CyberCity.jsx b/client/src/pages/CyberCity.jsxindex 66c064f0e3..6f1e2f95c3 100644--- a/client/src/pages/CyberCity.jsx+++ b/client/src/pages/CyberCity.jsx@@ -1,6 +1,7 @@-import { useCallback } from 'react';+import { useCallback, useState, useEffect } from 'react';import { useNavigate } from 'react-router-dom';import { useCityData } from '../hooks/useCityData';+import * as api from '../services/api';import CityScene from '../components/city/CityScene';import CityHud from '../components/city/CityHud';import CityScanlines from '../components/city/CityScanlines';@@ -8,6 +9,18 @@ import CityScanlines from '../components/city/CityScanlines';export default function CyberCity() {const { apps, cosAgents, cosStatus, eventLogs, agentMap, loading, connected } = useCityData();const navigate = useNavigate();+ const [productivityData, setProductivityData] = useState(null);++ // Fetch productivity data for HUD vitals and billboards+ useEffect(() => {+ const fetchProductivity = async () => {+ const data = await api.getCosQuickSummary().catch(() => null);+ setProductivityData(data);+ };+ fetchProductivity();+ const interval = setInterval(fetchProductivity, 60000);+ return () => clearInterval(interval);+ }, []);const handleBuildingClick = useCallback((app) => {navigate('/apps');@@ -29,6 +42,8 @@ export default function CyberCity() {apps={apps}agentMap={agentMap}onBuildingClick={handleBuildingClick}+ cosStatus={cosStatus}+ productivityData={productivityData}/><CityHudcosStatus={cosStatus}@@ -37,6 +52,7 @@ export default function CyberCity() {eventLogs={eventLogs}connected={connected}apps={apps}+ productivityData={productivityData}/><CityScanlines /></div>