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
address local review: scope the M shortcut, arm arrivals on every warp, drop a dead resolver
[._.]/ Adam Eivy9dbfb535d796
diff --git a/client/src/components/city/cityConstants.js b/client/src/components/city/cityConstants.jsindex 04ba702aeb..fa457785ed 100644--- a/client/src/components/city/cityConstants.js+++ b/client/src/components/city/cityConstants.js@@ -480,6 +480,12 @@ export const resolveWorldStyle = (style) => (// The style's definition, always a real one.export const getWorldStyle = (style) => WORLD_STYLE_DEFS[resolveWorldStyle(style)];+// OpenWorld renders just two times of day — day and night — and follows the active+// theme's mode by default ('auto'). The user can still force 'day'/'night'. Legacy+// stored values (sunrise/noon/sunset/midnight) are treated as 'auto' so existing+// installs pick up theme coupling without a migration. Returns the daytime flag plus+// the concrete preset key the sky/lights/ground consume, taken from the world style's+// own pair — so picking 'cyber' restores the established noon/moonlit-night look exactly.export const resolveCityTimeOfDay = (setting, themeIsDay, worldStyle) => {const daytime = setting === 'day' ? true: setting === 'night' ? falsediff --git a/client/src/pages/OpenWorld.fastTravel.test.jsx b/client/src/pages/OpenWorld.fastTravel.test.jsxindex 8a23cbc0a6..cb8f6921ba 100644--- a/client/src/pages/OpenWorld.fastTravel.test.jsx+++ b/client/src/pages/OpenWorld.fastTravel.test.jsx@@ -14,9 +14,10 @@ vi.mock('../components/city/CityScene', () => ({},}));vi.mock('../components/city/CityHud', () => ({- default: ({ onOpenFastTravel, activeRegion }) => (+ default: ({ onOpenFastTravel, activeRegion, onEnterPhotoMode }) => (<div><button type="button" onClick={onOpenFastTravel}>hud-fast-travel</button>+ <button type="button" onClick={onEnterPhotoMode}>hud-photo</button><span data-testid="hud-region">{activeRegion?.id || 'none'}</span></div>),@@ -139,12 +140,22 @@ describe('OpenWorld — fast travel wiring', () => {expect(screen.queryByLabelText('Search regions')).not.toBeInTheDocument();});- it('does not teleport the player while flying the overview camera', () => {+ it('arms no arrival point until something is actually warped to', () => {+ renderAt('/openworld');+ expect(sceneProps.current.playerTeleport).toBeNull();+ });++ it(`arms the walking player's arrival point on every warp, exploring or not`, () => {+ // PlayerController mounts only in exploration mode and applies the current token on+ // mount, so arming it from the orbital overview is what makes "warp, then Tab in"+ // land at the region rather than the old spawn.renderAt('/openworld');act(() => { fireEvent.keyDown(window, { key: 'm' }); });fireEvent.click(screen.getByLabelText('Travel to Memory Quarter'));- // Exploration mode is off, so there is no player rig to move.- expect(sceneProps.current.playerTeleport).toBeNull();++ const teleport = sceneProps.current.playerTeleport;+ expect(teleport).toMatchObject({ x: expect.any(Number), z: expect.any(Number) });+ expect(teleport.token).toBe(1);});it('teleports the player when warping on foot', () => {@@ -159,7 +170,6 @@ describe('OpenWorld — fast travel wiring', () => {});it('bumps the teleport token when the same region is picked twice', () => {- localStorage.setItem('portos-city-settings', JSON.stringify({ explorationMode: true }));renderAt('/openworld');act(() => { fireEvent.keyDown(window, { key: 'm' }); });@@ -172,6 +182,19 @@ describe('OpenWorld — fast travel wiring', () => {expect(sceneProps.current.playerTeleport.token).toBe(2);});+ it('does not bank an M keypress while photo mode owns the camera', () => {+ // The panel is hidden in photo/playback mode; a live binding there would spring it+ // open the moment the user returned to the live view.+ renderAt('/openworld');+ fireEvent.click(screen.getByText('hud-photo'));+ act(() => { fireEvent.keyDown(window, { key: 'm' }); });+ expect(screen.queryByLabelText('Search regions')).not.toBeInTheDocument();++ fireEvent.keyDown(window, { key: 'Escape' }); // leave photo mode+ act(() => {});+ expect(screen.queryByLabelText('Search regions')).not.toBeInTheDocument();+ });+it('tells the HUD which region is active', () => {renderAt('/openworld/region/data-harbor');expect(screen.getByTestId('hud-region')).toHaveTextContent('data-harbor');diff --git a/client/src/pages/OpenWorld.jsx b/client/src/pages/OpenWorld.jsxindex 0b4c2e894f..6d2a102f09 100644--- a/client/src/pages/OpenWorld.jsx+++ b/client/src/pages/OpenWorld.jsx@@ -181,30 +181,24 @@ function OpenWorldInner() {// camera (CityFocusCamera) and, on foot, the player rig. Only the panel's open/closed// state is local — the destination itself always lives in the URL.const [fastTravelOpen, setFastTravelOpen] = useState(false);- // Carries a monotonic token so PlayerController can tell "warp again to the same place"- // from a re-render with equal coordinates. Not derived from the region id for that reason.+ // The walking player's arrival point for the latest warp, carrying a monotonic token so+ // PlayerController can tell "warp again to the same place" from a re-render with equal+ // coordinates — which is why it isn't derived from the region id. Set on every warp, not+ // only while exploring: PlayerController mounts only in exploration mode and applies the+ // current token on mount, so arming it unconditionally also means warping in the orbital+ // overview and THEN dropping in (Tab) lands you at the region you were looking at,+ // instead of back at your old spawn.const [playerTeleport, setPlayerTeleport] = useState(null);const handleTravelToRegion = useCallback((region) => {if (!region?.id) return;navigate(regionPath(region.id));- // Exploring on foot? Move the player too — otherwise a warp would fly a camera the- // walking player isn't attached to and nothing would appear to happen.- if (settings?.explorationMode) {- const arrival = regionArrivalPoint(region);- if (arrival) setPlayerTeleport(prev => ({ ...arrival, token: (prev?.token ?? 0) + 1 }));- }+ const arrival = regionArrivalPoint(region);+ if (arrival) setPlayerTeleport(prev => ({ ...arrival, token: (prev?.token ?? 0) + 1 }));playSfx?.('dataPulse');- }, [navigate, settings?.explorationMode, playSfx]);+ }, [navigate, playSfx]);- // M opens the fast-travel map. Deliberately open-only, not a toggle: the panel is a- // <Modal>, which owns Esc/backdrop dismissal — and the shared shortcut hook suppresses- // itself while any `aria-modal` dialog is up, so a toggle binding could never have fired- // the close half anyway. The hook also drops ⌘/Ctrl/Alt chords, auto-repeat, and- // keystrokes typed into a field, so the HUD filter and the panel's own search box keep- // their letters.const openFastTravel = useCallback(() => setFastTravelOpen(true), []);- useKeyboardShortcuts(true, { m: openFastTravel, M: openFastTravel });// Photo mode (roadmap 3.3): a cinematic capture mode with framing presets and a postcard// screenshot. The in-canvas CityPhotoCamera registers its capture function here via a ref so@@ -222,6 +216,16 @@ function OpenWorldInner() {// into the scene props below. Mutually exclusive with photo mode.const playback = useCityPlayback();+ // M opens the fast-travel map. Deliberately open-only, not a toggle: the panel is a+ // <Modal>, which owns Esc/backdrop dismissal — and the shared shortcut hook suppresses+ // itself while any `aria-modal` dialog is up, so a toggle binding could never have+ // fired the close half anyway. The hook also drops ⌘/Ctrl/Alt chords, auto-repeat, and+ // keystrokes typed into a field, so the HUD filter and the panel's own search box keep+ // their letters. Inactive in photo and playback mode: those own the camera and hide the+ // panel, so a live binding there would only bank an "open" that springs the panel the+ // moment the user returns to the live view.+ useKeyboardShortcuts(!photoMode && !playback.active, { m: openFastTravel, M: openFastTravel });+// Entering photo mode leaves exploration + playback; they're mutually exclusive modes.const enterPhotoMode = useCallback(() => {clearFocusRoute();diff --git a/client/src/utils/README.md b/client/src/utils/README.mdindex ea7279dbd5..9739e0a6c4 100644--- a/client/src/utils/README.md+++ b/client/src/utils/README.md@@ -93,7 +93,7 @@ its tunable constants and placement helpers.| `cityMiniMap` | Mini-map projection of building positions into 2D bounds, plus opt-in waterfront geography (bay/shoreline/harbor) read from `cityPlan` (`computeMiniMap`, `projectPoint`, `geographyWorldPoints`, `projectGeography`). || `cityPhotoMode` | Photo-mode camera presets, the demand-loop fly stepper, postcard stats, and screenshot filename (`getPreset`, `cyclePreset`, `stepFly`). || `cityPlan` | Master town plan: district parcels, shoreline/bay, plaza, transit loop, street network (`PARCELS`, `WORLD`, `computeStreets`, `computeStreetProps`, `isInWater`). |-| `openWorldRegions` | OpenWorld fast-travel registry: named regions over the `cityPlan` parcels, each mapped to the PortOS page it visualizes (`OPEN_WORLD_REGIONS`, `getRegion`, `listRegions`, `resolveRegion`, `searchRegions`, `regionArrivalPoint`, `regionPath`). |+| `openWorldRegions` | OpenWorld fast-travel registry: named regions over the `cityPlan` parcels, each mapped to the PortOS page it visualizes (`OPEN_WORLD_REGIONS`, `getRegion`, `listRegions`, `searchRegions`, `regionArrivalPoint`, `regionPath`). || `cityPlayerRig` | Exploration player-rig math: third-person follow camera, boom collision, damping, facing, avatar state (`thirdPersonCamera`, `resolveBoom`, `dampAngle`, `moveFacing`, `avatarState`). || `cityRenderBudget` | Pure Auto-quality render-budget state machine: p75 frame-time windows, hysteresis, cooldown, warm-up/gap rejection (`createRenderBudget`, `recordFrame`, `restartWarmup`, `resetRenderBudget`, `getEffectiveTier`, `QUALITY_TIERS`, `DEFAULT_RENDER_BUDGET_CONFIG`). || `cityRooftops` | Deterministic rooftop fixture kits (antenna/tank/AC/dish) per app name (`computeRooftopKit`). |diff --git a/client/src/utils/openWorldRegions.js b/client/src/utils/openWorldRegions.jsindex 367718c569..187d4a7c5f 100644--- a/client/src/utils/openWorldRegions.js+++ b/client/src/utils/openWorldRegions.js@@ -44,10 +44,10 @@ export const regionPath = (id) => `${OPEN_WORLD_REGION_PREFIX}/${id}`;const REGIONS_BY_ID = new Map(OPEN_WORLD_REGIONS.map((r) => [r.id, r]));// A region with its geography resolved from the master town plan: `anchor` is the ground-// center [x, y, z], `w`/`d` the parcel footprint, `label` the plan's label when the registry-// doesn't override it. Returns null for an unknown id (and for a region naming a parcel that-// no longer exists — a plan rename should fail loudly in the tests, not silently render at-// the origin).+// center [x, y, z], `w`/`d` the parcel footprint. The registry's `label` is what the UI+// shows; the plan's own label rides along as `planLabel` for anything that wants the+// in-world signage wording. Returns null for an unknown id — and for a region naming a+// parcel that no longer exists, which the tests fail on rather than rendering at the origin.export function getRegion(id) {const region = REGIONS_BY_ID.get(id);if (!region) return null;@@ -68,17 +68,6 @@ export function listRegions() {return OPEN_WORLD_REGIONS.map((r) => getRegion(r.id)).filter(Boolean);}-// Resolver for the `/openworld/region/:regionId` route param, mirroring resolveCityFocus:-// a bad id is a 404 the UI can report, an absent id is simply "no region focused". Unlike-// building focus there's no loading race — the registry is static — so `notFound` is-// immediate.-export function resolveRegion(regionId) {- const hasRegion = typeof regionId === 'string' && regionId.length > 0;- if (!hasRegion) return { hasRegion: false, region: null, notFound: false };- const region = getRegion(regionId);- return { hasRegion: true, region, notFound: !region };-}-// Case/punctuation-insensitive lookup over labels + aliases, for the fast-travel filter box.// Returns regions in registry order so the list never jumps around as you type.export function searchRegions(query) {diff --git a/client/src/utils/openWorldRegions.test.js b/client/src/utils/openWorldRegions.test.jsindex 0d18bdad55..ddef878521 100644--- a/client/src/utils/openWorldRegions.test.js+++ b/client/src/utils/openWorldRegions.test.js@@ -6,7 +6,6 @@ import {listRegions,regionArrivalPoint,regionPath,- resolveRegion,searchRegions,REGION_ARRIVAL_SETBACK,} from './openWorldRegions';@@ -52,10 +51,13 @@ describe('getRegion', () => {expect(region.planLabel).toBe(PARCELS.memory.label);});- it('returns null for an unknown id', () => {+ it('returns null for an absent or unknown id', () => {+ // This IS the route contract: /openworld/region/:regionId hands the raw param+ // straight to getRegion, and a null means "stay on the overview".expect(getRegion('atlantis')).toBeNull();expect(getRegion('')).toBeNull();expect(getRegion(undefined)).toBeNull();+ expect(getRegion(null)).toBeNull();});});@@ -68,27 +70,6 @@ describe('listRegions', () => {});});-describe('resolveRegion', () => {- it('reports no region for an absent param', () => {- expect(resolveRegion(undefined)).toEqual({ hasRegion: false, region: null, notFound: false });- expect(resolveRegion('')).toEqual({ hasRegion: false, region: null, notFound: false });- });-- it('resolves a real id', () => {- const { hasRegion, region, notFound } = resolveRegion('data-harbor');- expect(hasRegion).toBe(true);- expect(notFound).toBe(false);- expect(region.id).toBe('data-harbor');- });-- it('flags an unknown id as not found rather than silently showing the overview', () => {- const { hasRegion, region, notFound } = resolveRegion('nowhere');- expect(hasRegion).toBe(true);- expect(region).toBeNull();- expect(notFound).toBe(true);- });-});-describe('searchRegions', () => {it('returns everything for an empty query', () => {expect(searchRegions('')).toHaveLength(OPEN_WORLD_REGIONS.length);