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
perf: cull ground-level CityLights accent lights on the low quality tier (#3397)
[._.]/ Adam Eivy9efe7f767d7b
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 5666dd2067..311ad26e4c 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -31,6 +31,7 @@- `agentLifecycle.js` imported `getAgent` aliased as `getAgentRecord`, shadowing the real transcript-free reader that was split out in #3368 for exactly this purpose. Both call sites read only `.status`/`.metadata`, but the alias made them hydrate the record: reading and line-splitting a completed run's whole `output.txt` (megabytes on a long TUI run) and potentially rewriting `metadata.json` via `repairCodexTaskSummary`. Now imports the real `getAgentRecord`, read once and shared.- **Universe Builder is a composition shell again.** `UniverseBuilderPage.jsx` drops from 778 to ~530 lines: the URL-backed tab/sub-bucket state (plus the two effects that strip a `?tab=`/`?bucket=` the current categories no longer support) is now `useUniverseTabs`, and generate-in-bucket / promote-to-canon / auto-sort — each with its own in-flight gate and stale-snapshot merge rules — is now `useUniverseBucketActions`. The render-completion handler that was copy-pasted between the trunk tabs and the Other tab is one shared callback. Expand/refine already lived in `useUniverseExpand`, so it stayed put. Behavior, markup, and API calls are unchanged; `useUniverseTabs` picks up 11 tests. (#3391)- **Text-stage generation streams its progress instead of spinning blind.** A draft-gated prose/script stage can run up to three generate+judge cycles — minutes with no signal — so `generateStage` now broadcasts phase frames (context build, drafting attempt N of M, judging, best-draft restore, canon extraction) and a per-attempt scorecard over a new SSE channel, and `TextStagePanel` renders them with PolishPanel's phase-label pattern. The channel is subscribe-first (attaching opens it, so the client can't race the POST it is about to send) and purely advisory: with no subscriber every emit is a no-op, and autoRunner, Series Autopilot, and the volume beat runner call generation exactly as before. (#3393)+- **The CyberCity low tier stops paying for lights it can't show off.** A mounted light costs a per-fragment iteration in the lighting loop of every `MeshStandardMaterial` in the scene no matter how dim it is, so the adaptive-quality low tier could never shed that cost by fading lights out — only by unmounting them. `CityLights` now gates its two ground-level accent point lights (the green and red warning accents, the dimmest and smallest-radius of the set) behind the same `cityShowDetail` tier gate the street furniture and trams already use, dropping the low tier from 11 dynamic point lights to 9. Medium tier and above — and any install whose payload predates `effectiveTier` — render exactly as before. (#3397)## Better audit 2026-08-03 (UX, City scene, game/music/writing focus) — PRs #3401–#3404diff --git a/client/src/components/city/CityLights.jsx b/client/src/components/city/CityLights.jsxindex 36bccc7f42..b98a4daf4b 100644--- a/client/src/components/city/CityLights.jsx+++ b/client/src/components/city/CityLights.jsx@@ -1,7 +1,7 @@import { useRef } from 'react';import { useFrame } from '@react-three/fiber';import * as THREE from 'three';-import { getTimeOfDayPreset } from './cityConstants';+import { cityShowDetail, getTimeOfDayPreset } from './cityConstants';import { useCityPalette } from './CityPaletteContext';// Animated accent light that slowly shifts color, with reactive brightness@@ -90,6 +90,10 @@ export default function CityLights({ settings }) {const preset = getTimeOfDayPreset(timeOfDay, skyTheme);const nightGlow = 1 - Math.min(1, preset.daylightFactor ?? 0);+ // Medium tier and up — the same gate the rest of the optional set dressing uses, so the+ // low tier sheds light count along with the props those lights were there to accent.+ const showAccentLights = cityShowDetail(settings);+// Neon scale: dim neon point lights during daytime (30% at noon, 100% at night)const neonScaleRef = useRef(1);const targetNeonScale = 1.0 - (preset.daylightFactor ?? 0) * 0.7;@@ -151,10 +155,21 @@ export default function CityLights({ settings }) {<ReactivePointLight position={[0, 15, -25]} baseIntensity={0.5} color="#8b5cf6" distance={60} brightnessRef={brightnessRef} neonScaleRef={neonScaleRef} />{/* Warm orange ground level accent */}<ReactivePointLight position={[10, 3, 5]} baseIntensity={0.35} color="#f97316" distance={35} brightnessRef={brightnessRef} neonScaleRef={neonScaleRef} />- {/* Additional green accent - ground level from opposite side */}- <ReactivePointLight position={[-12, 3, 8]} baseIntensity={0.2} color="#22c55e" distance={25} brightnessRef={brightnessRef} neonScaleRef={neonScaleRef} />- {/* Red warning accent from below-right */}- <ReactivePointLight position={[15, 2, -10]} baseIntensity={0.15} color="#f43f5e" distance={22} brightnessRef={brightnessRef} neonScaleRef={neonScaleRef} />+ {/* Ground-level small-radius accents (green + red warning). Culled on the low tier:+ every mounted light costs a per-fragment iteration in the lighting loop of every+ MeshStandardMaterial in the scene, whatever its intensity — so dimming them saves+ nothing and only unmounting does (#3397). These two are the least visually+ significant of the set: lowest intensity (0.2 / 0.15) and smallest radius (25 / 22+ units), so they only tint a small patch of street the low tier already renders+ without its set dressing. */}+ {showAccentLights && (+ <>+ {/* Additional green accent - ground level from opposite side */}+ <ReactivePointLight position={[-12, 3, 8]} baseIntensity={0.2} color="#22c55e" distance={25} brightnessRef={brightnessRef} neonScaleRef={neonScaleRef} />+ {/* Red warning accent from below-right */}+ <ReactivePointLight position={[15, 2, -10]} baseIntensity={0.15} color="#f43f5e" distance={22} brightnessRef={brightnessRef} neonScaleRef={neonScaleRef} />+ </>+ )}{/* Sweeping searchlight */}<Searchlight brightnessRef={brightnessRef} neonScaleRef={neonScaleRef} /></>diff --git a/client/src/components/city/CityLights.test.jsx b/client/src/components/city/CityLights.test.jsxnew file mode 100644index 0000000000..f259fc8365--- /dev/null+++ b/client/src/components/city/CityLights.test.jsx@@ -0,0 +1,50 @@+import { describe, it, expect, vi } from 'vitest';+import { render } from '@testing-library/react';++// jsdom has no WebGL context, so the real three.js stack can't mount. `useFrame` is+// stubbed to a no-op — the per-frame intensity maths are irrelevant here; what this file+// covers is which lights get MOUNTED per quality tier (#3397). The r3f primitives+// (<pointLight>, <ambientLight>, …) render as unknown DOM elements, which is exactly what+// makes them countable by tag name.+vi.mock('@react-three/fiber', () => ({ useFrame: () => {} }));+vi.mock('./CityPaletteContext', () => ({ useCityPalette: () => ({ ground: '#22d3ee' }) }));++import CityLights from './CityLights';++const pointLightCount = (settings) => {+ const { container } = render(<CityLights settings={settings} />);+ return container.getElementsByTagName('pointLight').length;+};++describe('CityLights quality-tier culling', () => {+ // Zero-intensity lights still cost a per-fragment iteration in every+ // MeshStandardMaterial's lighting loop, so the low tier has to shed the light+ // by unmounting it — dimming it saves nothing.+ it('drops the two ground-level accent lights on the low tier', () => {+ const full = pointLightCount({ effectiveTier: 'high' });+ expect(pointLightCount({ effectiveTier: 'low' })).toBe(full - 2);+ });++ it('leaves the medium tier and above untouched', () => {+ const high = pointLightCount({ effectiveTier: 'high' });+ expect(pointLightCount({ effectiveTier: 'medium' })).toBe(high);+ expect(pointLightCount({ effectiveTier: 'ultra' })).toBe(high);+ });++ it('keeps every light when no settings are supplied', () => {+ // Legacy/absent payloads fall through cityShowDetail's particleDensity default of 1,+ // so an install that never set effectiveTier keeps the established look.+ expect(pointLightCount(undefined)).toBe(pointLightCount({ effectiveTier: 'high' }));+ });++ it('keeps the key, fill and glow lights on the low tier', () => {+ // The cull is scoped to the two dimmest small-radius accents — the overhead key/fill+ // pair, the broad night glow, the animated side accents and the ambient/hemisphere+ // fill all stay, so the low tier is dimmer in one street corner, not gutted.+ const { container } = render(<CityLights settings={{ effectiveTier: 'low' }} />);+ expect(container.getElementsByTagName('pointLight').length).toBe(9);+ expect(container.getElementsByTagName('ambientLight').length).toBe(1);+ expect(container.getElementsByTagName('hemisphereLight').length).toBe(1);+ expect(container.getElementsByTagName('spotLight').length).toBe(1);+ });+});