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 dynamic city life — data streams, traffic, roads, CRT overlay
Adam Eivyd5ddbf17a4b9
diff --git a/.changelog/v0.12.x.md b/.changelog/v0.12.x.mdindex 5999b53c2a..3a28e9939a 100644--- a/.changelog/v0.12.x.md+++ b/.changelog/v0.12.x.md@@ -179,6 +179,22 @@ This release adds branch management and automated release workflow capabilities- `client/src/App.jsx` — Added lazy-loaded `/city` route- `client/src/components/Layout.jsx` — Added CyberCity nav item and full-bleed layout support+### CyberCity — Dynamic City Life Enhancements+- **Animated data streams**: Glowing data packets fly between connected downtown buildings as light trails, visualizing network connectivity between apps — packets travel both directions at varying speeds with sine-arc trajectories and faint connection lines+- **Hover traffic**: Flying hover vehicles cruise around the city at multiple altitudes — perimeter patrol cars circle the downtown district while cross-city lanes slice through at higher elevations, each with engine glow, tail lights, and tilting turns+- **Neon road grid**: Animated road network with dark tarmac strips, glowing edge lines, and traveling light pulses laid out between building rows and columns — distinct neon accent colors per road segment+- **CRT scanline overlay**: Subtle retro-futuristic CRT effect layered over the entire view — horizontal scanlines, radial vignette darkening at edges, and faint chromatic aberration glow for maximum cyberpunk atmosphere+- **Building click navigation**: Clicking any building in the 3D city navigates to the Apps page for quick management access++**Client changes**:+- `client/src/components/city/CityDataStreams.jsx` — Animated data packet trails between connected buildings+- `client/src/components/city/CityTraffic.jsx` — Flying hover vehicles with perimeter and cross-city flight paths+- `client/src/components/city/CityRoads.jsx` — Neon-lit road grid with animated light pulses+- `client/src/components/city/CityScanlines.jsx` — CSS-based CRT scanline, vignette, and chromatic aberration overlay+- `client/src/components/city/CityScene.jsx` — Integrated new scene layers with position data flow+- `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+## Fixes### Managed App Port Conflict — ENV Leak & Detectiondiff --git a/client/src/components/city/BuildingCluster.jsx b/client/src/components/city/BuildingCluster.jsxindex d5bde104fe..3040f3cdae 100644--- a/client/src/components/city/BuildingCluster.jsx+++ b/client/src/components/city/BuildingCluster.jsx@@ -1,13 +1,18 @@-import { useMemo } from 'react';+import { useMemo, useEffect } from 'react';import { Text } from '@react-three/drei';import { computeCityLayout } from './cityLayout';import { getBuildingHeight, DISTRICT_PARAMS, PIXEL_FONT_URL } from './cityConstants';import Building from './Building';import AgentEntity from './AgentEntity';-export default function BuildingCluster({ apps, agentMap, onBuildingClick }) {+export default function BuildingCluster({ apps, agentMap, onBuildingClick, onPositionsReady }) {const positions = useMemo(() => computeCityLayout(apps), [apps]);+ // Notify parent when positions change (for data streams, roads, traffic)+ useEffect(() => {+ onPositionsReady?.(positions);+ }, [positions, onPositionsReady]);+const hasArchived = apps.some(a => a.archived);const warehouseMinZ = useMemo(() => {diff --git a/client/src/components/city/CityDataStreams.jsx b/client/src/components/city/CityDataStreams.jsxnew file mode 100644index 0000000000..f542e5e075--- /dev/null+++ b/client/src/components/city/CityDataStreams.jsx@@ -0,0 +1,130 @@+import { useRef, useMemo } from 'react';+import { useFrame } from '@react-three/fiber';+import * as THREE from 'three';+import { CITY_COLORS } from './cityConstants';++// A single animated data packet traveling along a path+function DataPacket({ start, end, color, speed, offset, size = 0.08 }) {+ const meshRef = useRef();+ const trailRef = useRef();++ const direction = useMemo(() => {+ const dir = new THREE.Vector3(end[0] - start[0], end[1] - start[1], end[2] - start[2]);+ return dir;+ }, [start, end]);++ const trailGeom = useMemo(() => {+ const curve = new THREE.LineCurve3(+ new THREE.Vector3(start[0], start[1], start[2]),+ new THREE.Vector3(end[0], end[1], end[2])+ );+ return new THREE.BufferGeometry().setFromPoints(curve.getPoints(20));+ }, [start, end]);++ useFrame(({ clock }) => {+ if (!meshRef.current) return;+ const t = ((clock.getElapsedTime() * speed + offset) % 1.0);++ meshRef.current.position.set(+ start[0] + direction.x * t,+ start[1] + direction.y * t + Math.sin(t * Math.PI) * 0.5,+ start[2] + direction.z * t+ );++ // Pulse the packet+ const pulse = 0.6 + Math.sin(clock.getElapsedTime() * 8) * 0.4;+ meshRef.current.material.opacity = pulse * (t > 0.05 && t < 0.95 ? 1 : 0);++ // Trail opacity pulse+ if (trailRef.current) {+ trailRef.current.material.opacity = 0.08 + Math.sin(clock.getElapsedTime() * 2 + offset) * 0.04;+ }+ });++ return (+ <>+ {/* Faint connection line */}+ <line geometry={trailGeom} ref={trailRef}>+ <lineBasicMaterial color={color} transparent opacity={0.08} />+ </line>+ {/* Flying data packet */}+ <mesh ref={meshRef}>+ <sphereGeometry args={[size, 6, 6]} />+ <meshBasicMaterial color={color} transparent opacity={0.8} />+ </mesh>+ </>+ );+}++export default function CityDataStreams({ positions }) {+ // Build connections between nearby active buildings+ const connections = useMemo(() => {+ if (!positions || positions.size < 2) return [];++ const entries = [];+ positions.forEach((pos, id) => {+ if (pos.district === 'downtown') entries.push({ id, ...pos });+ });++ const conns = [];+ const colors = CITY_COLORS.neonAccents;++ // Connect each building to its nearest 1-2 neighbors+ for (let i = 0; i < entries.length; i++) {+ const a = entries[i];+ const distances = [];++ for (let j = 0; j < entries.length; j++) {+ if (i === j) continue;+ const b = entries[j];+ const dist = Math.sqrt((a.x - b.x) ** 2 + (a.z - b.z) ** 2);+ distances.push({ index: j, dist });+ }++ distances.sort((d1, d2) => d1.dist - d2.dist);+ const neighborCount = Math.min(1, distances.length);++ for (let n = 0; n < neighborCount; n++) {+ const b = entries[distances[n].index];+ // Avoid duplicate connections+ const key = [a.id, b.id].sort().join('-');+ if (!conns.find(c => c.key === key)) {+ conns.push({+ key,+ start: [a.x, 0.5, a.z],+ end: [b.x, 0.5, b.z],+ color: colors[(i + n) % colors.length],+ });+ }+ }+ }++ return conns;+ }, [positions]);++ if (connections.length === 0) return null;++ return (+ <group>+ {connections.map((conn) => (+ <group key={conn.key}>+ {/* Two packets going each direction at different speeds */}+ <DataPacket+ start={conn.start}+ end={conn.end}+ color={conn.color}+ speed={0.15 + Math.random() * 0.1}+ offset={0}+ />+ <DataPacket+ start={conn.end}+ end={conn.start}+ color={conn.color}+ speed={0.12 + Math.random() * 0.1}+ offset={0.5}+ />+ </group>+ ))}+ </group>+ );+}diff --git a/client/src/components/city/CityRoads.jsx b/client/src/components/city/CityRoads.jsxnew file mode 100644index 0000000000..2656957cc2--- /dev/null+++ b/client/src/components/city/CityRoads.jsx@@ -0,0 +1,138 @@+import { useRef, useMemo } from 'react';+import { useFrame } from '@react-three/fiber';+import * as THREE from 'three';+import { CITY_COLORS, BUILDING_PARAMS } from './cityConstants';++// Animated road with flowing light pulses+function RoadSegment({ start, end, color, offset = 0 }) {+ const lineRef = useRef();+ const pulseRef = useRef();++ const length = useMemo(() => {+ return Math.sqrt((end[0] - start[0]) ** 2 + (end[2] - start[2]) ** 2);+ }, [start, end]);++ const midX = (start[0] + end[0]) / 2;+ const midZ = (start[2] + end[2]) / 2;+ const angle = Math.atan2(end[2] - start[2], end[0] - start[0]);++ useFrame(({ clock }) => {+ if (!pulseRef.current) return;+ const t = ((clock.getElapsedTime() * 0.3 + offset) % 1.0);++ // Animate pulse position along the road+ pulseRef.current.position.set(+ start[0] + (end[0] - start[0]) * t,+ 0.03,+ start[2] + (end[2] - start[2]) * t+ );++ pulseRef.current.material.opacity = 0.3 + Math.sin(t * Math.PI) * 0.4;+ });++ return (+ <group>+ {/* Road surface - dark strip */}+ <mesh+ position={[midX, 0.005, midZ]}+ rotation={[-Math.PI / 2, 0, angle]}+ >+ <planeGeometry args={[length, 0.3]} />+ <meshBasicMaterial color="#0a0a1a" transparent opacity={0.6} side={THREE.DoubleSide} />+ </mesh>++ {/* Road edge lines */}+ <mesh+ position={[midX, 0.01, midZ + Math.cos(angle) * 0.15]}+ rotation={[-Math.PI / 2, 0, angle]}+ >+ <planeGeometry args={[length, 0.02]} />+ <meshBasicMaterial color={color} transparent opacity={0.3} side={THREE.DoubleSide} />+ </mesh>+ <mesh+ position={[midX, 0.01, midZ - Math.cos(angle) * 0.15]}+ rotation={[-Math.PI / 2, 0, angle]}+ >+ <planeGeometry args={[length, 0.02]} />+ <meshBasicMaterial color={color} transparent opacity={0.3} side={THREE.DoubleSide} />+ </mesh>++ {/* Animated light pulse traveling along road */}+ <mesh ref={pulseRef} rotation={[-Math.PI / 2, 0, angle]}>+ <circleGeometry args={[0.12, 8]} />+ <meshBasicMaterial color={color} transparent opacity={0.5} side={THREE.DoubleSide} />+ </mesh>+ </group>+ );+}++export default function CityRoads({ positions }) {+ const roads = useMemo(() => {+ if (!positions || positions.size < 2) return [];++ const entries = [];+ positions.forEach((pos) => {+ if (pos.district === 'downtown') entries.push(pos);+ });++ if (entries.length < 2) return [];++ const result = [];+ const spacing = BUILDING_PARAMS.spacing;+ const roadOffset = BUILDING_PARAMS.width / 2 + 0.5;++ // Find unique rows and columns+ const rows = [...new Set(entries.map(e => Math.round(e.z * 10) / 10))].sort((a, b) => a - b);+ const cols = [...new Set(entries.map(e => Math.round(e.x * 10) / 10))].sort((a, b) => a - b);++ 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 pad = spacing / 2 + 0.5;++ // Horizontal roads between rows+ rows.forEach((z, i) => {+ result.push({+ id: `h-${i}`,+ start: [minX - pad, 0, z + roadOffset],+ end: [maxX + pad, 0, z + roadOffset],+ color: CITY_COLORS.neonAccents[i % CITY_COLORS.neonAccents.length],+ offset: i * 0.3,+ });+ });++ // Vertical roads between columns+ cols.forEach((x, i) => {+ result.push({+ id: `v-${i}`,+ start: [x + roadOffset, 0, minZ - pad],+ end: [x + roadOffset, 0, maxZ + pad],+ color: CITY_COLORS.neonAccents[(i + 3) % CITY_COLORS.neonAccents.length],+ offset: i * 0.25,+ });+ });++ return result;+ }, [positions]);++ if (roads.length === 0) return null;++ return (+ <group>+ {roads.map(road => (+ <RoadSegment+ key={road.id}+ start={road.start}+ end={road.end}+ color={road.color}+ offset={road.offset}+ />+ ))}+ </group>+ );+}diff --git a/client/src/components/city/CityScanlines.jsx b/client/src/components/city/CityScanlines.jsxnew file mode 100644index 0000000000..741e0e5138--- /dev/null+++ b/client/src/components/city/CityScanlines.jsx@@ -0,0 +1,50 @@+import { useRef, useEffect } from 'react';++// CSS-based CRT scanline + vignette overlay for cyberpunk atmosphere+export default function CityScanlines() {+ const canvasRef = useRef(null);++ useEffect(() => {+ const canvas = canvasRef.current;+ if (!canvas) return;+ const ctx = canvas.getContext('2d');+ canvas.width = 4;+ canvas.height = 4;++ // Draw a tiny 4x4 scanline pattern (repeating)+ ctx.clearRect(0, 0, 4, 4);+ ctx.fillStyle = 'rgba(0, 0, 0, 0.06)';+ ctx.fillRect(0, 0, 4, 1);+ ctx.fillRect(0, 2, 4, 1);+ }, []);++ return (+ <>+ {/* Scanline pattern (generated from hidden canvas) */}+ <canvas ref={canvasRef} className="hidden" />+ {/* Scanline overlay */}+ <div+ className="absolute inset-0 pointer-events-none z-10"+ style={{+ backgroundImage: 'repeating-linear-gradient(0deg, rgba(0,0,0,0.04) 0px, rgba(0,0,0,0.04) 1px, transparent 1px, transparent 3px)',+ backgroundSize: '100% 3px',+ mixBlendMode: 'multiply',+ }}+ />+ {/* Vignette effect */}+ <div+ className="absolute inset-0 pointer-events-none z-10"+ style={{+ background: 'radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.4) 100%)',+ }}+ />+ {/* Subtle chromatic aberration glow at edges */}+ <div+ className="absolute inset-0 pointer-events-none z-10 opacity-[0.015]"+ style={{+ boxShadow: 'inset 0 0 100px 20px rgba(6, 182, 212, 0.3), inset 0 0 60px 10px rgba(139, 92, 246, 0.2)',+ }}+ />+ </>+ );+}diff --git a/client/src/components/city/CityScene.jsx b/client/src/components/city/CityScene.jsxindex fb59c9029d..c589d2f5c1 100644--- a/client/src/components/city/CityScene.jsx+++ b/client/src/components/city/CityScene.jsx@@ -1,3 +1,4 @@+import { useState, useCallback } from 'react';import { Canvas } from '@react-three/fiber';import { OrbitControls } from '@react-three/drei';import CityGround from './CityGround';@@ -6,8 +7,17 @@ import CityParticles from './CityParticles';import CityStarfield from './CityStarfield';import CityCelestial from './CityCelestial';import BuildingCluster from './BuildingCluster';+import CityDataStreams from './CityDataStreams';+import CityTraffic from './CityTraffic';+import CityRoads from './CityRoads';export default function CityScene({ apps, agentMap, onBuildingClick }) {+ const [positions, setPositions] = useState(null);++ const handlePositionsReady = useCallback((pos) => {+ setPositions(pos);+ }, []);+return (<Canvascamera={{ position: [0, 18, 30], fov: 50 }}@@ -20,11 +30,15 @@ export default function CityScene({ apps, agentMap, onBuildingClick }) {<CityStarfield /><CityCelestial /><CityGround />+ <CityRoads positions={positions} /><BuildingClusterapps={apps}agentMap={agentMap}onBuildingClick={onBuildingClick}+ onPositionsReady={handlePositionsReady}/>+ <CityDataStreams positions={positions} />+ <CityTraffic positions={positions} /><CityParticles /><OrbitControlsmaxPolarAngle={Math.PI / 2.2}diff --git a/client/src/components/city/CityTraffic.jsx b/client/src/components/city/CityTraffic.jsxnew file mode 100644index 0000000000..68259c74ee--- /dev/null+++ b/client/src/components/city/CityTraffic.jsx@@ -0,0 +1,178 @@+import { useRef, useMemo } from 'react';+import { useFrame } from '@react-three/fiber';+import * as THREE from 'three';+import { CITY_COLORS } from './cityConstants';++// A single flying hover vehicle+function HoverVehicle({ path, color, speed, offset, altitude }) {+ const groupRef = useRef();+ const lightRef = useRef();+ const bodyRef = useRef();++ const pathLength = useMemo(() => {+ let len = 0;+ for (let i = 1; i < path.length; i++) {+ len += Math.sqrt(+ (path[i][0] - path[i-1][0]) ** 2 ++ (path[i][2] - path[i-1][2]) ** 2+ );+ }+ return len;+ }, [path]);++ useFrame(({ clock }) => {+ if (!groupRef.current || path.length < 2) return;+ const t = ((clock.getElapsedTime() * speed + offset) % 1.0);++ // Interpolate along path+ const totalT = t * (path.length - 1);+ const segIdx = Math.min(Math.floor(totalT), path.length - 2);+ const segT = totalT - segIdx;++ const ax = path[segIdx][0];+ const az = path[segIdx][2];+ const bx = path[segIdx + 1][0];+ const bz = path[segIdx + 1][2];++ const x = ax + (bx - ax) * segT;+ const z = az + (bz - az) * segT;+ const y = altitude + Math.sin(t * Math.PI * 2) * 0.15;++ groupRef.current.position.set(x, y, z);++ // Face direction of travel+ const angle = Math.atan2(bz - az, bx - ax);+ groupRef.current.rotation.y = -angle;++ // Tail light flicker+ if (lightRef.current) {+ lightRef.current.intensity = 0.3 + Math.sin(clock.getElapsedTime() * 12 + offset * 10) * 0.15;+ }++ // Subtle tilt into turns+ if (bodyRef.current) {+ const tilt = Math.sin(t * Math.PI * 4) * 0.1;+ bodyRef.current.rotation.z = tilt;+ }+ });++ return (+ <group ref={groupRef}>+ <group ref={bodyRef}>+ {/* Vehicle body - elongated box */}+ <mesh>+ <boxGeometry args={[0.4, 0.08, 0.15]} />+ <meshBasicMaterial color={color} transparent opacity={0.6} />+ </mesh>+ {/* Cockpit windshield */}+ <mesh position={[0.12, 0.05, 0]}>+ <boxGeometry args={[0.12, 0.04, 0.12]} />+ <meshBasicMaterial color="#ffffff" transparent opacity={0.3} />+ </mesh>+ {/* Engine glow at rear */}+ <mesh position={[-0.22, 0, 0]}>+ <sphereGeometry args={[0.04, 6, 6]} />+ <meshBasicMaterial color={color} transparent opacity={0.9} />+ </mesh>+ {/* Tail light */}+ <pointLight ref={lightRef} position={[-0.22, 0, 0]} color={color} intensity={0.3} distance={3} decay={2} />+ </group>+ </group>+ );+}++export default function CityTraffic({ positions }) {+ // Generate traffic lanes based on building layout+ const vehicles = useMemo(() => {+ if (!positions || positions.size < 2) return [];++ const entries = [];+ positions.forEach((pos) => {+ if (pos.district === 'downtown') entries.push(pos);+ });++ if (entries.length < 2) return [];++ // Find bounding box of downtown+ 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 pad = 3;+ const colors = CITY_COLORS.neonAccents;+ const result = [];++ // Create traffic lanes around the perimeter+ const perimeter = [+ [minX - pad, 0, minZ - pad],+ [maxX + pad, 0, minZ - pad],+ [maxX + pad, 0, maxZ + pad],+ [minX - pad, 0, maxZ + pad],+ [minX - pad, 0, minZ - pad],+ ];++ // Perimeter vehicles (3-5 hover cars circling the downtown)+ const vehicleCount = Math.min(5, Math.max(3, entries.length));+ for (let i = 0; i < vehicleCount; i++) {+ result.push({+ id: `perim-${i}`,+ path: perimeter,+ color: colors[i % colors.length],+ speed: 0.04 + i * 0.008,+ offset: i / vehicleCount,+ altitude: 1.5 + i * 0.6,+ });+ }++ // Cross-city lanes (a few vehicles going through the center)+ if (entries.length >= 3) {+ // Horizontal lane+ result.push({+ id: 'cross-h',+ path: [+ [minX - pad - 5, 0, 0],+ [maxX + pad + 5, 0, 0],+ ],+ color: colors[5 % colors.length],+ speed: 0.06,+ offset: 0.3,+ altitude: 3.0,+ });+ // Diagonal lane+ result.push({+ id: 'cross-d',+ path: [+ [minX - pad - 3, 0, maxZ + pad + 3],+ [maxX + pad + 3, 0, minZ - pad - 3],+ ],+ color: colors[6 % colors.length],+ speed: 0.05,+ offset: 0.7,+ altitude: 4.0,+ });+ }++ return result;+ }, [positions]);++ if (vehicles.length === 0) return null;++ return (+ <group>+ {vehicles.map(v => (+ <HoverVehicle+ key={v.id}+ path={v.path}+ color={v.color}+ speed={v.speed}+ offset={v.offset}+ altitude={v.altitude}+ />+ ))}+ </group>+ );+}diff --git a/client/src/pages/CyberCity.jsx b/client/src/pages/CyberCity.jsxindex 6025985330..66c064f0e3 100644--- a/client/src/pages/CyberCity.jsx+++ b/client/src/pages/CyberCity.jsx@@ -1,9 +1,17 @@+import { useCallback } from 'react';+import { useNavigate } from 'react-router-dom';import { useCityData } from '../hooks/useCityData';import CityScene from '../components/city/CityScene';import CityHud from '../components/city/CityHud';+import CityScanlines from '../components/city/CityScanlines';export default function CyberCity() {const { apps, cosAgents, cosStatus, eventLogs, agentMap, loading, connected } = useCityData();+ const navigate = useNavigate();++ const handleBuildingClick = useCallback((app) => {+ navigate('/apps');+ }, [navigate]);if (loading) {return (@@ -20,7 +28,7 @@ export default function CyberCity() {<CitySceneapps={apps}agentMap={agentMap}- onBuildingClick={null}+ onBuildingClick={handleBuildingClick}/><CityHudcosStatus={cosStatus}@@ -30,6 +38,7 @@ export default function CyberCity() {connected={connected}apps={apps}/>+ <CityScanlines /></div>);}