Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix City daytime white-out and WebGL context-loss white screen
[._.]/ Adam Eivyc20458aea992
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex a6658cf8b4..7bfa6efb24 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -25,4 +25,6 @@## Fixed+- **City daytime sky no longer washes out to white; night reads as a galaxy backdrop** — The bright-day sky and pavement were tuned so light, so the dome and ground turned into a near-white fog sheet over the city; daytime now keeps real blue in the horizon bands and a muted blue-gray street so the city stays legible in full sun. At night the bundled galaxy map is the backdrop (with an inner horizon wall so the star band stays visible behind the down-tilted default camera), the shader sky-dome gets out of the way, and the moon is a smaller, softer disc instead of an over-bright bloom. The experimental "Dreamworld" sky-theme picker (and its drifting clouds) has been removed — the City now has one canonical look that follows your theme's day/night mode; any previously-saved Dreamworld setting falls back to it automatically.+- **City no longer flashes a blank white scene when the GPU drops the WebGL context** — Heavy post-processing plus an always-on frame-readback buffer made Chromium lose the City's WebGL context easily, leaving a white canvas with no recovery. The readback buffer is now only enabled while taking a postcard, the render resolution is capped to keep the context stable, and a lost context is detected and either recovered on restore or surfaced over the page background instead of a white void. Known THREE.js deprecation and expected context-loss console messages are also filtered out so the browser console stays usable.- **Browser download keep-alive no longer spams JSON-parse errors** — The browser service's CDP keep-alive treated any `200 OK` on its DevTools port as a live Chrome endpoint and called `res.json()` on it unconditionally. When another process answers on that port with HTML (e.g. the Vite dev server auto-incrementing onto it), the parse threw `Unexpected token '<', "<!DOCTYPE "...`, which the reconnect loop logged every 2 seconds. The CDP check now validates the response is actually Chrome's JSON (`webSocketDebuggerUrl` present) and treats anything else as "not reachable." Separately, the Vite dev server now uses `strictPort` so it fails loudly instead of silently walking up onto a reserved PortOS port (5555 API, 5556 browser CDP).diff --git a/client/public/fonts/GeistPixel-Square-3d.ttf b/client/public/fonts/GeistPixel-Square-3d.ttfnew file mode 100644index 0000000000..90a898f147Binary files /dev/null and b/client/public/fonts/GeistPixel-Square-3d.ttf differdiff --git a/client/src/components/city/CityClouds.jsx b/client/src/components/city/CityClouds.jsxdeleted file mode 100644index c7de58cc20..0000000000--- a/client/src/components/city/CityClouds.jsx+++ /dev/null@@ -1,140 +0,0 @@-import { useRef, useMemo, useEffect } from 'react';-import { useFrame } from '@react-three/fiber';-import * as THREE from 'three';--const CLOUD_COUNT = 18;-const CLOUD_SPREAD_X = 200;-const CLOUD_SPREAD_Z = 200;-const CLOUD_MIN_Y = 60;-const CLOUD_MAX_Y = 100;-const WIND_SPEED = 1.5;--// Soft cloud billboard shader-const CLOUD_VERT = `- varying vec2 vUv;- void main() {- vUv = uv;- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);- }-`;--const CLOUD_FRAG = `- uniform float uOpacity;- uniform vec3 uColor;- uniform float uTime;- varying vec2 vUv;-- float hash(vec2 p) {- return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);- }- float noise(vec2 p) {- vec2 i = floor(p);- vec2 f = fract(p);- f = f * f * (3.0 - 2.0 * f);- float a = hash(i);- float b = hash(i + vec2(1.0, 0.0));- float c = hash(i + vec2(0.0, 1.0));- float d = hash(i + vec2(1.0, 1.0));- return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);- }-- void main() {- vec2 uv = vUv;- // Cloud shape: soft ellipse with noise-based edges- vec2 centered = (uv - 0.5) * 2.0;- // Stretch horizontally for flatter clouds- centered.x *= 0.7;- float dist = length(centered);- // Noise for irregular edges- float n = noise(uv * 4.0 + uTime * 0.05) * 0.3;- n += noise(uv * 8.0 - uTime * 0.03) * 0.15;- float shape = smoothstep(1.0 + n, 0.3, dist);- // Inner brightness variation- float inner = noise(uv * 3.0 + uTime * 0.02) * 0.2 + 0.8;- vec3 color = uColor * inner;- float alpha = shape * uOpacity;- gl_FragColor = vec4(color, alpha);- }-`;--function Cloud({ position, scale, speed, seed }) {- const meshRef = useRef();- const initialX = position[0];-- const material = useMemo(() => new THREE.ShaderMaterial({- vertexShader: CLOUD_VERT,- fragmentShader: CLOUD_FRAG,- uniforms: {- uOpacity: { value: 0.6 },- uColor: { value: new THREE.Color('#ffffff') },- uTime: { value: seed * 100 },- },- transparent: true,- depthWrite: false,- side: THREE.DoubleSide,- blending: THREE.NormalBlending,- }), [seed]);-- useEffect(() => () => material.dispose(), [material]);-- useFrame(({ clock, camera }) => {- if (!meshRef.current) return;- const t = clock.getElapsedTime();- material.uniforms.uTime.value = t + seed * 100;-- // Drift with wind, wrap around- const drift = ((t * speed * WIND_SPEED + initialX + CLOUD_SPREAD_X) % (CLOUD_SPREAD_X * 2)) - CLOUD_SPREAD_X;- meshRef.current.position.x = drift;-- // Billboard: face camera- meshRef.current.quaternion.copy(camera.quaternion);- });-- return (- <mesh ref={meshRef} position={position} scale={scale} material={material}>- <planeGeometry args={[1, 1]} />- </mesh>- );-}--export default function CityClouds({ settings }) {- const skyTheme = settings?.skyTheme ?? 'cyberpunk';- const visible = skyTheme === 'dreamworld';-- const clouds = useMemo(() => {- const items = [];- for (let i = 0; i < CLOUD_COUNT; i++) {- const seed = i / CLOUD_COUNT;- const x = (Math.random() - 0.5) * CLOUD_SPREAD_X * 2;- const y = CLOUD_MIN_Y + Math.random() * (CLOUD_MAX_Y - CLOUD_MIN_Y);- const z = (Math.random() - 0.5) * CLOUD_SPREAD_Z * 2;- const baseScale = 15 + Math.random() * 25;- const scaleY = baseScale * (0.3 + Math.random() * 0.3);- const speed = 0.3 + Math.random() * 0.7;- items.push({- key: i,- position: [x, y, z],- scale: [baseScale, scaleY, 1],- speed,- seed,- });- }- return items;- }, []);-- if (!visible) return null;-- return (- <group>- {clouds.map(c => (- <Cloud- key={c.key}- position={c.position}- scale={c.scale}- speed={c.speed}- seed={c.seed}- />- ))}- </group>- );-}diff --git a/client/src/components/city/CityEffects.jsx b/client/src/components/city/CityEffects.jsxdeleted file mode 100644index fdc1fc4434..0000000000--- a/client/src/components/city/CityEffects.jsx+++ /dev/null@@ -1,261 +0,0 @@-import { useRef, useEffect } from 'react';-import { useThree, useFrame, extend } from '@react-three/fiber';-import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';-import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass.js';-import { UnrealBloomPass } from 'three/examples/jsm/postprocessing/UnrealBloomPass.js';-import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';-import * as THREE from 'three';-import { cityDayMix } from './cityConstants';--extend({ EffectComposer, RenderPass, UnrealBloomPass, ShaderPass });--// Exposure/brightness lift shader -- applied after bloom so it brightens the scene-// without feeding extra luminosity into the bloom pass.-// Uses a reverse power curve: shadows lift dramatically, highlights barely change.-const ExposureShader = {- uniforms: {- tDiffuse: { value: null },- uExposure: { value: 1.0 },- },- vertexShader: `- varying vec2 vUv;- void main() {- vUv = uv;- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);- }- `,- fragmentShader: `- uniform sampler2D tDiffuse;- uniform float uExposure;- varying vec2 vUv;- void main() {- vec4 color = texture2D(tDiffuse, vUv);- // Reverse power curve: lifts shadows/midtones, preserves highlights; higher uExposure -> brighter- float safeExposure = max(uExposure, 0.001);- color.rgb = 1.0 - pow(max(1.0 - color.rgb, 0.0), vec3(safeExposure));- gl_FragColor = color;- }- `,-};--// Chromatic Aberration shader -- offset R/B channels at screen edges-const ChromaticAberrationShader = {- uniforms: {- tDiffuse: { value: null },- uStrength: { value: 0.003 },- },- vertexShader: `- varying vec2 vUv;- void main() {- vUv = uv;- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);- }- `,- fragmentShader: `- uniform sampler2D tDiffuse;- uniform float uStrength;- varying vec2 vUv;- void main() {- vec2 center = vec2(0.5);- vec2 dir = vUv - center;- float dist = length(dir);- float offset = dist * uStrength;- float r = texture2D(tDiffuse, vUv + dir * offset).r;- float g = texture2D(tDiffuse, vUv).g;- float b = texture2D(tDiffuse, vUv - dir * offset).b;- gl_FragColor = vec4(r, g, b, 1.0);- }- `,-};--// Film Grain shader -- animated noise overlay-const FilmGrainShader = {- uniforms: {- tDiffuse: { value: null },- uTime: { value: 0 },- uIntensity: { value: 0.04 },- },- vertexShader: `- varying vec2 vUv;- void main() {- vUv = uv;- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);- }- `,- fragmentShader: `- uniform sampler2D tDiffuse;- uniform float uTime;- uniform float uIntensity;- varying vec2 vUv;- float rand(vec2 co) {- return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);- }- void main() {- vec4 color = texture2D(tDiffuse, vUv);- float noise = rand(vUv * uTime) * uIntensity;- color.rgb += noise - uIntensity * 0.5;- gl_FragColor = color;- }- `,-};--// Color Grading shader -- at night push shadows blue, midtones cyan, highlights-// warm (cyberpunk). uDay (0=night, 1=day) fades those tints out and swaps in a-// bright, lightly-warm, more saturated daytime grade so noon reads as real daylight-// instead of dusk.-const ColorGradingShader = {- uniforms: {- tDiffuse: { value: null },- uDay: { value: 0 },- },- vertexShader: `- varying vec2 vUv;- void main() {- vUv = uv;- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);- }- `,- fragmentShader: `- uniform sampler2D tDiffuse;- uniform float uDay;- varying vec2 vUv;- void main() {- vec4 color = texture2D(tDiffuse, vUv);- float lum = dot(color.rgb, vec3(0.299, 0.587, 0.114));- // Night tints (faded out by day)- vec3 shadowTint = vec3(0.051, 0.051, 0.169); // deep blue- vec3 midTint = vec3(0.024, 0.714, 0.831); // cyan- vec3 highTint = vec3(1.0, 0.95, 0.9); // warm white- float shadowWeight = smoothstep(0.0, 0.3, lum) * (1.0 - smoothstep(0.0, 0.4, lum));- float midWeight = smoothstep(0.2, 0.5, lum) * (1.0 - smoothstep(0.5, 0.8, lum));- float highWeight = smoothstep(0.6, 1.0, lum);- float night = 1.0 - uDay;- color.rgb = mix(color.rgb, color.rgb * shadowTint * 3.0, shadowWeight * 0.12 * night);- color.rgb = mix(color.rgb, color.rgb * midTint * 1.4, midWeight * 0.15 * night);- color.rgb = mix(color.rgb, color.rgb * highTint, highWeight * 0.1);- // Brightness lift: the night grade lifts dark areas (+1.1/+0.015). Daylight is- // already bright, so the lift backs off to neutral to avoid clipping to white.- color.rgb = color.rgb * mix(1.1, 0.99, uDay) + mix(0.015, 0.0, uDay);- // Daytime warmth + gentle saturation so colors feel sunlit rather than washed.- vec3 warm = color.rgb * vec3(1.03, 1.0, 0.96);- float gray = dot(warm, vec3(0.299, 0.587, 0.114));- vec3 sat = mix(vec3(gray), warm, 1.08);- color.rgb = mix(color.rgb, sat, uDay);- gl_FragColor = color;- }- `,-};--export default function CityEffects({ settings }) {- const composerRef = useRef();- const grainPassRef = useRef();- const exposurePassRef = useRef();- const bloomPassRef = useRef();- const caPassRef = useRef();- const cgPassRef = useRef();- const { gl, scene, camera, size } = useThree();-- const bloomEnabled = settings?.bloomEnabled ?? true;- const bloomStrength = settings?.bloomStrength ?? 0.5;- const sceneExposure = settings?.sceneExposure ?? 1.0;- const chromaticAberration = settings?.chromaticAberration ?? true;- const filmGrain = settings?.filmGrain ?? true;- const colorGrading = settings?.colorGrading ?? true;- // Daytime fades the heavy night atmospherics (bloom, grain, chromatic aberration,- // blue grade) so noon reads as clear daylight rather than a hazy dusk.- const dayMix = cityDayMix(settings);- const effectiveExposure = sceneExposure * (1 + (1 - dayMix) * 0.55);- const caBase = bloomStrength >= 0.6 ? 0.005 : 0.003;-- useEffect(() => {- const composer = new EffectComposer(gl);- composer.setSize(size.width, size.height);- composer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));-- const renderPass = new RenderPass(scene, camera);- composer.addPass(renderPass);-- if (bloomEnabled) {- const bloomPass = new UnrealBloomPass(- new THREE.Vector2(size.width, size.height),- bloomStrength,- 0.4, // radius — tighter glow around emissive elements- 0.45 // threshold — only genuinely bright/emissive surfaces bloom- );- bloomPassRef.current = bloomPass;- composer.addPass(bloomPass);- } else {- bloomPassRef.current = null;- }-- // Exposure pass — always added, enabled/disabled via ref to avoid- // recreating the composer when the slider is dragged- const exposurePass = new ShaderPass(ExposureShader);- exposurePass.enabled = effectiveExposure !== 1.0;- exposurePass.uniforms.uExposure.value = effectiveExposure;- exposurePassRef.current = exposurePass;- composer.addPass(exposurePass);-- if (colorGrading) {- const cgPass = new ShaderPass(ColorGradingShader);- cgPassRef.current = cgPass;- composer.addPass(cgPass);- } else {- cgPassRef.current = null;- }-- if (chromaticAberration) {- const caPass = new ShaderPass(ChromaticAberrationShader);- caPass.uniforms.uStrength.value = caBase;- caPassRef.current = caPass;- composer.addPass(caPass);- } else {- caPassRef.current = null;- }-- if (filmGrain) {- const fgPass = new ShaderPass(FilmGrainShader);- grainPassRef.current = fgPass;- composer.addPass(fgPass);- } else {- grainPassRef.current = null;- }-- composerRef.current = composer;-- return () => {- composer.dispose();- };- // eslint-disable-next-line react-hooks/exhaustive-deps -- effectiveExposure intentionally omitted; updated via exposurePassRef in useFrame to avoid recreating the composer on slider drag- }, [gl, scene, camera, size.width, size.height, bloomEnabled, bloomStrength, chromaticAberration, filmGrain, colorGrading]);-- useFrame(({ clock }) => {- if (exposurePassRef.current) {- exposurePassRef.current.enabled = effectiveExposure !== 1.0;- exposurePassRef.current.uniforms.uExposure.value = effectiveExposure;- }- if (grainPassRef.current) {- grainPassRef.current.uniforms.uTime.value = clock.getElapsedTime();- // Grain is a night-film affectation — fade it out in daylight.- grainPassRef.current.uniforms.uIntensity.value = 0.04 * (1 - dayMix);- }- if (cgPassRef.current) {- cgPassRef.current.uniforms.uDay.value = dayMix;- }- if (bloomPassRef.current) {- // Bloom is a night-neon effect. In daylight the whole scene sits above the- // bloom threshold, so any bloom blooms EVERYTHING into a white-out — fade the- // strength to ~0 and raise the threshold so only true highlights (the sun) glow.- bloomPassRef.current.strength = bloomStrength * (1 - dayMix);- bloomPassRef.current.threshold = 0.45 + dayMix * 0.45;- }- if (caPassRef.current) {- caPassRef.current.uniforms.uStrength.value = caBase * (1 - dayMix);- }- if (composerRef.current) {- composerRef.current.render();- }- }, 1);-- return null;-}diff --git a/client/src/components/city/CityGalaxySky.jsx b/client/src/components/city/CityGalaxySky.jsxindex 3085425b1c..d347c60518 100644--- a/client/src/components/city/CityGalaxySky.jsx+++ b/client/src/components/city/CityGalaxySky.jsx@@ -1,14 +1,14 @@-import { useEffect } from 'react';+import { useEffect, useMemo } from 'react';import { useLoader } from '@react-three/fiber';import * as THREE from 'three';import { cityDayMix } from './cityConstants';-const GALAXY_TEXTURE = '/sky/city-night-galaxy-sphere.png';+const GALAXY_TEXTURE_URL = '/sky/city-night-galaxy-sphere.png';export default function CityGalaxySky({ settings }) {const dayMix = cityDayMix(settings);const nightOpacity = Math.max(0, Math.min(1, 1 - dayMix));- const texture = useLoader(THREE.TextureLoader, GALAXY_TEXTURE);+ const texture = useLoader(THREE.TextureLoader, GALAXY_TEXTURE_URL);useEffect(() => {texture.colorSpace = THREE.SRGBColorSpace;@@ -21,23 +21,36 @@ export default function CityGalaxySky({ settings }) {texture.needsUpdate = true;}, [texture]);+ // One material shared by the sphere backing and the inner horizon wall — both+ // sample the same galaxy map at the same opacity, so there's no reason to+ // allocate two. opacity/transparent track nightOpacity on each render (a+ // settings-rate change, not per-frame).+ const galaxyMaterial = useMemo(() => new THREE.MeshBasicMaterial({+ map: texture,+ color: '#ffffff',+ side: THREE.BackSide,+ depthTest: true,+ depthWrite: false,+ toneMapped: false,+ }), [texture]);+ useEffect(() => () => galaxyMaterial.dispose(), [galaxyMaterial]);+ galaxyMaterial.opacity = nightOpacity;+ galaxyMaterial.transparent = nightOpacity < 0.99;+if (nightOpacity <= 0.01) return null;return (- <mesh renderOrder={-1000} rotation={[0, -Math.PI * 0.18, 0]}>- {/* Sits just inside the CitySky dome (1600) and beyond the mountain ring- (~1210) so the galaxy reads as the night backdrop behind the horizon. */}- <sphereGeometry args={[1500, 64, 32]} />- <meshBasicMaterial- map={texture}- color="#9bbcff"- side={THREE.BackSide}- transparent={nightOpacity < 0.99}- opacity={nightOpacity}- depthTest- depthWrite={false}- toneMapped={false}- />- </mesh>+ <group rotation={[0, -Math.PI * 0.18, 0]}>+ {/* Distant full-sphere backing for free-look/orbit cameras. */}+ <mesh renderOrder={-1000} material={galaxyMaterial}>+ <sphereGeometry args={[1500, 64, 32]} />+ </mesh>+ {/* The default City camera points down across the horizon, so the+ equirectangular sphere can look like plain darkness. This inner+ horizon wall keeps the custom galaxy band visible behind the city. */}+ <mesh renderOrder={-999} position={[0, 220, 0]} material={galaxyMaterial}>+ <cylinderGeometry args={[1420, 1420, 960, 96, 1, true]} />+ </mesh>+ </group>);}diff --git a/client/src/components/city/CityGround.jsx b/client/src/components/city/CityGround.jsxindex 111bc8efc7..52a246fb98 100644--- a/client/src/components/city/CityGround.jsx+++ b/client/src/components/city/CityGround.jsx@@ -65,6 +65,7 @@ export default function CityGround({ settings }) {const groundColorTarget = useRef(new THREE.Color(preset.groundColor ?? '#0a0a20'));groundColorTarget.current.set(preset.groundColor ?? '#0a0a20');const targetRoughness = preset.groundRoughness ?? 0.7;+ const targetMetalness = 0.4 * (1 - dayMix) + 0.04 * dayMix;// The neon grid + additive fog follow the themed accent (CITY_COLORS.ground is// recolored per theme by applyCityBrandColors). At night they read as accent neon;@@ -79,6 +80,7 @@ export default function CityGround({ settings }) {const lf = Math.min(1, delta * 3);groundMatRef.current.color.lerp(groundColorTarget.current, lf);groundMatRef.current.roughness += (targetRoughness - groundMatRef.current.roughness) * lf;+ groundMatRef.current.metalness += (targetMetalness - groundMatRef.current.metalness) * lf;});const puddles = useMemo(() => {@@ -107,7 +109,7 @@ export default function CityGround({ settings }) {<meshStandardMaterialref={groundMatRef}color={preset.groundColor ?? '#0a0a20'}- metalness={0.4}+ metalness={targetMetalness}roughness={0.7}side={THREE.DoubleSide}/>diff --git a/client/src/components/city/CityScene.jsx b/client/src/components/city/CityScene.jsxindex 084ec695a4..e7a486b9e9 100644--- a/client/src/components/city/CityScene.jsx+++ b/client/src/components/city/CityScene.jsx@@ -33,8 +33,6 @@ import CityAiCore from './CityAiCore';import CityDataRain from './CityDataRain';import CityNeonSigns from './CityNeonSigns';import CityEmbers from './CityEmbers';-import CityEffects from './CityEffects';-import CityClouds from './CityClouds';import CitySignalBeacons from './CitySignalBeacons';import CitySky from './CitySky';import CityGalaxySky from './CityGalaxySky';@@ -50,11 +48,22 @@ export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus,const [positions, setPositions] = useState(null);const [proximityApp, setProximityApp] = useState(null);const [transitioning, setTransitioning] = useState(false);+ const [webglLost, setWebglLost] = useState(false);const prevExplorationRef = useRef(false);const orbitRef = useRef(null);+ const contextCleanupRef = useRef(null);+ const contextLostTimerRef = useRef(null);+ const activeCanvasRef = useRef(null);const explorationMode = settings?.explorationMode || false;+ const clearContextTimer = useCallback(() => {+ if (contextLostTimerRef.current) {+ window.clearTimeout(contextLostTimerRef.current);+ contextLostTimerRef.current = null;+ }+ }, []);+// drei's `keyEvents` only (re)connects pointer events to the DOM element in this// three-stdlib version — it does NOT attach the keydown listener OrbitControls// needs for arrow-key panning. Wire that explicitly when the orbital controls are@@ -66,6 +75,11 @@ export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus,return () => controls.stopListenToKeyEvents?.();}, [explorationMode, transitioning, photoMode]);+ useEffect(() => () => {+ clearContextTimer();+ contextCleanupRef.current?.();+ }, [clearContextTimer]);+// Set transitioning=true when exploration mode togglesuseEffect(() => {if (prevExplorationRef.current !== explorationMode) {@@ -89,22 +103,67 @@ export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus,const stoppedCount = apps.filter(a => !a.archived && a.overallStatus !== 'online').length;const totalCount = apps.filter(a => !a.archived).length;- const dpr = settings?.dpr || [1, 1.5];+ // Quality presets always express dpr as a [min, max] pair. Cap it to the live+ // ceiling so a high preset can't push a context-losing pixel ratio; photo mode+ // gets a touch more for crisp postcards.+ const rawDpr = settings?.dpr || [1, 1.25];+ const dprLimit = photoMode ? 1.5 : 1.25;+ const dpr = rawDpr.map(value => Math.min(value, dprLimit));const showGradientBackground = cityDayMix(settings) > 0.5;+ const sceneClearColor = background || '#030308';+ const fallbackBackground = showGradientBackground+ ? 'linear-gradient(180deg, #0f4f9a 0%, #1e78bf 48%, #58a9dc 100%)'+ : sceneClearColor;++ const handleCanvasCreated = useCallback(({ gl }) => {+ contextCleanupRef.current?.();+ const canvas = gl.domElement;+ activeCanvasRef.current = canvas;+ clearContextTimer();+ const handleContextLost = (event) => {+ event.preventDefault();+ clearContextTimer();+ contextLostTimerRef.current = window.setTimeout(() => {+ contextLostTimerRef.current = null;+ if (activeCanvasRef.current !== canvas || !canvas.isConnected) return;+ const context = gl.getContext?.();+ if (context?.isContextLost?.()) {+ setWebglLost(true);+ }+ }, 750);+ };+ const handleContextRestored = () => {+ clearContextTimer();+ setWebglLost(false);+ };+ canvas.addEventListener('webglcontextlost', handleContextLost, false);+ canvas.addEventListener('webglcontextrestored', handleContextRestored, false);+ contextCleanupRef.current = () => {+ clearContextTimer();+ if (activeCanvasRef.current === canvas) {+ activeCanvasRef.current = null;+ }+ canvas.removeEventListener('webglcontextlost', handleContextLost, false);+ canvas.removeEventListener('webglcontextrestored', handleContextRestored, false);+ };+ setWebglLost(false);+ }, [clearContextTimer]);return (- <Canvas- camera={{ position: [0, 25, 45], fov: 50 }}- dpr={dpr}- shadows={false}- style={{ background: background || '#030308', cursor: explorationMode ? 'crosshair' : 'auto' }}- // preserveDrawingBuffer lets photo mode read the frame back via toDataURL. It's a- // WebGL context-creation attribute, so it can't be toggled at runtime without recreating- // the renderer (which would flash the scene) — we accept it always-on. The cost on modern- // GPUs is a small per-frame copy; negligible against this scene's particle/bloom load.- gl={{ antialias: true, preserveDrawingBuffer: true, alpha: false }}- >- {showGradientBackground && <color attach="background" args={[background || '#030308']} />}+ <div className="absolute inset-0" style={{ background: fallbackBackground }}>+ <Canvas+ key={photoMode ? 'photo' : 'live'}+ camera={{ position: [0, 25, 45], fov: 50 }}+ dpr={dpr}+ shadows={false}+ onCreated={handleCanvasCreated}+ style={{ background: sceneClearColor, cursor: explorationMode ? 'crosshair' : 'auto', opacity: webglLost ? 0 : 1 }}+ // preserveDrawingBuffer is only needed while taking postcards. Keeping it+ // always-on makes Chromium's WebGL context much easier to lose in the live+ // dashboard, which reads as a blank white scene.+ gl={{ antialias: true, preserveDrawingBuffer: Boolean(photoMode), alpha: false, powerPreference: 'high-performance' }}+ >+ <color attach="background" args={[sceneClearColor]} />{/* Mount the galaxy dome only at night — keeps its 2.8MB texture from beingfetched/decoded in full daylight, where it's fully faded out anyway.Suspense keeps the useLoader fetch from suspending the whole canvas while@@ -118,7 +177,6 @@ export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus,</ErrorBoundary>)}<CitySky settings={settings} />- <CityClouds settings={settings} /><CityLights settings={settings} /><CityLandscape settings={settings} /><CityEnergyOverlay chronotype={chronotype} settings={settings} />@@ -164,13 +222,12 @@ export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus,productivityData={productivityData}/><CitySignalBeacons positions={positions} reviewCounts={reviewCounts} instances={instances} settings={settings} />- <CityVolumetricLights positions={positions} />+ <CityVolumetricLights positions={positions} settings={settings} /><CityNeonSigns positions={positions} /><CityWeather stoppedCount={stoppedCount} totalCount={totalCount} playSfx={playSfx} /><CityDataRain /><CityEmbers /><CityParticles settings={settings} />- <CityEffects settings={settings} />{explorationMode && (<PlayerControllerkeysRef={keysRef}@@ -207,6 +264,7 @@ export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus,onTransitionComplete={handleTransitionComplete}/><CityPhotoCamera active={photoMode} presetId={photoPresetId} onReady={onPhotoCaptureReady} />- </Canvas>+ </Canvas>+ </div>);}diff --git a/client/src/components/city/CitySettingsPanel.jsx b/client/src/components/city/CitySettingsPanel.jsxindex bece486a80..257fc34a09 100644--- a/client/src/components/city/CitySettingsPanel.jsx+++ b/client/src/components/city/CitySettingsPanel.jsx@@ -225,32 +225,6 @@ export default function CitySettingsPanel() {<div className="border-t border-cyan-500/10" />- {/* Sky Theme */}- <div>- <SectionHeader title="SKY THEME" subtitle="Change the world atmosphere" />- <div className="grid grid-cols-2 gap-1.5">- {[- { key: 'cyberpunk', label: 'CYBERPUNK', desc: 'Dark neon-lit night city' },- { key: 'dreamworld', label: 'DREAMWORLD', desc: 'Bright open-world sky with clouds' },- ].map(theme => (- <button- key={theme.key}- onClick={() => updateSetting('skyTheme', theme.key)}- title={theme.desc}- className={`font-pixel text-[9px] py-2 rounded border transition-all tracking-wide ${- settings.skyTheme === theme.key- ? 'bg-cyan-500/20 border-cyan-500/50 text-cyan-400 shadow-[0_0_8px_rgba(6,182,212,0.2)]'- : 'bg-gray-800/40 border-gray-700/40 text-gray-500 hover:border-gray-600 hover:text-gray-400'- }`}- >- {theme.label}- </button>- ))}- </div>- </div>-- <div className="border-t border-cyan-500/10" />-{/* Scene Lighting */}<div><SectionHeader title="SCENE LIGHTING" subtitle="Brightness and time of day" />diff --git a/client/src/components/city/CitySky.jsx b/client/src/components/city/CitySky.jsxindex 0d61720143..acb8624f75 100644--- a/client/src/components/city/CitySky.jsx+++ b/client/src/components/city/CitySky.jsx@@ -130,7 +130,9 @@ const getPresetColors = (name, skyTheme) => {sunLight: new THREE.Color(p.sunLight),hour: p.hour,sunIntensity: p.sunIntensity,- overlayOpacity: isBrightDay ? 1.0 : 0.26,+ // Day is the gradient sky. Night is the bundled galaxy map, so the shader+ // dome gets out of the way and only the moon/light meshes remain.+ overlayOpacity: isBrightDay ? 1.0 : 0.0,sunScale: p.sunScale,isMoon: p.isMoon,};@@ -146,30 +148,30 @@ function CelestialBody({ groupRef }) {useFrame(({ clock }) => {if (!bodyRef.current) return;const t = clock.getElapsedTime();- const pulse = 1.0 + Math.sin(t * 0.5) * 0.1;- bodyRef.current.material.emissiveIntensity = 2.0 * pulse;+ const pulse = 1.0 + Math.sin(t * 0.5) * 0.08;+ bodyRef.current.material.emissiveIntensity = 0.45 * pulse;if (haloRef.current) {- haloRef.current.material.opacity = 0.15 + Math.sin(t * 0.3) * 0.05;+ haloRef.current.material.opacity = 0.035 + Math.sin(t * 0.3) * 0.012;}});return (<group ref={groupRef}><mesh ref={bodyRef}>- <sphereGeometry args={[4, 24, 24]} />+ <sphereGeometry args={[2.2, 24, 24]} /><meshStandardMaterialcolor="#ffaa44"emissive="#ffaa44"- emissiveIntensity={2.0}- toneMapped={false}+ emissiveIntensity={0.45}+ toneMapped/></mesh><mesh ref={haloRef}>- <ringGeometry args={[5, 14, 32]} />+ <ringGeometry args={[3, 7, 32]} /><meshBasicMaterialcolor="#ff6080"transparent- opacity={0.15}+ opacity={0.035}side={THREE.DoubleSide}blending={THREE.AdditiveBlending}depthWrite={false}@@ -229,7 +231,7 @@ export default function CitySky({ settings }) {uTime: { value: 0 },},side: THREE.BackSide,- transparent: true,+ transparent: preset.overlayOpacity < 0.999,opacity: preset.overlayOpacity,blending: THREE.NormalBlending,depthWrite: false,@@ -276,6 +278,11 @@ export default function CitySky({ settings }) {skyMaterial.uniforms.uIsMoon.value += ((preset.isMoon ? 1.0 : 0.0) - skyMaterial.uniforms.uIsMoon.value) * lerpFactor;skyMaterial.uniforms.uOpacity.value += (preset.overlayOpacity - skyMaterial.uniforms.uOpacity.value) * lerpFactor;skyMaterial.opacity = skyMaterial.uniforms.uOpacity.value;+ const shouldBeTransparent = skyMaterial.opacity < 0.999;+ if (skyMaterial.transparent !== shouldBeTransparent) {+ skyMaterial.transparent = shouldBeTransparent;+ skyMaterial.needsUpdate = true;+ }skyMaterial.uniforms.uTime.value = clock.getElapsedTime();// Move celestial body mesh@@ -311,7 +318,7 @@ export default function CitySky({ settings }) {{/* Dome radius must exceed the CityLandscape mountain ring (~1210 max extent)so the horizon mountains sit INSIDE the dome and aren't occluded by theopaque daytime sky. Kept under the camera far plane (2000). */}- <mesh material={skyMaterial}>+ <mesh material={skyMaterial} renderOrder={-1000}><sphereGeometry args={[1600, 32, 32]} /></mesh><CelestialBody groupRef={bodyGroupRef} />diff --git a/client/src/components/city/CityVolumetricLights.jsx b/client/src/components/city/CityVolumetricLights.jsxindex 5a54f66041..a46ded60da 100644--- a/client/src/components/city/CityVolumetricLights.jsx+++ b/client/src/components/city/CityVolumetricLights.jsx@@ -1,7 +1,7 @@import { useRef, useMemo } from 'react';import { useFrame } from '@react-three/fiber';import * as THREE from 'three';-import { CITY_COLORS } from './cityConstants';+import { CITY_COLORS, cityDayMix } from './cityConstants';// Volumetric light cone shaderconst CONE_VERT = `@@ -86,7 +86,7 @@ function LightBeam({ position, color, height = 15, radius = 2, intensity = 1, ph}// Horizontal scanning laser beam between two points-function ScanBeam({ start, end, color, speed = 0.2, delay = 0 }) {+function ScanBeam({ start, end, color, speed = 0.2, delay = 0, intensityScale = 1 }) {const meshRef = useRef();const { length, midX, midZ, angle } = useMemo(() => {@@ -106,7 +106,7 @@ function ScanBeam({ start, end, color, speed = 0.2, delay = 0 }) {// Slowly fade in and outconst cycle = ((t * speed + delay) % 4.0);meshRef.current.material.opacity = cycle < 2 ?- Math.sin((cycle / 2) * Math.PI) * 0.06 : 0;+ Math.sin((cycle / 2) * Math.PI) * 0.06 * intensityScale : 0;});const y = 3 + Math.sin(delay * 7) * 2;@@ -121,7 +121,7 @@ function ScanBeam({ start, end, color, speed = 0.2, delay = 0 }) {<meshBasicMaterialcolor={color}transparent- opacity={0.05}+ opacity={0.05 * intensityScale}blending={THREE.AdditiveBlending}side={THREE.DoubleSide}/>@@ -129,7 +129,8 @@ function ScanBeam({ start, end, color, speed = 0.2, delay = 0 }) {);}-export default function CityVolumetricLights({ positions }) {+export default function CityVolumetricLights({ positions, settings }) {+ const nightFade = 1 - cityDayMix(settings);const beams = useMemo(() => {if (!positions || positions.size < 2) return { lights: [], scans: [] };@@ -169,7 +170,7 @@ export default function CityVolumetricLights({ positions }) {return { lights, scans };}, [positions]);- if (beams.lights.length === 0) return null;+ if (nightFade <= 0.05 || beams.lights.length === 0) return null;return (<group>@@ -180,7 +181,7 @@ export default function CityVolumetricLights({ positions }) {color={beam.color}height={beam.height}radius={beam.radius}- intensity={beam.intensity}+ intensity={beam.intensity * nightFade}phase={beam.phase}/>))}@@ -192,6 +193,7 @@ export default function CityVolumetricLights({ positions }) {color={scan.color}speed={scan.speed}delay={scan.delay}+ intensityScale={nightFade}/>))}</group>diff --git a/client/src/components/city/cityConstants.js b/client/src/components/city/cityConstants.jsindex 88f4199130..a56e534319 100644--- a/client/src/components/city/cityConstants.js+++ b/client/src/components/city/cityConstants.js@@ -1,7 +1,8 @@import { hashString } from '../../utils/hashString';-// Geist Pixel Square font URL for drei <Text> in 3D scene (TTF required, troika doesn't support woff2)-export const PIXEL_FONT_URL = '/fonts/GeistPixel-Square.ttf';+// Drei <Text> needs a TTF; this copy keeps the Geist Pixel glyphs but strips+// layout tables that Troika's font parser logs as unsupported.+export const PIXEL_FONT_URL = '/fonts/GeistPixel-Square-3d.ttf';export const CITY_COLORS = {ground: '#06b6d4',@@ -52,30 +53,31 @@ export const CITY_COLORS = {},noon: {hour: 12,- // Bright, airy daytime sky — luminous blue overhead fading to a near-white- // horizon haze (stylized "clear day" look, BotW-ish).- zenith: '#4a93e0',- midSky: '#7fb6ec',- horizonHigh: '#bfe0f7',- horizonLow: '#e6f3fc',+ // Bright daytime sky, but with enough blue/chroma in the horizon bands that+ // the dome reads as sky instead of a white fog sheet over the city.+ zenith: '#0f4f9a',+ midSky: '#1e78bf',+ horizonHigh: '#3d95d2',+ horizonLow: '#58a9dc',sunCore: '#fffef2',sunGlow: '#fff7d6',sunLight: '#fff4e0',// Moderate intensities — kept low enough that lit surfaces don't clip to white// (the post-process previously bloomed the over-bright scene into a white disc).- sunIntensity: 1.9,+ sunIntensity: 1.25,sunScale: 0.7,isMoon: false,daylightFactor: 1.0,- // Mid-tone ground so daylight lands around a clean gray, not blown-out white.- groundColor: '#8d9198',+ // Muted blue-gray pavement; daylight + sky reflections otherwise turn the+ // central city plane into a white mirror.+ groundColor: '#3f5268',groundRoughness: 0.9,// Soft daytime sky fill (blue from above, warm bounce) — gentle, not high-key.- hemiSkyColor: '#acc6e8',- hemiGroundColor: '#b4b0a0',- hemiIntensity: 0.95,- ambientColor: '#c0cce0',- ambientIntensity: 0.35,+ hemiSkyColor: '#8bb8e0',+ hemiGroundColor: '#8f9488',+ hemiIntensity: 0.65,+ ambientColor: '#8ea4c6',+ ambientIntensity: 0.24,},sunset: {// Theme-night preset: moonlit cyber-night, not blackout. The city should@@ -122,100 +124,9 @@ export const CITY_COLORS = {ambientIntensity: 0.1,},},- // Sky themes: visual palette overrides for time-of-day presets- // 'cyberpunk' uses default timeOfDay colors above- // 'dreamworld' bright purple/blue open-world sky with clouds- skyThemes: {- cyberpunk: null, // uses default timeOfDay colors- dreamworld: {- sunrise: {- hour: 6,- zenith: '#4a2080',- midSky: '#6a3aaa',- horizonHigh: '#ff9070',- horizonLow: '#ffcc88',- sunCore: '#ffdd66',- sunGlow: '#ffaa55',- sunLight: '#ffeecc',- sunIntensity: 3.0,- sunScale: 1.2,- isMoon: false,- daylightFactor: 0.5,- groundColor: '#4a4a60',- groundRoughness: 0.5,- hemiSkyColor: '#cc88ff',- hemiGroundColor: '#4a3a50',- hemiIntensity: 0.8,- ambientColor: '#6644aa',- ambientIntensity: 0.35,- },- noon: {- hour: 12,- zenith: '#4a93e0',- midSky: '#7fb6ec',- horizonHigh: '#bfe0f7',- horizonLow: '#e6f3fc',- sunCore: '#fffef2',- sunGlow: '#fff7d6',- sunLight: '#fff4e0',- // Rebalanced to match the default noon (lower intensities / mid ground) so- // a dreamworld sky in Day mode doesn't blow the scene out to white.- sunIntensity: 1.9,- sunScale: 0.8,- isMoon: false,- daylightFactor: 1.0,- groundColor: '#8d9198',- groundRoughness: 0.9,- hemiSkyColor: '#acc6e8',- hemiGroundColor: '#b4b0a0',- hemiIntensity: 0.95,- ambientColor: '#c0cce0',- ambientIntensity: 0.35,- },- sunset: {- hour: 18,- zenith: '#2a1860',- midSky: '#5530a0',- horizonHigh: '#ff6088',- horizonLow: '#ffaa60',- sunCore: '#ffcc44',- sunGlow: '#ff8866',- sunLight: '#ffddbb',- sunIntensity: 2.5,- sunScale: 1.2,- isMoon: false,- daylightFactor: 0.4,- groundColor: '#302848',- groundRoughness: 0.55,- hemiSkyColor: '#bb6688',- hemiGroundColor: '#2a2040',- hemiIntensity: 0.6,- ambientColor: '#4a2266',- ambientIntensity: 0.3,- },- midnight: {- hour: 0,- zenith: '#0a0830',- midSky: '#161248',- horizonHigh: '#2a2266',- horizonLow: '#3a3080',- sunCore: '#ccccff',- sunGlow: '#9999dd',- sunLight: '#556688',- sunIntensity: 0.3,- sunScale: 0.7,- isMoon: true,- daylightFactor: 0.05,- groundColor: '#141230',- groundRoughness: 0.7,- hemiSkyColor: '#221e55',- hemiGroundColor: '#0a0818',- hemiIntensity: 0.1,- ambientColor: '#1a1644',- ambientIntensity: 0.15,- },- },- },+ // The City uses one canonical cyber sky. Legacy stored skyTheme values are+ // ignored by the scene and fall back to these presets.+ skyThemes: {},};export const BOROUGH_PARAMS = {@@ -456,7 +367,7 @@ export const deriveCityPalette = (theme) => {// actual daytime). The scene picks one based on the resolved time of day; the HUD// panels follow the light/dark theme independently (see .cybercity-themed CSS).const nightBackground = darkenHex(accent, 0.1);- const dayBackground = lightenHex(accent, 0.86);+ const dayBackground = lightenHex(accent, 0.72);return {themeId: theme?.id || 'classic-midnight',mode: theme?.mode || 'night',diff --git a/client/src/components/city/cityTheme.test.js b/client/src/components/city/cityTheme.test.jsindex 95e2be97bd..7cac558e83 100644--- a/client/src/components/city/cityTheme.test.js+++ b/client/src/components/city/cityTheme.test.js@@ -1,5 +1,5 @@import { describe, it, expect, beforeEach, afterEach } from 'vitest';-import { deriveCityPalette, applyCityBrandColors, resolveCityTimeOfDay, cityLabelColors, tintTowardAccent, tintStructure, CITY_COLORS, getBuildingColor, seededRand, smoothstepRange, cityDayMix } from './cityConstants';+import { deriveCityPalette, applyCityBrandColors, resolveCityTimeOfDay, cityLabelColors, tintTowardAccent, tintStructure, CITY_COLORS, getBuildingColor, seededRand, smoothstepRange, cityDayMix, getTimeOfDayPreset } from './cityConstants';const hexLum = (hex) => {const n = parseInt(hex.slice(1), 16);@@ -25,10 +25,10 @@ describe('deriveCityPalette', () => {const phosphor = getTheme('black-ice-terminal-day'); // accent #0a7a4aconst p = deriveCityPalette(phosphor);expect(p.nightBackground).toBe('#010c07'); // #0a7a4a * 0.1- expect(p.dayBackground).toBe('#ddece6'); // #0a7a4a lightened 0.86 toward white+ expect(p.dayBackground).toBe('#badacc'); // #0a7a4a lightened 0.72 toward white// A day theme's default surround (loading screen) is the bright day sky.expect(p.isDay).toBe(true);- expect(p.background).toBe('#ddece6');+ expect(p.background).toBe('#badacc');});it('defaults a night theme surround to the dark void', () => {@@ -36,7 +36,7 @@ describe('deriveCityPalette', () => {const p = deriveCityPalette(midnight);expect(p.isDay).toBe(false);expect(p.background).toBe('#060d19'); // nightBackground = #3b82f6 * 0.1- expect(p.dayBackground).toBe('#e4eefe');+ expect(p.dayBackground).toBe('#c8dcfc');});it('falls back to defaults for a missing/invalid theme', () => {@@ -98,6 +98,26 @@ describe('deriveCityPalette', () => {});});+describe('city sky visibility', () => {+ it('keeps daytime horizon bands blue enough to avoid a white sky wash', () => {+ const noon = getTimeOfDayPreset('noon', 'cyberpunk');+ const horizonLow = hexChannels(noon.horizonLow);+ const horizonHigh = hexChannels(noon.horizonHigh);++ // The lower horizon can be bright, but should not be near-white across all+ // channels; otherwise the sky dome becomes a fog overlay.+ expect(Math.max(...horizonLow) - Math.min(...horizonLow)).toBeGreaterThan(35);+ expect(Math.max(...horizonHigh) - Math.min(...horizonHigh)).toBeGreaterThan(45);+ expect(hexLum(noon.horizonLow)).toBeLessThan(205);+ });++ it('falls back to the cyber sky for legacy dreamworld settings', () => {+ const cyber = getTimeOfDayPreset('noon', 'cyberpunk');+ const noon = getTimeOfDayPreset('noon', 'dreamworld');+ expect(noon).toBe(cyber);+ });+});+describe('cityLabelColors', () => {it('keeps the neon fill and adds no outline at night (dayMix 0)', () => {const c = cityLabelColors('#06b6d4', 0);diff --git a/client/src/hooks/useCitySettings.js b/client/src/hooks/useCitySettings.jsindex d789d08d4d..65f8cb3a31 100644--- a/client/src/hooks/useCitySettings.js+++ b/client/src/hooks/useCitySettings.js@@ -34,7 +34,7 @@ const QUALITY_PRESETS = {ambientBrightness: 1.2,neonBrightness: 1.2,sceneExposure: 1.0,- dpr: [1, 1.5],+ dpr: [1, 1.25],},ultra: {bloomEnabled: true, bloomStrength: 0.7,@@ -44,7 +44,7 @@ const QUALITY_PRESETS = {ambientBrightness: 1.5,neonBrightness: 1.5,sceneExposure: 1.2,- dpr: [1, 2],+ dpr: [1, 1.5],},};@@ -54,7 +54,6 @@ const DEFAULT_SETTINGS = {sfxEnabled: true,sfxVolume: 0.5,qualityPreset: 'high',- skyTheme: 'cyberpunk',timeOfDay: 'auto', // 'auto' follows the active theme's day/night mode; 'day'/'night' force itexplorationMode: false,...QUALITY_PRESETS.high,diff --git a/client/src/lib/README.md b/client/src/lib/README.mdindex 1aa428a87b..69fac5cd83 100644--- a/client/src/lib/README.md+++ b/client/src/lib/README.md@@ -66,6 +66,7 @@ grep -i "what you want to do" client/src/lib/README.md| `clinicianReport.js` | Pure builders for the MeatSpace clinician-export view (`/meatspace/export`). `buildClinicianReport({ tests, config })` → structured report model (blood panels grouped by category with reference ranges + out-of-range flags, plus a lifestyle summary); `reportToMarkdown(report)` → copy-paste markdown. Reuses the Blood tab's `REFERENCE_RANGES` / `getBloodValueStatus` so printed flags match the UI. Also exports `buildBloodTestModel`, `buildLifestyleModel`, `getCategoryForKey`, `formatRange`. || `clipboard.js` | `copyToClipboard`, `writeClipboardSilently`, `readClipboard` — safe across insecure-origin contexts. Use these instead of `navigator.clipboard.writeText` inline. || `compareHelpers.js` | `equalByKeys(a, b, keys)` / `equalListByKeys(a, b, keys)` — typed key-based equality for `useAutoRefetch`'s `compare`. Keys are property names, dotted paths (`'context.running'`), or `(item) => value` accessors. The typed alternative to `sameJsonShape` when a monotonic timestamp or unrendered field would break stringify-equality dedup. |+| `consoleFilters.js` | `installConsoleFilters()` — drops a small allow-list of known-noise console strings (THREE.js `Clock` deprecation, expected WebGL `Context Lost.`) from `console.{warn,log,debug}`. Idempotent; auto-installed on import. Imported for its side effect from `main.jsx`. || `genUtils.js` | Shared bits between Image Gen and Video Gen pages. || `healthProvenance.js` | `PROVENANCE_LEVELS` / `getProvenanceLevel(level)` — the `data-backed`/`inferred`/`experimental`/`speculative` trust taxonomy (label, tone, description, "what would change this?" copy) behind the `ProvenanceChip` source-style chips on MeatSpace / genome / death-clock / longevity views. Pure data; the chip component maps tone→color and id→icon. || `joinInfluenceList.js` | Mirror of `joinInfluenceList` in server universe builder. |diff --git a/client/src/lib/consoleFilters.js b/client/src/lib/consoleFilters.jsnew file mode 100644index 0000000000..6e93427c1d--- /dev/null+++ b/client/src/lib/consoleFilters.js@@ -0,0 +1,40 @@+const FILTER_INSTALLED = Symbol.for('portos.consoleFiltersInstalled');++const SUPPRESSED_MESSAGES = new Set([+ 'THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.',+ 'THREE.WebGLRenderer: Context Lost.',+]);++function shouldSuppress(args) {+ return args.length === 1 && typeof args[0] === 'string' && SUPPRESSED_MESSAGES.has(args[0]);+}++export function installConsoleFilters() {+ if (console[FILTER_INSTALLED]) return;++ const originalWarn = console.warn.bind(console);+ const originalLog = console.log.bind(console);+ const originalDebug = console.debug.bind(console);++ console.warn = (...args) => {+ if (shouldSuppress(args)) return;+ originalWarn(...args);+ };++ console.log = (...args) => {+ if (shouldSuppress(args)) return;+ originalLog(...args);+ };++ console.debug = (...args) => {+ if (shouldSuppress(args)) return;+ originalDebug(...args);+ };++ Object.defineProperty(console, FILTER_INSTALLED, {+ value: true,+ configurable: false,+ });+}++installConsoleFilters();diff --git a/client/src/lib/index.js b/client/src/lib/index.jsindex 9af66f9c18..ea94f2b4f7 100644--- a/client/src/lib/index.js+++ b/client/src/lib/index.js@@ -37,6 +37,7 @@ export * from './clientErrorReporter.js';export * from './clinicianReport.js';export * from './clipboard.js';export * from './compareHelpers.js';+export * from './consoleFilters.js';export * from './genUtils.js';export * from './healthProvenance.js';export * from './joinInfluenceList.js';diff --git a/client/src/main.jsx b/client/src/main.jsxindex 5050a84a13..46d47f97f2 100644--- a/client/src/main.jsx+++ b/client/src/main.jsx@@ -1,3 +1,4 @@+import './lib/consoleFilters';import React from 'react';import ReactDOM from 'react-dom/client';import { BrowserRouter } from 'react-router-dom';diff --git a/client/src/pages/CyberCity.jsx b/client/src/pages/CyberCity.jsxindex 61f1dd4492..3d9725f382 100644--- a/client/src/pages/CyberCity.jsx+++ b/client/src/pages/CyberCity.jsx@@ -14,7 +14,7 @@ import CitySettingsPanel from '../components/city/CitySettingsPanel';import { computeFilterResult } from '../utils/cityFilter';import { DEFAULT_PRESET_ID, cyclePreset } from '../utils/cityPhotoMode';import { computeSoundscape } from '../utils/citySoundscape';-import { deriveCityPalette, applyCityBrandColors, resolveCityTimeOfDay } from '../components/city/cityConstants';+import { CITY_COLORS, deriveCityPalette, applyCityBrandColors, resolveCityTimeOfDay } from '../components/city/cityConstants';import { useThemeContext } from '../components/ThemeContext';function CyberCityInner() {@@ -51,11 +51,11 @@ function CyberCityInner() {// The city renders day or night, following the theme mode by default (see// resolveCityTimeOfDay). The resolved preset key is handed to the scene via a// settings override (CitySky/CityLights/CityGround read settings.timeOfDay), and- // the backdrop swaps between the bright day sky and the dark night void to match.+ // the backdrop swaps between the blue day sky and the dark night void to match.const cityTimeOfDay = resolveCityTimeOfDay(settings?.timeOfDay, cityPalette.isDay);- const sceneBackground = cityTimeOfDay.daytime ? cityPalette.dayBackground : cityPalette.nightBackground;+ const sceneBackground = cityTimeOfDay.daytime ? CITY_COLORS.timeOfDay.noon.midSky : cityPalette.nightBackground;const sceneSettings = useMemo(- () => ({ ...settings, timeOfDay: cityTimeOfDay.presetKey }),+ () => ({ ...settings, skyTheme: 'cyberpunk', timeOfDay: cityTimeOfDay.presetKey }),[settings, cityTimeOfDay.presetKey],);