Skip to content

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

turn CyberCity into OpenWorld: fast travel between regions, low-poly bright world

[._.]/ Adam Eivy25fbb036ff40
diff --git a/client/src/App.jsx b/client/src/App.jsx
index 048601548a..17f91711ad 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -24,7 +24,7 @@ const AgentsPage = lazyWithReload(() => import('./pages/DevTools').then(m => ({
const DataDog = lazyWithReload(() => import('./pages/DataDog'));
const FlowsDoc = lazyWithReload(() => import('./pages/FlowsDoc'));
const GitHub = lazyWithReload(() => import('./pages/GitHub'));
-const CyberCity = lazyWithReload(() => import('./pages/CyberCity'));
+const OpenWorld = lazyWithReload(() => import('./pages/OpenWorld'));
const AppDetail = lazyWithReload(() => import('./pages/AppDetail'));
const FeatureAgents = lazyWithReload(() => import('./pages/FeatureAgents'));
const FeatureAgentDetail = lazyWithReload(() => import('./pages/FeatureAgentDetail'));
@@ -195,6 +195,10 @@ const MEDIA_3D_PREFIX = /^\/media\/3d/;
// is what a bookmark, a typed URL, or a half-remembered path lands on — alias it
// rather than letting the catch-all swallow it (issue #3793).
const ANNOTATE_PREFIX = /^\/annotate/;
+// CyberCity became OpenWorld. Bookmarks, pinned sidebar entries, stored palette
+// history, and peers' deep links all still say /city — alias the whole prefix
+// (including /city/settings and /city/apps/:appId) rather than 404ing them.
+const CITY_PREFIX = /^\/city/;
// Normalize a tab-less /creative-director/:id URL to its overview tab while
// preserving any query string + hash. A bare `<Navigate to="overview">` would
@@ -342,9 +346,12 @@ export default function App() {
<Route path="jira" element={<Navigate to="/devtools/jira" replace />} />
<Route path="devtools/jira" element={<Jira />} />
<Route path="devtools/jira/reports" element={<JiraReports />} />
- <Route path="city" element={<CyberCity />} />
- <Route path="city/settings" element={<CyberCity />} />
- <Route path="city/apps/:appId" element={<CyberCity />} />
+ <Route path="openworld" element={<OpenWorld />} />
+ <Route path="openworld/settings" element={<OpenWorld />} />
+ <Route path="openworld/apps/:appId" element={<OpenWorld />} />
+ <Route path="openworld/region/:regionId" element={<OpenWorld />} />
+ <Route path="city" element={<PrefixRedirect from={CITY_PREFIX} to="/openworld" />} />
+ <Route path="city/*" element={<PrefixRedirect from={CITY_PREFIX} to="/openworld" />} />
<Route path="data" element={<DataManager />} />
<Route path="character" element={<CharacterSheet />} />
<Route path="ask" element={<Ask />} />
diff --git a/client/src/CLAUDE.md b/client/src/CLAUDE.md
index 3ce95b1a9d..bad0236748 100644
--- a/client/src/CLAUDE.md
+++ b/client/src/CLAUDE.md
@@ -10,7 +10,8 @@ These apply to React/Vite client code. Universal constraints (functional program
- **Above the fold** - keep actionable content and info above the fold and design pages for maximum information and access without scrolling
- **No hardcoded localhost** - use `window.location.hostname` for URLs; app accessed via Tailscale remotely
- **Chrome floating over media uses `.port-media-overlay`** - a label, status bar, badge, or control panel sitting on top of an image, a video, or a 3D canvas takes its surface and ink from the theme (`.port-media-overlay`, or `.port-media-overlay-strong` for a small label directly on photography; `.port-media-overlay-item` for its buttons, `.port-media-overlay-divider` for its separators — all defined in `index.css`, which carries the mechanism and the rule for picking between this, `.always-dark`, and the City HUD remap). **Don't write `bg-black/NN` + `text-white`/`text-gray-N00` for this** — day mode remaps the text to the theme's dark ink while the black scrim stays black, so the label renders dark-on-black. Older overlays outside the 3D/Three.js pages still carry that idiom (migration tracked in #3796), so match the new convention rather than the nearest neighbor.
-- **Alphabetical navigation** - sidebar nav items in `Layout.jsx` are alphabetically ordered after the Dashboard+CyberCity top section and separator; children within collapsible sections are also alphabetical
+- **Alphabetical navigation** - sidebar nav items in `Layout.jsx` are alphabetically ordered after the Dashboard+OpenWorld top section and separator; children within collapsible sections are also alphabetical
+- **OpenWorld's `city*` prefix is legacy, not a naming convention to follow.** The 3D world was renamed CyberCity → OpenWorld at the route/label level; the ~150 `city*` files (`components/city/`, `utils/city*.js`, `hooks/useCity*.js`) and the `.cybercity-themed` CSS scope did NOT move, and the `nav.cybercity` command ids are deliberately frozen (they're opaque and persisted in ⌘K history). **Name new files in that tree `openWorld*` / `OpenWorld*`** — matching the nearest neighbor would half-rename the directory by accretion, which is worse than either end state. The mechanical sweep is tracked in #4571.
- **Reactive UI updates** - after mutations (delete, create, update), update local state directly instead of refetching the entire list from the server. Use `setState(prev => prev.filter(...))` or similar patterns for immediate feedback
## API errors and save gating
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index 8c5a0b8a01..0dda228fa1 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -43,7 +43,7 @@ import {
SquareTerminal,
Globe,
Newspaper,
- Building2,
+ Globe2,
Ticket,
Network,
Flame,
@@ -144,7 +144,7 @@ import * as api from '../services/api';
const navItems = [
{ to: '/', label: 'Dashboard', icon: Home, single: true },
{ to: '/review', label: 'Review Hub', icon: ClipboardList, single: true },
- { to: '/city', label: 'City', icon: Building2, single: true },
+ { to: '/openworld', label: 'OpenWorld', icon: Globe2, single: true },
{ separator: true },
{ label: 'Apps', icon: Package, dynamic: 'apps', defaultTo: '/apps', children: [] },
{
@@ -545,7 +545,7 @@ const FULL_WIDTH_PATH_PREFIXES = [
'/writers-room',
'/agents',
'/shell/',
- '/city',
+ '/openworld',
'/timeline/',
// Every SongBook route — index (/songbook), import (/songbook/import),
// and viewer (/songbook/:id) — is full-bleed and owns its own scroll
diff --git a/client/src/components/Layout.test.jsx b/client/src/components/Layout.test.jsx
index 7c2be38e72..8ffd251f5c 100644
--- a/client/src/components/Layout.test.jsx
+++ b/client/src/components/Layout.test.jsx
@@ -6,7 +6,7 @@ import * as api from '../services/api';
// This suite locks the *integration* path that SingleNavRow.test.jsx can't reach:
// pinning a top-level `single: true` row (Dashboard `/`, Review Hub `/review`,
-// City `/city`, Goals `/goals/list`) must make it render in the sidebar Pinned
+// OpenWorld `/openworld`, Goals `/goals/list`) must make it render in the sidebar Pinned
// section. That resolution lives in Layout itself — `navEntryByPath` indexes
// `item.single` leaves, `resolveNavEntry` maps a stored path to a row, and
// `useNavWorkingSet` feeds the Pinned-section render. We exercise the real
@@ -107,13 +107,13 @@ describe('Layout — pinned single nav rows', () => {
});
it('resolves every top-level single row by path into the Pinned section', async () => {
- localStorage.setItem(PINNED_KEY, JSON.stringify(['/', '/review', '/city', '/goals/list']));
+ localStorage.setItem(PINNED_KEY, JSON.stringify(['/', '/review', '/openworld', '/goals/list']));
await renderLayout();
const pinned = pinnedSection();
expect(within(pinned).getByRole('link', { name: /Dashboard/i })).toHaveAttribute('href', '/');
expect(within(pinned).getByRole('link', { name: /Review Hub/i })).toHaveAttribute('href', '/review');
- expect(within(pinned).getByRole('link', { name: /City/i })).toHaveAttribute('href', '/city');
+ expect(within(pinned).getByRole('link', { name: /OpenWorld/i })).toHaveAttribute('href', '/openworld');
expect(within(pinned).getByRole('link', { name: /Goals/i })).toHaveAttribute('href', '/goals/list');
});
@@ -127,12 +127,12 @@ describe('Layout — pinned single nav rows', () => {
// null and is dropped by resolveNavEntry; a known path beside it still renders.
// Asserting the survivor (not just absence) proves the filter, not merely that
// the section failed to render.
- localStorage.setItem(PINNED_KEY, JSON.stringify(['/this/path/does/not/exist', '/city']));
+ localStorage.setItem(PINNED_KEY, JSON.stringify(['/this/path/does/not/exist', '/openworld']));
await renderLayout();
const pinned = pinnedSection();
expect(pinned).toBeTruthy();
- expect(within(pinned).getByRole('link', { name: /City/i })).toHaveAttribute('href', '/city');
+ expect(within(pinned).getByRole('link', { name: /OpenWorld/i })).toHaveAttribute('href', '/openworld');
// The unknown path contributes no row.
expect(within(pinned).getAllByRole('link')).toHaveLength(1);
});
diff --git a/client/src/components/city/Building.jsx b/client/src/components/city/Building.jsx
index 5cf6cfec58..a2c10cecc0 100644
--- a/client/src/components/city/Building.jsx
+++ b/client/src/components/city/Building.jsx
@@ -416,7 +416,9 @@ export default function Building({ app, position, agentCount, onClick, playSfx,
const displayedColorRef = useRef(null);
const targetColorRef = useRef(null);
- const { getBuildingColor, getAccentColor, tintStructure } = useCityPalette();
+ // `surface` carries the world style's finish (flat shading + matte under the low-poly
+ // style); spread last on the facade material so it wins over the cyber defaults.
+ const { getBuildingColor, getAccentColor, tintStructure, surface } = useCityPalette();
const height = getBuildingHeight(app);
const edgeColor = getBuildingColor(app.overallStatus, app.archived);
const accentColor = getAccentColor(app);
@@ -464,17 +466,21 @@ export default function Building({ app, position, agentCount, onClick, playSfx,
);
useEffect(() => () => haloEdgesGeom.dispose(), [haloEdgesGeom]);
- // Window texture with pixel art icon
+ // Window texture with pixel art icon. Built ONLY when the facade will actually bind it:
+ // the daytime material drops `map`/`emissiveMap` entirely, and the Vibes world style is
+ // daytime at both times of day — so without this gate every install on the default style
+ // would rasterize a full canvas per building (nested fillRect loops, ~1–2k 2D ops each)
+ // at scene mount and again on every theme-accent change, and bind none of them.
const windowTexture = useMemo(
- () => createWindowTexture(accentColor, width, height, seed, tintStructure),
- [accentColor, width, height, seed, tintStructure]
+ () => (daytime ? null : createWindowTexture(accentColor, width, height, seed, tintStructure)),
+ [daytime, accentColor, width, height, seed, tintStructure]
);
// R3F does NOT dispose a CanvasTexture handed in via `map`/`emissiveMap` — it
// only frees objects it owns on unmount. Since the city no longer remounts on
// theme switch (issue-1064), each recolor recreates this texture and would
// strand the previous one in VRAM per building. Dispose it on replace + unmount.
- useEffect(() => () => windowTexture.dispose(), [windowTexture]);
+ useEffect(() => () => windowTexture?.dispose(), [windowTexture]);
// Format name for building face
const displayName = useMemo(() => {
@@ -561,10 +567,11 @@ export default function Building({ app, position, agentCount, onClick, playSfx,
color={daytime ? bodyColor : '#ffffff'}
emissive={edgeColor}
emissiveIntensity={0.7 * neonBrightness * dimMul * (1 - dayMix * 0.88)}
- map={daytime ? undefined : windowTexture}
- emissiveMap={daytime ? undefined : windowTexture}
+ map={windowTexture || undefined}
+ emissiveMap={windowTexture || undefined}
roughness={daytime ? 0.9 : 0.78}
metalness={daytime ? 0.05 : 0.08}
+ {...surface}
transparent
opacity={(app.archived ? 0.78 : 1) * dimMul}
/>
diff --git a/client/src/components/city/CityFocusCamera.jsx b/client/src/components/city/CityFocusCamera.jsx
index f4a54850e8..1af2958188 100644
--- a/client/src/components/city/CityFocusCamera.jsx
+++ b/client/src/components/city/CityFocusCamera.jsx
@@ -1,12 +1,17 @@
-import { useRef, useEffect } from 'react';
+import { useRef, useEffect, useMemo } from 'react';
import { useThree, useFrame } from '@react-three/fiber';
import * as THREE from 'three';
import { smoothstep } from '../../utils/easing';
-import { computeFocusCamera } from '../../utils/cityFocusCamera';
+import { computeFocusCamera, computeRegionCamera } from '../../utils/cityFocusCamera';
-// In-canvas camera controller for CyberCity's building focus mode (issue #2593). When the
-// `/city/apps/:appId` route resolves to a placed building, it flies the orbital camera (and the
-// OrbitControls target) to frame that borough; when focus clears it flies back to the overview.
+// In-canvas camera controller for OpenWorld's two URL-addressed camera targets: a single
+// building (`/openworld/apps/:appId`, issue #2593) and a whole fast-travel region
+// (`/openworld/region/:regionId`). Either one flies the orbital camera (and the OrbitControls
+// target) to frame its subject; when both clear, it flies back to the overview.
+//
+// A building focus wins over a region when both are somehow set — the two live on separate
+// routes, so that only happens transiently mid-navigation, and framing the tighter subject is
+// the less jarring resolution.
//
// Staleness / unmount safety: all motion runs inside useFrame, which is inherently frame-gated —
// there is NO setTimeout, so a stale deferred emit is impossible. Retargeting to a newly-selected
@@ -25,11 +30,17 @@ const deriveLookAt = (camera) => {
return camera.position.clone().add(dir.multiplyScalar(10));
};
-export default function CityFocusCamera({ focusedAppId, positions, orbitRef, active = true, hudSafe }) {
+export default function CityFocusCamera({ focusedAppId, focusedRegion, positions, orbitRef, active = true, hudSafe }) {
const { camera, size } = useThree();
- // `null` = overview (no fly needed on a plain /city mount). A transition into/out of focus flips
+ // `null` = overview (no fly needed on a plain /openworld mount). A transition into/out of focus flips
// this and starts a fly.
const currentKeyRef = useRef(null);
+ // The region fly's identity, built once per target change rather than inside useFrame —
+ // the live loop runs ~60×/s and must not allocate a string per frame.
+ const regionKey = useMemo(
+ () => (focusedRegion?.anchor ? `region:${focusedRegion.id}` : null),
+ [focusedRegion?.anchor, focusedRegion?.id],
+ );
const animRef = useRef(null);
const controlsWasEnabledRef = useRef(true);
@@ -46,7 +57,9 @@ export default function CityFocusCamera({ focusedAppId, positions, orbitRef, act
const pos = wantFocus ? positions?.get?.(focusedAppId) : null;
// Focus wanted but the layout position isn't ready yet → hold and retry next frame.
if (wantFocus && !pos) return;
- const key = wantFocus ? focusedAppId : null;
+ // Regions come straight from the static plan, so there is no equivalent wait.
+ const wantRegion = !wantFocus && active && regionKey !== null;
+ const key = wantFocus ? focusedAppId : wantRegion ? regionKey : null;
if (key !== currentKeyRef.current) {
currentKeyRef.current = key;
@@ -64,7 +77,9 @@ export default function CityFocusCamera({ focusedAppId, positions, orbitRef, act
} else {
const aspect = size.height > 0 ? size.width / size.height : 1;
const fovDeg = camera.isPerspectiveCamera ? camera.fov : undefined;
- const framed = computeFocusCamera({ building: pos, aspect, fovDeg, hudSafe });
+ const framed = wantFocus
+ ? computeFocusCamera({ building: pos, aspect, fovDeg, hudSafe })
+ : computeRegionCamera({ region: focusedRegion, aspect, fovDeg, hudSafe });
endPos = new THREE.Vector3(...framed.position);
endTarget = new THREE.Vector3(...framed.target);
}
diff --git a/client/src/components/city/CityHud.jsx b/client/src/components/city/CityHud.jsx
index 5d9f8be151..f133675108 100644
--- a/client/src/components/city/CityHud.jsx
+++ b/client/src/components/city/CityHud.jsx
@@ -48,6 +48,7 @@ function ControlsHint({ visible }) {
<div>WASD: MOVE · Q/E: DOWN/UP</div>
<div>SHIFT: SPRINT</div>
<div>F: INTERACT WITH BUILDING</div>
+ <div>M: FAST TRAVEL</div>
<div>TAB: FLY OUT</div>
</div>
</div>
@@ -69,7 +70,7 @@ function Crosshair() {
);
}
-export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, connected, apps, reviewCounts, instances, productivityData, systemHealth, notificationCounts, character, filter, onFilterChange, onJumpToFirst, matchCount, onToggleExploration, explorationMode, onSelectApp, onEnterPhotoMode, onEnterPlayback, focusedAppId, focusedApp, focusNotFound, focusAgents, onCloseFocus, onOpenApp }) {
+export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, connected, apps, reviewCounts, instances, productivityData, systemHealth, notificationCounts, character, filter, onFilterChange, onJumpToFirst, matchCount, onToggleExploration, explorationMode, onSelectApp, onEnterPhotoMode, onEnterPlayback, focusedAppId, focusedApp, focusNotFound, focusAgents, onCloseFocus, onOpenApp, onOpenFastTravel, activeRegion }) {
const isFocused = Boolean(focusedApp || focusNotFound);
const navigate = useNavigate();
const location = useLocation();
@@ -267,6 +268,24 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, con
</div>
</div>
+ {/* Fast travel (M) — warp to any named region of the world */}
+ {onOpenFastTravel && (
+ <button
+ onClick={onOpenFastTravel}
+ className="pointer-events-auto mb-2 relative bg-black/85 backdrop-blur-sm border border-cyan-500/30 rounded-lg px-3 py-2 hover:border-cyan-400/60 hover:bg-cyan-500/10 transition-all w-full"
+ title="Fast travel to a region (M)"
+ >
+ <HudCorner position="tl" />
+ <HudCorner position="br" />
+ <div className="font-pixel text-[10px] text-cyan-400 tracking-wider truncate" style={{ textShadow: '0 0 6px rgba(6,182,212,0.4)' }}>
+ [ FAST TRAVEL ]
+ </div>
+ <div className="font-pixel text-[7px] text-cyan-500/40 tracking-wide mt-0.5 text-center truncate">
+ {activeRegion ? activeRegion.label.toUpperCase() : '(M)'}
+ </div>
+ </button>
+ )}
+
{/* Drop In / Fly Out button */}
<button
onClick={onToggleExploration}
@@ -319,10 +338,10 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, con
)}
<button
- onClick={() => navigate(location.pathname === '/city/settings' ? `/city${location.search}` : `/city/settings${location.search}`)}
+ onClick={() => navigate(location.pathname === '/openworld/settings' ? `/openworld${location.search}` : `/openworld/settings${location.search}`)}
className="pointer-events-auto mb-2 relative bg-black/85 backdrop-blur-sm border border-cyan-500/30 rounded-lg w-10 h-10 flex items-center justify-center hover:border-cyan-400/60 hover:bg-cyan-500/10 transition-all group"
title="Settings"
- aria-label="City settings"
+ aria-label="OpenWorld settings"
>
<HudCorner position="tl" />
<HudCorner position="br" />
@@ -369,6 +388,7 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, con
focusAgents={focusAgents}
onCloseFocus={onCloseFocus}
onOpenApp={onOpenApp}
+ onOpenFastTravel={onOpenFastTravel}
/>
)}
diff --git a/client/src/components/city/CityHudCompact.jsx b/client/src/components/city/CityHudCompact.jsx
index 3826725b3f..f5b4136188 100644
--- a/client/src/components/city/CityHudCompact.jsx
+++ b/client/src/components/city/CityHudCompact.jsx
@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import { useNavigate, useLocation } from 'react-router';
-import { Gauge, Bell, Clock, Activity, Map as MapIcon, Filter, Palette, Compass, Camera, History, Settings, X } from 'lucide-react';
+import { Gauge, Bell, Clock, Activity, Map as MapIcon, Filter, Palette, Compass, Camera, History, Settings, Navigation, X } from 'lucide-react';
import useDrawerTab from '../../hooks/useDrawerTab';
import { buildAttentionItems, CityIntelContent } from './CityIntelPane';
import CityVitalsList from './CityVitalsList';
@@ -84,6 +84,7 @@ export default function CityHudCompact({
onSelectApp,
onEnterPhotoMode,
onEnterPlayback,
+ onOpenFastTravel,
focusedAppId,
focusedApp,
focusNotFound,
@@ -108,8 +109,8 @@ export default function CityHudCompact({
// set a date they already entered (#2757). Null when a real level exists.
const birthCta = character && character.level == null ? birthDateCta(character.birthDateStatus) : null;
- const onSettings = location.pathname === '/city/settings';
- const goSettings = () => navigate(onSettings ? `/city${location.search}` : `/city/settings${location.search}`);
+ const onSettings = location.pathname === '/openworld/settings';
+ const goSettings = () => navigate(onSettings ? `/openworld${location.search}` : `/openworld/settings${location.search}`);
const renderPaneBody = () => {
if (CITY_INTEL_PANE_IDS.includes(activePane)) {
@@ -269,9 +270,10 @@ export default function CityHudCompact({
active={explorationMode}
onClick={onToggleExploration}
/>
+ {onOpenFastTravel && <DockButton icon={Navigation} label="Fast travel" onClick={onOpenFastTravel} />}
{onEnterPhotoMode && <DockButton icon={Camera} label="Photo mode" onClick={onEnterPhotoMode} />}
{onEnterPlayback && <DockButton icon={History} label="History playback" onClick={onEnterPlayback} />}
- <DockButton icon={Settings} label="City settings" active={onSettings} onClick={goSettings} />
+ <DockButton icon={Settings} label="OpenWorld settings" active={onSettings} onClick={goSettings} />
</div>
</div>
</>
diff --git a/client/src/components/city/CityHudCompact.test.jsx b/client/src/components/city/CityHudCompact.test.jsx
index 6a9e651bcb..6c216ee376 100644
--- a/client/src/components/city/CityHudCompact.test.jsx
+++ b/client/src/components/city/CityHudCompact.test.jsx
@@ -54,7 +54,7 @@ const baseProps = {
const renderCompact = (search = '', props = {}) =>
render(
- <MemoryRouter initialEntries={[`/city${search}`]}>
+ <MemoryRouter initialEntries={[`/openworld${search}`]}>
<CityHudCompact {...baseProps} {...props} />
<Loc />
</MemoryRouter>,
diff --git a/client/src/components/city/CityLandscape.jsx b/client/src/components/city/CityLandscape.jsx
index 7cd104a64e..331af2caf1 100644
--- a/client/src/components/city/CityLandscape.jsx
+++ b/client/src/components/city/CityLandscape.jsx
@@ -62,14 +62,17 @@ const TERRAIN_FRAG = `
}
`;
-function TerrainPlane({ dayMix, accent }) {
+function TerrainPlane({ dayMix, accent, terrain }) {
const material = useMemo(() => new THREE.ShaderMaterial({
vertexShader: TERRAIN_VERT,
fragmentShader: TERRAIN_FRAG,
uniforms: {
- uInner: { value: new THREE.Color(mixHex('#202426', '#686d68', dayMix)) },
- uMeadow: { value: new THREE.Color(mixHex('#172719', '#6f8758', dayMix)) },
- uRidge: { value: new THREE.Color(mixHex('#111827', '#8d937f', dayMix)) },
+ // Night bands are shared; the daytime bands come from the active world style's
+ // terrain trio (WORLD_STYLE_DEFS in cityConstants), so retuning a style's ground
+ // doesn't mean grepping raw hexes across two files.
+ uInner: { value: new THREE.Color(mixHex('#202426', terrain.inner, dayMix)) },
+ uMeadow: { value: new THREE.Color(mixHex('#172719', terrain.meadow, dayMix)) },
+ uRidge: { value: new THREE.Color(mixHex('#111827', terrain.ridge, dayMix)) },
uAccent: { value: new THREE.Color(accent) },
uDayMix: { value: dayMix },
},
@@ -78,7 +81,7 @@ function TerrainPlane({ dayMix, accent }) {
// accent intentionally NOT a dep — a theme switch updates the uniform in
// place (effect below) rather than recompiling the GLSL program. Matches the
// imperative-uniform pattern in CitySky / CityBillboards / CityVolumetricLights.
- }), [dayMix]);
+ }), [dayMix, terrain]);
// Push the accent into the existing material on theme change — no rebuild.
useEffect(() => { material.uniforms.uAccent.value.set(accent); }, [material, accent]);
@@ -99,7 +102,7 @@ function TerrainPlane({ dayMix, accent }) {
);
}
-function Mountain({ mountain, dayMix }) {
+function Mountain({ mountain, dayMix, surface }) {
const geometry = useMemo(() => {
const geom = new THREE.ConeGeometry(mountain.radius, mountain.height, mountain.sides, 6);
const position = geom.getAttribute('position');
@@ -136,6 +139,7 @@ function Mountain({ mountain, dayMix }) {
roughness={0.92}
metalness={0}
depthWrite
+ {...surface}
/>
</mesh>
</group>
@@ -143,7 +147,7 @@ function Mountain({ mountain, dayMix }) {
}
export default function CityLandscape({ settings }) {
- const { accent } = useCityPalette();
+ const { accent, terrain, surface } = useCityPalette();
const dayMix = cityDayMix(settings);
const mountains = useMemo(() => {
@@ -174,10 +178,10 @@ export default function CityLandscape({ settings }) {
return (
<group>
- <TerrainPlane dayMix={dayMix} accent={accent} />
+ <TerrainPlane dayMix={dayMix} accent={accent} terrain={terrain} />
<group>
{mountains.map((mountain) => (
- <Mountain key={mountain.id} mountain={mountain} dayMix={dayMix} />
+ <Mountain key={mountain.id} mountain={mountain} dayMix={dayMix} surface={surface} />
))}
</group>
</group>
diff --git a/client/src/components/city/CityScene.jsx b/client/src/components/city/CityScene.jsx
index 7665faa344..97648e0e77 100644
--- a/client/src/components/city/CityScene.jsx
+++ b/client/src/components/city/CityScene.jsx
@@ -49,14 +49,14 @@ import CityFocusCamera from './CityFocusCamera';
import CityPhotoCamera from './CityPhotoCamera';
import CityDepthOfField from './CityDepthOfField';
import CityAdaptiveQuality from './CityAdaptiveQuality';
-import { cityDayMix } from './cityConstants';
+import { cityDayMix, getTimeOfDayPreset } from './cityConstants';
import { CityPaletteProvider } from './CityPaletteContext';
import ErrorBoundary from '../ErrorBoundary';
import { useVisibilityEvent } from '../../hooks/useVisibilityEvent';
const STARTUP_PARTICLE_DENSITY = 0.49;
-export default function CityScene({ apps, agentMap, onBuildingClick, onToggleCameraView, cosStatus, reviewCounts, instances, backupStatus, cosTasks, healthMetrics, voiceState, aiActivity, productivityData, activityCalendar, goals, character, chronotype, memoryGraph, inboxDepth, jiraTickets, introspection, playback = false, photoMode, photoPresetId, photoDof, onPhotoCaptureReady, settings, playSfx, keysRef, dimmedAppIds, focusedAppId, hudSafe, background, palette, autoQuality = false, autoStartTier = 'high', autoResetToken = 0, diagnosticsEnabled = false, onAutoTierChange, onAutoDiagnostics }) {
+export default function CityScene({ apps, agentMap, onBuildingClick, onToggleCameraView, cosStatus, reviewCounts, instances, backupStatus, cosTasks, healthMetrics, voiceState, aiActivity, productivityData, activityCalendar, goals, character, chronotype, memoryGraph, inboxDepth, jiraTickets, introspection, playback = false, photoMode, photoPresetId, photoDof, onPhotoCaptureReady, settings, playSfx, keysRef, dimmedAppIds, focusedAppId, focusedRegion, playerTeleport, hudSafe, background, palette, autoQuality = false, autoStartTier = 'high', autoResetToken = 0, diagnosticsEnabled = false, onAutoTierChange, onAutoDiagnostics }) {
const [positions, setPositions] = useState(null);
const [proximityApp, setProximityApp] = useState(null);
const [transitioning, setTransitioning] = useState(false);
@@ -89,6 +89,13 @@ export default function CityScene({ apps, agentMap, onBuildingClick, onToggleCam
const photoComposerRef = useRef(null);
const explorationMode = settings?.explorationMode || false;
+ // Art direction gate, read off the palette every other themed surface already consumes
+ // (Building, ProcessBuilding, CityLandscape) rather than re-resolving the style from
+ // settings — one bit, one channel. The neon-night layers below (galaxy spheremap,
+ // starfield/shooting stars, data rain, embers, volumetric light cones, neon signage)
+ // belong to the CyberCity style; over the Vibes world's sunlit low-poly landscape they
+ // read as haze and grain, so they don't mount at all rather than fading per-frame.
+ const neonLayers = Boolean(palette?.neonLayers);
useEffect(() => {
if (photoMode) {
@@ -174,8 +181,12 @@ export default function CityScene({ apps, agentMap, onBuildingClick, onToggleCam
const dpr = rawDpr.map(value => Math.min(value, dprLimit));
const showGradientBackground = cityDayMix(renderSettings) > 0.5;
const sceneClearColor = background || '#030308';
+ // The pre-canvas / WebGL-lost backdrop. Under CyberCity's daylight it's the blue sky
+ // gradient; under the Vibes style the sky is warm at the horizon, so it takes its bands
+ // from the resolved scene color rather than the hardcoded cyber gradient.
+ const skyPreset = getTimeOfDayPreset(renderSettings?.timeOfDay ?? 'sunset');
const fallbackBackground = showGradientBackground
- ? 'linear-gradient(180deg, #0f4f9a 0%, #1e78bf 48%, #58a9dc 100%)'
+ ? `linear-gradient(180deg, ${skyPreset.zenith} 0%, ${skyPreset.midSky} 48%, ${skyPreset.horizonLow} 100%)`
: sceneClearColor;
const handleCanvasCreated = useCallback(({ gl }) => {
@@ -237,22 +248,23 @@ export default function CityScene({ apps, agentMap, onBuildingClick, onToggleCam
own reconciler, so the provider in CyberCityInner doesn't reach these scene
components. Plain React Context.Provider works across the r3f tree. */}
<CityPaletteProvider palette={palette}>
- {/* By day, the solid clear color is the scene background. At night, the galaxy
- Environment below owns scene.background (the equirectangular spheremap), so we
- must NOT also drive <color attach="background"> — both write scene.background and
- would fight every frame. */}
- {showGradientBackground && <color attach="background" args={[sceneClearColor]} />}
- {/* Mount the galaxy environment only at night — keeps its 2.8MB panorama from being
- fetched/decoded (and PMREM-processed) in full daylight, where it's faded out
- anyway. Suspense keeps the texture load from suspending the whole canvas while it
- streams in; the error boundary degrades to the plain dark sky if the texture is
+ {/* Exactly one owner for scene.background, written as a ternary so the invariant is
+ structural rather than two conditions a reader has to De Morgan: the galaxy
+ Environment (the equirectangular spheremap) and a solid <color attach="background">
+ both write scene.background and would fight every frame. The galaxy mounts only for
+ the neon-night style at night — which also keeps its 2.8MB panorama from being
+ fetched/decoded (and PMREM-processed) in daylight, where it's faded out anyway.
+ Suspense keeps the texture load from suspending the whole canvas while it streams
+ in; the error boundary degrades to the plain solid sky if the texture is
missing/corrupt (e.g. a partial checkout) instead of crashing. */}
- {!showGradientBackground && (
+ {neonLayers && !showGradientBackground ? (
<ErrorBoundary fallback={null}>
<Suspense fallback={null}>
<CityGalaxySky settings={renderSettings} />
</Suspense>
</ErrorBoundary>
+ ) : (
+ <color attach="background" args={[sceneClearColor]} />
)}
<CitySky settings={renderSettings} />
{/* `lightingTier` is the SETTLED tier, deliberately not the warm-up-clamped
@@ -263,8 +275,8 @@ export default function CityScene({ apps, agentMap, onBuildingClick, onToggleCam
<CityLandscape settings={renderSettings} />
<CityWater settings={renderSettings} />
<CityEnergyOverlay chronotype={chronotype} settings={renderSettings} />
- <CityStarfield settings={renderSettings} />
- <CityShootingStars playSfx={playSfx} settings={renderSettings} />
+ {neonLayers && <CityStarfield settings={renderSettings} />}
+ {neonLayers && <CityShootingStars playSfx={playSfx} settings={renderSettings} />}
{!explorationMode && <CityCelestial settings={renderSettings} />}
<CitySkyline settings={renderSettings} />
<CityFederationHorizon instances={instances} settings={renderSettings} />
@@ -311,11 +323,11 @@ export default function CityScene({ apps, agentMap, onBuildingClick, onToggleCam
productivityData={productivityData}
/>
<CitySignalBeacons positions={positions} reviewCounts={reviewCounts} instances={instances} settings={renderSettings} />
- <CityVolumetricLights positions={positions} settings={renderSettings} />
- <CityNeonSigns positions={positions} />
+ {neonLayers && <CityVolumetricLights positions={positions} settings={renderSettings} />}
+ {neonLayers && <CityNeonSigns positions={positions} />}
<CityWeather stoppedCount={stoppedCount} totalCount={totalCount} playSfx={playSfx} />
- <CityDataRain settings={renderSettings} />
- <CityEmbers settings={renderSettings} />
+ {neonLayers && <CityDataRain settings={renderSettings} />}
+ {neonLayers && <CityEmbers settings={renderSettings} />}
<CityParticles settings={renderSettings} />
{explorationMode && (
<PlayerController
@@ -328,6 +340,7 @@ export default function CityScene({ apps, agentMap, onBuildingClick, onToggleCam
active={explorationMode}
transitioning={transitioning}
cameraView={settings?.cameraView ?? 'third'}
+ teleport={playerTeleport}
/>
)}
{!explorationMode && !transitioning && !photoMode && (
@@ -375,6 +388,7 @@ export default function CityScene({ apps, agentMap, onBuildingClick, onToggleCam
{!explorationMode && !photoMode && (
<CityFocusCamera
focusedAppId={focusedAppId}
+ focusedRegion={focusedRegion}
positions={positions}
orbitRef={orbitRef}
active={!explorationMode && !photoMode}
diff --git a/client/src/components/city/CitySettingsDrawer.jsx b/client/src/components/city/CitySettingsDrawer.jsx
index b2c48c0b54..6ac188cc8b 100644
--- a/client/src/components/city/CitySettingsDrawer.jsx
+++ b/client/src/components/city/CitySettingsDrawer.jsx
@@ -3,6 +3,10 @@ import useDrawerTab from '../../hooks/useDrawerTab';
import { useCitySettingsContext } from './CitySettingsContext';
import { QUALITY_PRESETS } from '../../hooks/useCitySettings';
import { SOUNDSCAPE_MOODS, isSoundscapeMood } from '../../utils/citySoundscape';
+import { WORLD_STYLE_DEFS, WORLD_STYLES, resolveWorldStyle } from './cityConstants';
+
+// Derived from the style table, so registering a style makes it pickable — no second list.
+const WORLD_STYLE_OPTIONS = WORLD_STYLES.map((key) => ({ key, label: WORLD_STYLE_DEFS[key].label }));
// The soundscape override's "no override" option. A `<select>` can't carry `null`, so the
// auto choice rides as the empty string and the change handler maps it back to the `null`
@@ -338,6 +342,13 @@ export default function CitySettingsDrawer({ open, onClose, qualityMode = 'manua
format={(v) => `${v.toFixed(1)}x`}
description="Brightness of neon lights and building glow"
/>
+ <SettingSegment
+ label="WORLD STYLE"
+ options={WORLD_STYLE_OPTIONS}
+ value={resolveWorldStyle(settings.worldStyle)}
+ onChange={(key) => updateSetting('worldStyle', key)}
+ hint="OPEN WORLD IS THE BRIGHT LOW-POLY LOOK; CYBER CITY IS THE NEON NIGHT"
+ />
<SettingSegment
label="TIME OF DAY"
options={[
diff --git a/client/src/components/city/CitySettingsDrawer.test.jsx b/client/src/components/city/CitySettingsDrawer.test.jsx
index 7a280d199d..d16ab7fb29 100644
--- a/client/src/components/city/CitySettingsDrawer.test.jsx
+++ b/client/src/components/city/CitySettingsDrawer.test.jsx
@@ -11,7 +11,7 @@ function Loc() {
const renderDrawer = (search = '', onClose = () => {}) =>
render(
- <MemoryRouter initialEntries={[`/city/settings${search}`]}>
+ <MemoryRouter initialEntries={[`/openworld/settings${search}`]}>
<CitySettingsProvider>
<CitySettingsDrawer open onClose={onClose} />
</CitySettingsProvider>
@@ -40,7 +40,7 @@ describe('CitySettingsDrawer', () => {
it('shows the Auto effective-tier label and local diagnostics when in Auto mode', () => {
render(
- <MemoryRouter initialEntries={['/city/settings']}>
+ <MemoryRouter initialEntries={['/openworld/settings']}>
<CitySettingsProvider>
<CitySettingsDrawer
open
@@ -97,7 +97,7 @@ describe('CitySettingsDrawer', () => {
it('renders nothing when closed', () => {
const { container } = render(
- <MemoryRouter initialEntries={['/city']}>
+ <MemoryRouter initialEntries={['/openworld']}>
<CitySettingsProvider>
<CitySettingsDrawer open={false} onClose={() => {}} />
</CitySettingsProvider>
diff --git a/client/src/components/city/CityXpBadge.test.jsx b/client/src/components/city/CityXpBadge.test.jsx
index d31a66497b..3e19820a9a 100644
--- a/client/src/components/city/CityXpBadge.test.jsx
+++ b/client/src/components/city/CityXpBadge.test.jsx
@@ -5,7 +5,7 @@ import CityXpBadge from './CityXpBadge';
const renderBadge = (character) =>
render(
- <MemoryRouter initialEntries={['/city']}>
+ <MemoryRouter initialEntries={['/openworld']}>
<CityXpBadge character={character} />
</MemoryRouter>,
);
diff --git a/client/src/components/city/OpenWorldFastTravel.jsx b/client/src/components/city/OpenWorldFastTravel.jsx
new file mode 100644
index 0000000000..f2a4b5d4cd
--- /dev/null
+++ b/client/src/components/city/OpenWorldFastTravel.jsx
@@ -0,0 +1,175 @@
+import { useEffect, useMemo, useRef, useState } from 'react';
+import Modal from '../ui/Modal';
+import { MINI_MAP_PADDING, projectGeography, projectPoint } from '../../utils/cityMiniMap';
+import { listRegions, searchRegions } from '../../utils/openWorldRegions';
+import { WORLD } from '../../utils/cityPlan';
+
+// OpenWorld's fast-travel panel — the thing that makes this an open world rather than one
+// city you pan around. Every named region is a warp destination: pick one and the camera
+// (or, in exploration mode, the player) travels there, and each region carries a door into
+// the 2D PortOS page it visualizes.
+//
+// Selection is NOT held here. Clicking a region navigates to `/openworld/region/:regionId`
+// and the route param drives the camera — the same URL-is-the-source-of-truth rule building
+// focus follows, so a warp is shareable, bookmarkable, and reachable from ⌘K and voice.
+//
+// The dialog chrome (backdrop, Esc, click-outside, focus trap, and the module-scope Esc
+// stack that keeps layered dialogs from both closing on one keystroke) comes from the shared
+// <Modal> primitive — the same one CityPhotoOverlay's postcard uses. Portaled, which is safe
+// here because every class this panel wears (`port-media-overlay*`) is global rather than
+// scoped under `.cybercity-themed`.
+
+// The map plate's world extent: the whole playable square, so a region's marker sits where
+// the district actually is rather than being normalized against a shifting building cloud.
+const MAP_BOUNDS = {
+ minX: -WORLD.landHalf - 8,
+ maxX: WORLD.landHalf + 8,
+ minZ: WORLD.shorelineZ - 20,
+ maxZ: WORLD.landHalf + 8,
+};
+
+// Waterfront on the plate, read from the same projector the mini-map uses so the two can't
+// disagree about where the bay starts.
+const GEOGRAPHY = projectGeography(MAP_BOUNDS, MINI_MAP_PADDING);
+
+export default function OpenWorldFastTravel({ open, onClose, onTravel, activeRegionId, onOpenPage, onLeaveRegion }) {
+ const [query, setQuery] = useState('');
+ const inputRef = useRef(null);
+
+ const regions = useMemo(() => listRegions(), []);
+ const matches = useMemo(() => searchRegions(query), [query]);
+ const matchIds = useMemo(() => new Set(matches.map((r) => r.id)), [matches]);
+
+ // Reopening always starts from the full list — a stale filter from the last visit would
+ // read as "half my world is missing".
+ useEffect(() => {
+ if (!open) return undefined;
+ setQuery('');
+ const raf = requestAnimationFrame(() => inputRef.current?.focus());
+ return () => cancelAnimationFrame(raf);
+ }, [open]);
+
+ // Modal renders null while closed, but only AFTER the caller has built the children
+ // tree. This page re-renders on every socket event, so return early and skip ~60
+ // discarded elements (and 14 projections) per event while the panel is shut.
+ if (!open) return null;
+
+ const travel = (region) => {
+ onTravel?.(region);
+ onClose?.();
+ };
+
+ return (
+ <Modal
+ open={open}
+ onClose={onClose}
+ size="none"
+ usePortal
+ ariaLabel="Fast travel"
+ panelClassName="w-full max-w-3xl max-h-[85vh] rounded-xl border port-media-overlay flex flex-col overflow-hidden"
+ >
+ <div className="flex items-center gap-3 px-4 py-3 border-b border-current/10">
+ <div className="font-pixel text-[12px] tracking-widest">FAST TRAVEL</div>
+ <input
+ ref={inputRef}
+ type="text"
+ value={query}
+ onChange={(e) => setQuery(e.target.value)}
+ placeholder="Search regions…"
+ aria-label="Search regions"
+ className="flex-1 min-w-0 font-pixel text-[11px] px-2 py-1.5 rounded border border-current/20 bg-transparent focus:outline-none focus:border-current/50"
+ />
+ {/* The only way back out of a region to the whole-world overview — without it a
+ warp is a one-way trip until you pick another region. */}
+ {activeRegionId && onLeaveRegion && (
+ <button
+ type="button"
+ onClick={() => { onLeaveRegion(); onClose?.(); }}
+ className="port-media-overlay-item shrink-0 font-pixel text-[10px] px-2 py-1.5 rounded border border-current/20 tracking-wide"
+ >
+ OVERVIEW
+ </button>
+ )}
+ <button
+ type="button"
+ onClick={onClose}
+ className="port-media-overlay-item font-pixel text-[10px] px-2 py-1.5 rounded border border-current/20"
+ >
+ ESC
+ </button>
+ </div>
+
+ <div className="flex-1 min-h-0 grid grid-cols-1 md:grid-cols-[220px_1fr] gap-3 p-3 overflow-hidden">
+ {/* World plate — regions in their real plan positions, so the list and the map
+ can't disagree about where a place is. Hidden on phones where it would be
+ too small to aim at; the list below is the full-capability control. */}
+ <div className="hidden md:block relative aspect-square rounded-lg border border-current/15 overflow-hidden">
+ <div className="absolute inset-0 bg-current/5" />
+ {GEOGRAPHY && (
+ <div
+ className="absolute inset-x-0 top-0 bg-current/10"
+ style={{ height: `${GEOGRAPHY.shorelineY * 100}%` }}
+ aria-hidden="true"
+ />
+ )}
+ {regions.map((region) => {
+ const { nx, ny } = projectPoint({ x: region.anchor[0], z: region.anchor[2] }, MAP_BOUNDS, MINI_MAP_PADDING);
+ const isActive = region.id === activeRegionId;
+ const isMatch = matchIds.has(region.id);
+ return (
+ <button
+ key={region.id}
+ type="button"
+ title={region.label}
+ aria-label={`Travel to ${region.label}`}
+ onClick={() => travel(region)}
+ className={`absolute -translate-x-1/2 -translate-y-1/2 rounded-full border transition-all ${
+ isActive
+ ? 'w-3.5 h-3.5 border-current bg-current'
+ : isMatch
+ ? 'w-2.5 h-2.5 border-current/70 bg-current/50 hover:w-3.5 hover:h-3.5'
+ : 'w-2 h-2 border-current/20 bg-current/10'
+ }`}
+ style={{ left: `${nx * 100}%`, top: `${ny * 100}%` }}
+ />
+ );
+ })}
+ </div>
+
+ <ul className="min-h-0 overflow-y-auto space-y-1.5 pr-1">
+ {matches.length === 0 && (
+ <li className="font-pixel text-[10px] opacity-60 px-2 py-3">NO REGION MATCHES “{query}”</li>
+ )}
+ {matches.map((region) => (
+ <li key={region.id}>
+ <div
+ className={`flex items-center gap-2 rounded-lg border px-2.5 py-2 ${
+ region.id === activeRegionId ? 'border-current/60 bg-current/10' : 'border-current/15'
+ }`}
+ >
+ <button
+ type="button"
+ onClick={() => travel(region)}
+ className="flex-1 min-w-0 text-left"
+ >
+ <div className="font-pixel text-[11px] tracking-wide truncate">{region.label}</div>
+ <div className="text-[11px] opacity-70 truncate">{region.blurb}</div>
+ </button>
+ {region.appPath && onOpenPage && (
+ <button
+ type="button"
+ onClick={() => onOpenPage(region.appPath)}
+ title={`Open ${region.appPath}`}
+ className="port-media-overlay-item shrink-0 font-pixel text-[9px] px-2 py-2 rounded border border-current/20 tracking-wide"
+ >
+ OPEN
+ </button>
+ )}
+ </div>
+ </li>
+ ))}
+ </ul>
+ </div>
+ </Modal>
+ );
+}
diff --git a/client/src/components/city/OpenWorldFastTravel.test.jsx b/client/src/components/city/OpenWorldFastTravel.test.jsx
new file mode 100644
index 0000000000..11bf9c7404
--- /dev/null
+++ b/client/src/components/city/OpenWorldFastTravel.test.jsx
@@ -0,0 +1,127 @@
+import { describe, it, expect, vi } from 'vitest';
+import { render, screen, fireEvent, within } from '@testing-library/react';
+import OpenWorldFastTravel from './OpenWorldFastTravel';
+import { OPEN_WORLD_REGIONS } from '../../utils/openWorldRegions';
+
+const renderPanel = (props = {}) => render(
+ <OpenWorldFastTravel
+ open
+ onClose={vi.fn()}
+ onTravel={vi.fn()}
+ onOpenPage={vi.fn()}
+ activeRegionId={null}
+ onLeaveRegion={vi.fn()}
+ {...props}
+ />
+);
+
+describe('OpenWorldFastTravel', () => {
+ it('renders nothing when closed', () => {
+ const { container } = render(<OpenWorldFastTravel open={false} />);
+ expect(container).toBeEmptyDOMElement();
+ });
+
+ it('lists every region when open', () => {
+ renderPanel();
+ const list = screen.getByRole('list');
+ for (const region of OPEN_WORLD_REGIONS) {
+ expect(within(list).getByText(region.label)).toBeInTheDocument();
+ }
+ });
+
+ it('warps and closes when a region is picked', () => {
+ const onTravel = vi.fn();
+ const onClose = vi.fn();
+ renderPanel({ onTravel, onClose });
+
+ fireEvent.click(screen.getByRole('list').querySelector('button'));
+
+ expect(onTravel).toHaveBeenCalledTimes(1);
+ expect(onTravel.mock.calls[0][0].id).toBe(OPEN_WORLD_REGIONS[0].id);
+ // Warping dismisses the panel so the camera flight isn't hidden behind it.
+ expect(onClose).toHaveBeenCalled();
+ });
+
+ it('filters the list by the search box', () => {
+ renderPanel();
+ fireEvent.change(screen.getByLabelText('Search regions'), { target: { value: 'memory' } });
+
+ const list = screen.getByRole('list');
+ expect(within(list).getByText('Memory Quarter')).toBeInTheDocument();
+ expect(within(list).queryByText('Data Harbor')).not.toBeInTheDocument();
+ });
+
+ it('reports an empty result rather than an empty panel', () => {
+ renderPanel();
+ fireEvent.change(screen.getByLabelText('Search regions'), { target: { value: 'zzzz' } });
+ expect(screen.getByText(/NO REGION MATCHES/)).toBeInTheDocument();
+ });
+
+ it('opens the PortOS page a region stands for without warping', () => {
+ const onOpenPage = vi.fn();
+ const onTravel = vi.fn();
+ renderPanel({ onOpenPage, onTravel });
+
+ fireEvent.change(screen.getByLabelText('Search regions'), { target: { value: 'memory' } });
+ fireEvent.click(screen.getByTitle('Open /brain/inbox'));
+
+ expect(onOpenPage).toHaveBeenCalledWith('/brain/inbox');
+ expect(onTravel).not.toHaveBeenCalled();
+ });
+
+ it('omits the OPEN affordance for a region with no page behind it', () => {
+ renderPanel();
+ fireEvent.change(screen.getByLabelText('Search regions'), { target: { value: 'quiet corner' } });
+ const list = screen.getByRole('list');
+ expect(within(list).getByText('Quiet Corner')).toBeInTheDocument();
+ expect(within(list).queryByText('OPEN')).not.toBeInTheDocument();
+ });
+
+ it('offers a way back to the overview only while a region is active', () => {
+ const onLeaveRegion = vi.fn();
+ const onClose = vi.fn();
+ const { rerender } = renderPanel({ onLeaveRegion, onClose });
+ // No region warped to → nothing to leave.
+ expect(screen.queryByText('OVERVIEW')).not.toBeInTheDocument();
+
+ rerender(
+ <OpenWorldFastTravel
+ open
+ onClose={onClose}
+ onTravel={vi.fn()}
+ onOpenPage={vi.fn()}
+ onLeaveRegion={onLeaveRegion}
+ activeRegionId="memory"
+ />
+ );
+ fireEvent.click(screen.getByText('OVERVIEW'));
+ expect(onLeaveRegion).toHaveBeenCalled();
+ expect(onClose).toHaveBeenCalled();
+ });
+
+ it('is an accessible dialog that closes from the backdrop and from Escape', () => {
+ // Chrome comes from the shared <Modal>, so these assert the wiring, not a re-roll.
+ const onClose = vi.fn();
+ renderPanel({ onClose });
+
+ const dialog = screen.getByRole('dialog');
+ expect(dialog).toHaveAttribute('aria-modal', 'true');
+ expect(dialog).toHaveAttribute('aria-label', 'Fast travel');
+
+ fireEvent.click(dialog.parentElement);
+ expect(onClose).toHaveBeenCalledTimes(1);
+
+ fireEvent.keyDown(window, { key: 'Escape' });
+ expect(onClose).toHaveBeenCalledTimes(2);
+ });
+
+ it('offers a map marker for every region, aimed at the same warp', () => {
+ const onTravel = vi.fn();
+ renderPanel({ onTravel });
+ for (const region of OPEN_WORLD_REGIONS) {
+ expect(screen.getByLabelText(`Travel to ${region.label}`)).toBeInTheDocument();
+ }
+ fireEvent.click(screen.getByLabelText('Travel to Data Harbor'));
+ expect(onTravel.mock.calls[0][0].id).toBe('data-harbor');
+ });
+});
diff --git a/client/src/components/city/PlayerController.jsx b/client/src/components/city/PlayerController.jsx
index 3cbc9112c1..0e7af305b1 100644
--- a/client/src/components/city/PlayerController.jsx
+++ b/client/src/components/city/PlayerController.jsx
@@ -50,6 +50,7 @@ export default function PlayerController({
active,
transitioning = false,
cameraView = 'third',
+ teleport = null,
}) {
const { camera, gl } = useThree();
const rigRef = useRef({
@@ -96,6 +97,28 @@ export default function PlayerController({
lookInitRef.current = false;
}, [active, positions]);
+ // Fast travel while on foot: warping to a region drops the player at its arrival point
+ // instead of moving only the orbital camera. `teleport.token` is the trigger — the same
+ // destination can be re-selected, and a plain {x,z} identity check would swallow the
+ // second warp. Keyed on the token alone so a re-render with an equal object is a no-op.
+ const teleportToken = teleport?.token ?? null;
+ useEffect(() => {
+ if (!active || teleportToken === null || !teleport) return;
+ const rig = rigRef.current;
+ rig.position.set(teleport.x, EYE_HEIGHT, teleport.z);
+ // Face the destination: the arrival point sits on the +Z side of the district, so
+ // looking down -Z (yaw 0) puts the region in front of the player.
+ rig.yaw = 0;
+ rig.pitch = 0;
+ rig.facing = 0;
+ rig.vy = 0;
+ rig.jumping = false;
+ lastSpawnRef.current = rig.position.clone();
+ lookInitRef.current = false;
+ // `teleport` is read for its coordinates but is not the trigger — see above.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [active, teleportToken]);
+
// Pointer lock management
const handleClick = useCallback(() => {
if (!active) return;
diff --git a/client/src/components/city/ProcessBuilding.jsx b/client/src/components/city/ProcessBuilding.jsx
index 8c43847956..2af5e76f9f 100644
--- a/client/src/components/city/ProcessBuilding.jsx
+++ b/client/src/components/city/ProcessBuilding.jsx
@@ -22,7 +22,7 @@ const getProcessColor = (status, building) => {
};
export default function ProcessBuilding({ process, pm2Status, position, seed, dimmed = false, dayMix = 0 }) {
- const { building, buildingBody } = useCityPalette();
+ const { building, buildingBody, surface } = useCityPalette();
const blinkRef = useRef();
const glowRef = useRef();
@@ -83,6 +83,7 @@ export default function ProcessBuilding({ process, pm2Status, position, seed, di
<mesh position={[0, height / 2, 0]}>
<boxGeometry args={[width, height, depth]} />
<meshStandardMaterial
+ {...surface}
color={bodyColor}
emissive={color}
emissiveIntensity={(status === 'online' ? 0.2 : 0.08) * dimMul * (1 - dayMix * 0.9)}
diff --git a/client/src/components/city/cityConstants.js b/client/src/components/city/cityConstants.js
index 52870e1c78..04ba702aeb 100644
--- a/client/src/components/city/cityConstants.js
+++ b/client/src/components/city/cityConstants.js
@@ -126,6 +126,58 @@ export const CITY_COLORS = {
ambientColor: '#0a0a1a',
ambientIntensity: 0.1,
},
+ // --- Vibes world style ---------------------------------------------------
+ // The low-poly bright look: a warm, high-key outdoor world rather than a neon
+ // night city. Colors mirror the Vibes open-world reference palette (teal-blue
+ // zenith → warm sand horizon, warm sun, cool sky bounce) so the two worlds read
+ // as the same art direction. `daylightFactor: 1` puts every dayMix-driven surface
+ // (grid, fog, puddles, neon albedo, label ink) fully into its bright form.
+ vibesDay: {
+ hour: 12,
+ zenith: '#4a9ec2',
+ midSky: '#5faebf',
+ horizonHigh: '#a8cfc4',
+ horizonLow: '#f3af78',
+ sunCore: '#fff4e2',
+ sunGlow: '#ffe4ba',
+ sunLight: '#ffe0b8',
+ sunIntensity: 1.5,
+ sunScale: 0.8,
+ isMoon: false,
+ daylightFactor: 1.0,
+ // Meadow green rather than pavement — the ground plane is a landscape here.
+ groundColor: '#628b6d',
+ groundRoughness: 0.95,
+ hemiSkyColor: '#b9e3d8',
+ hemiGroundColor: '#3f5c4a',
+ hemiIntensity: 1.05,
+ ambientColor: '#ffceae',
+ ambientIntensity: 0.4,
+ },
+ // The "night" half of the Vibes style. Deliberately still bright — a golden-hour
+ // dusk, not a blackout — so the world keeps its low-poly readability. daylightFactor
+ // stays high (0.9) so dayMix ≈ 0.99 and the neon-night surfaces stay suppressed.
+ vibesDusk: {
+ hour: 18,
+ zenith: '#2f6f92',
+ midSky: '#71a2b0',
+ horizonHigh: '#f0a46f',
+ horizonLow: '#f07f6d',
+ sunCore: '#ffd9a8',
+ sunGlow: '#ffb27a',
+ sunLight: '#ffc48f',
+ sunIntensity: 1.2,
+ sunScale: 1.0,
+ isMoon: false,
+ daylightFactor: 0.9,
+ groundColor: '#57755f',
+ groundRoughness: 0.95,
+ hemiSkyColor: '#9fc7cd',
+ hemiGroundColor: '#3a4a3c',
+ hemiIntensity: 0.95,
+ ambientColor: '#ffc9a2',
+ ambientIntensity: 0.45,
+ },
},
// The City uses one canonical cyber sky. Legacy stored skyTheme values are
// ignored by the scene and fall back to these presets.
@@ -364,17 +416,76 @@ export const seededRand = (seed) => {
};
};
-// The city 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 (noon vs sunset —
-// sunset preserves the established dark-theme look users already have).
-export const resolveCityTimeOfDay = (setting, themeIsDay) => {
+// --- World style -------------------------------------------------------------
+// OpenWorld renders in one of two art directions, and the style is DATA rather than a
+// binary tested in four places: every consumer reads a field off the def below instead of
+// asking "is this cyber?". Adding a third style means adding a row here, not editing the
+// sky resolver, the palette, the layer gates, and the settings picker.
+//
+// - presets the time-of-day pair fed to CitySky / CityLights / CityGround. Through
+// each preset's daylightFactor → cityDayMix, this alone carries most of the
+// look: every surface that already lerped night→day follows it for free.
+// - lowPoly flat-shaded, matte structural surfaces (see the palette's `surface`).
+// - neonLayers whether the neon-night scene layers (galaxy spheremap, starfield, shooting
+// stars, data rain, embers, volumetric light cones, neon signage) mount at
+// all. Over a sunlit low-poly landscape they read as haze and grain, so they
+// are gated out rather than faded per-frame.
+// - themeCrt whether the CRT overlay is opted in per theme family (deriveCrtProfile) or
+// simply off — a scanline multiply over a sunlit landscape reads as a dirty
+// screen, whatever the theme.
+// - accents the decorative spread for windows/props. The lead slot is always replaced
+// by the live theme accent, so the world follows the UI in either style.
+// - buildingBody the structural body color, re-tinted toward the theme accent.
+// - terrain the daytime bands CityLandscape's terrain shader mixes between.
+//
+// 'cyber' is kept as a real option, not nostalgia: it keeps the whole neon layer exercised
+// by the suite instead of bit-rotting behind a default nobody selects.
+export const WORLD_STYLE_DEFS = {
+ vibes: {
+ id: 'vibes',
+ label: 'OPEN WORLD',
+ presets: { day: 'vibesDay', night: 'vibesDusk' },
+ lowPoly: true,
+ neonLayers: false,
+ themeCrt: false,
+ // Warm sand / coral / teal / sage / amber instead of the cyberpunk neon set, so the
+ // bright low-poly world doesn't wear night-club colors.
+ accents: ['#63f2db', '#f07f6d', '#d7b98c', '#9873b9', '#f3b562', '#57c9c0', '#8c7169', '#dde4df'],
+ // Warm stone rather than the cyber world's near-black slab.
+ buildingBody: '#a87868',
+ terrain: { inner: '#8c7169', meadow: '#628b6d', ridge: '#51666a' },
+ },
+ cyber: {
+ id: 'cyber',
+ label: 'CYBER CITY',
+ presets: { day: 'noon', night: 'sunset' },
+ lowPoly: false,
+ neonLayers: true,
+ themeCrt: true,
+ accents: CITY_COLORS.neonAccents,
+ buildingBody: ORIGINAL_BUILDING_BODY,
+ terrain: { inner: '#686d68', meadow: '#6f8758', ridge: '#8d937f' },
+ },
+};
+
+export const WORLD_STYLES = Object.keys(WORLD_STYLE_DEFS);
+export const DEFAULT_WORLD_STYLE = 'vibes';
+
+// Sentinel-safe: an absent / legacy / misspelled stored value resolves to the default
+// rather than silently selecting an undefined style.
+export const resolveWorldStyle = (style) => (
+ Object.hasOwn(WORLD_STYLE_DEFS, style) ? style : DEFAULT_WORLD_STYLE
+);
+
+// The style's definition, always a real one.
+export const getWorldStyle = (style) => WORLD_STYLE_DEFS[resolveWorldStyle(style)];
+
+export const resolveCityTimeOfDay = (setting, themeIsDay, worldStyle) => {
const daytime = setting === 'day' ? true
: setting === 'night' ? false
: !!themeIsDay;
- return { daytime, presetKey: daytime ? 'noon' : 'sunset' };
+ const { presets } = getWorldStyle(worldStyle);
+ return { daytime, presetKey: daytime ? presets.day : presets.night };
};
// The CRT overlay (scanlines / neon edge-glow / vignette in CityScanlines) is a
@@ -389,8 +500,12 @@ const deriveCrtProfile = (family) => ({
vignette: family !== 'glass',
});
-// Derive the city palette from a PortOS theme object (a THEMES entry). Pure.
-export const deriveCityPalette = (theme) => {
+// Derive the OpenWorld palette from a PortOS theme object (a THEMES entry) and the
+// active world style. Pure. The style swaps the decorative/structural brand surfaces
+// (nothing semantic): status colors stay semantic in both worlds.
+export const deriveCityPalette = (theme, worldStyle) => {
+ const style = getWorldStyle(worldStyle);
+ const { lowPoly } = style;
const accent = tripletToHex(theme?.colors?.['--port-accent']) || ORIGINAL_GROUND;
const isDay = theme?.mode === 'day';
// Night backdrop: a near-black, accent-tinted void — the neon's additive/bloom
@@ -398,28 +513,53 @@ export const deriveCityPalette = (theme) => {
// sky (the daytime preset dims the neon, so a light surround is safe and reads as
// 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.72);
+ // In the Vibes world there is no neon to protect, and "night" is a golden dusk — so
+ // both surrounds are bright sky rather than a near-black void.
+ const nightBackground = lowPoly
+ ? getTimeOfDayPreset(style.presets.night).midSky
+ : darkenHex(accent, 0.1);
+ const dayBackground = lowPoly
+ ? getTimeOfDayPreset(style.presets.day).midSky
+ : lightenHex(accent, 0.72);
// Themed brand surfaces — recomputed from the theme accent each time, so switching
// back and forth never compounds. The lead neonAccents entry tracks the accent;
- // the rest of the palette is the static decorative spread. The dark building body
- // is re-tinted toward the accent (luminance preserved) so structures track the
- // theme too, not just the neon surfaces. Status colors stay semantic.
- const neonAccents = [accent, ...CITY_COLORS.neonAccents.slice(1)];
+ // the rest of the spread is the world style's decorative palette. The structural
+ // body color is re-tinted toward the accent (luminance preserved) so structures
+ // track the theme too, not just the accent surfaces. Status colors stay semantic.
+ const neonAccents = [accent, ...style.accents.slice(1)];
const building = { ...CITY_COLORS.building, online: accent };
- const buildingBody = tintStructure(ORIGINAL_BUILDING_BODY, accent);
+ const buildingBody = tintStructure(style.buildingBody, accent);
return {
themeId: theme?.id || 'classic-midnight',
mode: theme?.mode || 'night',
isDay,
+ // The active art direction. Scene components read these off the palette they already
+ // consume rather than re-resolving the style from settings — one bit, one channel.
+ worldStyle: style.id,
+ lowPoly,
+ neonLayers: style.neonLayers,
+ terrain: style.terrain,
+ // Material props every structural world mesh spreads so it inherits the art direction
+ // instead of hardcoding a finish: `<meshStandardMaterial … {...surface} />`, spread
+ // AFTER the mesh's own roughness/metalness so the style wins where it has an opinion.
+ // Low-poly worlds read by their facets — flat shading gives each face one normal — and
+ // a matte, non-metallic finish keeps buildings looking painted rather than wet like the
+ // cyber city's glass. Derived here (not per render) so its identity is stable and r3f
+ // never sees a changed material prop; `flatShading` is part of three.js's shader program
+ // cache key, so a value that flipped per render would recompile every lit material.
+ surface: lowPoly
+ ? { flatShading: true, roughness: 0.95, metalness: 0 }
+ : { flatShading: false },
accent,
nightBackground,
dayBackground,
// Default surround by theme mode — used for the loading screen before settings resolve.
background: isDay ? dayBackground : nightBackground,
- crt: deriveCrtProfile(theme?.family),
+ crt: style.themeCrt
+ ? deriveCrtProfile(theme?.family)
+ : { scanlines: false, glow: false, vignette: false },
// Brand surfaces the 3D scene reads via useCityPalette() instead of the old
// mutated singleton. `ground`/`particles` are the accent; `building`/`buildingBody`/
// `neonAccents` carry the themed maps.
diff --git a/client/src/components/city/cityTheme.test.js b/client/src/components/city/cityTheme.test.js
index 89c89a5423..9cdcac0125 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 } from 'vitest';
-import { deriveCityPalette, resolveCityTimeOfDay, cityLabelColors, tintTowardAccent, tintStructure, CITY_COLORS, getBuildingColor, getAccentColor, seededRand, smoothstepRange, cityDayMix, getTimeOfDayPreset, cityShowDetail, cityShowInteriorWindows } from './cityConstants';
+import { deriveCityPalette, resolveCityTimeOfDay, cityLabelColors, tintTowardAccent, tintStructure, CITY_COLORS, getBuildingColor, getAccentColor, seededRand, smoothstepRange, cityDayMix, getTimeOfDayPreset, cityShowDetail, cityShowInteriorWindows, resolveWorldStyle, getWorldStyle, WORLD_STYLE_DEFS, WORLD_STYLES, DEFAULT_WORLD_STYLE } from './cityConstants';
const hexLum = (hex) => {
const n = parseInt(hex.slice(1), 16);
@@ -23,7 +23,7 @@ describe('deriveCityPalette', () => {
it('exposes a dark night void and a bright day sky, both accent-tinted', () => {
const phosphor = getTheme('black-ice-terminal-day'); // accent #0a7a4a
- const p = deriveCityPalette(phosphor);
+ const p = deriveCityPalette(phosphor, 'cyber');
expect(p.nightBackground).toBe('#010c07'); // #0a7a4a * 0.1
expect(p.dayBackground).toBe('#badacc'); // #0a7a4a lightened 0.72 toward white
// A day theme's default surround (loading screen) is the bright day sky.
@@ -33,14 +33,14 @@ describe('deriveCityPalette', () => {
it('defaults a night theme surround to the dark void', () => {
const midnight = getTheme('classic-midnight'); // accent #3b82f6
- const p = deriveCityPalette(midnight);
+ const p = deriveCityPalette(midnight, 'cyber');
expect(p.isDay).toBe(false);
expect(p.background).toBe('#060d19'); // nightBackground = #3b82f6 * 0.1
expect(p.dayBackground).toBe('#c8dcfc');
});
it('falls back to defaults for a missing/invalid theme', () => {
- const p = deriveCityPalette(undefined);
+ const p = deriveCityPalette(undefined, 'cyber');
expect(p.themeId).toBe('classic-midnight');
expect(p.accent).toBe('#06b6d4'); // original cyan brand
expect(p.background).toBe('#011215'); // night theme default -> #06b6d4 * 0.1
@@ -48,15 +48,36 @@ describe('deriveCityPalette', () => {
it('resolves time of day, following theme mode for auto/legacy and honoring explicit overrides', () => {
// auto follows the theme mode
- expect(resolveCityTimeOfDay('auto', true)).toEqual({ daytime: true, presetKey: 'noon' });
- expect(resolveCityTimeOfDay('auto', false)).toEqual({ daytime: false, presetKey: 'sunset' });
- expect(resolveCityTimeOfDay(undefined, true)).toEqual({ daytime: true, presetKey: 'noon' });
+ expect(resolveCityTimeOfDay('auto', true, 'cyber')).toEqual({ daytime: true, presetKey: 'noon' });
+ expect(resolveCityTimeOfDay('auto', false, 'cyber')).toEqual({ daytime: false, presetKey: 'sunset' });
+ expect(resolveCityTimeOfDay(undefined, true, 'cyber')).toEqual({ daytime: true, presetKey: 'noon' });
// legacy stored presets are treated as auto (follow the theme)
- expect(resolveCityTimeOfDay('sunset', true)).toEqual({ daytime: true, presetKey: 'noon' });
- expect(resolveCityTimeOfDay('midnight', true)).toEqual({ daytime: true, presetKey: 'noon' });
+ expect(resolveCityTimeOfDay('sunset', true, 'cyber')).toEqual({ daytime: true, presetKey: 'noon' });
+ expect(resolveCityTimeOfDay('midnight', true, 'cyber')).toEqual({ daytime: true, presetKey: 'noon' });
// explicit overrides win regardless of theme mode
- expect(resolveCityTimeOfDay('day', false)).toEqual({ daytime: true, presetKey: 'noon' });
- expect(resolveCityTimeOfDay('night', true)).toEqual({ daytime: false, presetKey: 'sunset' });
+ expect(resolveCityTimeOfDay('day', false, 'cyber')).toEqual({ daytime: true, presetKey: 'noon' });
+ expect(resolveCityTimeOfDay('night', true, 'cyber')).toEqual({ daytime: false, presetKey: 'sunset' });
+ });
+
+ it('picks the Vibes preset pair by default, and for any unrecognized style', () => {
+ // The default world style is 'vibes' — an absent, legacy, or misspelled value must
+ // resolve there rather than falling through to an undefined preset key.
+ expect(resolveCityTimeOfDay('auto', true)).toEqual({ daytime: true, presetKey: 'vibesDay' });
+ expect(resolveCityTimeOfDay('auto', false)).toEqual({ daytime: false, presetKey: 'vibesDusk' });
+ expect(resolveCityTimeOfDay('day', false, 'nonsense')).toEqual({ daytime: true, presetKey: 'vibesDay' });
+ expect(resolveCityTimeOfDay('night', true, undefined)).toEqual({ daytime: false, presetKey: 'vibesDusk' });
+ });
+
+ it('keeps both Vibes presets bright, so neither reads as the neon-night look', () => {
+ // Every dayMix-driven surface (grid, fog, puddles, neon albedo, label ink) lerps on
+ // daylightFactor. If dusk dropped low the world would silently fall back to the cyber
+ // night grade under a Vibes sky.
+ for (const key of ['vibesDay', 'vibesDusk']) {
+ const preset = getTimeOfDayPreset(key);
+ expect(preset.daylightFactor).toBeGreaterThan(0.8);
+ expect(preset.isMoon).toBe(false);
+ expect(cityDayMix({ timeOfDay: key })).toBeGreaterThan(0.9);
+ }
});
it('derives a valid palette for every shipped theme (4 day + 4 night)', () => {
@@ -68,7 +89,7 @@ describe('deriveCityPalette', () => {
expect(night).toHaveLength(4);
for (const theme of themes) {
- const p = deriveCityPalette(theme);
+ const p = deriveCityPalette(theme, 'cyber');
expect(p.themeId).toBe(theme.id);
expect(p.isDay).toBe(theme.mode === 'day');
// Accent is parsed to a concrete hex (never left as a raw triplet/empty).
@@ -82,20 +103,29 @@ describe('deriveCityPalette', () => {
}
});
- it('opts CRT effects in per theme family', () => {
+ it('opts CRT effects in per theme family under the cyber style', () => {
// terminal (Phosphor) — full CRT
- expect(deriveCityPalette(getTheme('black-ice-terminal-day')).crt)
+ expect(deriveCityPalette(getTheme('black-ice-terminal-day'), 'cyber').crt)
.toEqual({ scanlines: true, glow: true, vignette: true });
// classic — cyber glow + vignette, but no scanlines
- expect(deriveCityPalette(getTheme('classic-midnight')).crt)
+ expect(deriveCityPalette(getTheme('classic-midnight'), 'cyber').crt)
.toEqual({ scanlines: false, glow: true, vignette: true });
// blueprint — vignette only
- expect(deriveCityPalette(getTheme('blueprint-ops')).crt)
+ expect(deriveCityPalette(getTheme('blueprint-ops'), 'cyber').crt)
.toEqual({ scanlines: false, glow: false, vignette: true });
// glass — fully clean, no CRT
- expect(deriveCityPalette(getTheme('lumen-glass')).crt)
+ expect(deriveCityPalette(getTheme('lumen-glass'), 'cyber').crt)
.toEqual({ scanlines: false, glow: false, vignette: false });
});
+
+ it('turns the CRT overlay off entirely in the Vibes world, whatever the theme family', () => {
+ // Scanlines/glow/vignette are cyber-terminal affectations; over a sunlit low-poly
+ // landscape they read as a dirty screen, so no theme family opts them back in.
+ for (const id of ['black-ice-terminal-day', 'classic-midnight', 'blueprint-ops', 'lumen-glass']) {
+ expect(deriveCityPalette(getTheme(id), 'vibes').crt)
+ .toEqual({ scanlines: false, glow: false, vignette: false });
+ }
+ });
});
describe('city sky visibility', () => {
@@ -178,6 +208,50 @@ describe('tintTowardAccent / tintStructure', () => {
});
});
+describe('deriveCityPalette — world style', () => {
+ it('reports the resolved style and its low-poly flag', () => {
+ expect(deriveCityPalette(getTheme('classic-midnight'), 'cyber')).toMatchObject({ worldStyle: 'cyber', lowPoly: false });
+ expect(deriveCityPalette(getTheme('classic-midnight'), 'vibes')).toMatchObject({ worldStyle: 'vibes', lowPoly: true });
+ // Absent / unrecognized falls back to the default rather than an undefined style.
+ expect(deriveCityPalette(getTheme('classic-midnight'))).toMatchObject({ worldStyle: 'vibes', lowPoly: true });
+ expect(deriveCityPalette(getTheme('classic-midnight'), 'neon-noir')).toMatchObject({ worldStyle: 'vibes', lowPoly: true });
+ });
+
+ it('gives the Vibes world a bright surround at BOTH times of day', () => {
+ // The cyber world needs darkness for its additive neon; the Vibes world has none, and
+ // its "night" is a golden dusk — so neither surround may be a near-black void.
+ const p = deriveCityPalette(getTheme('classic-midnight'), 'vibes');
+ expect(hexLum(p.nightBackground)).toBeGreaterThan(80);
+ expect(hexLum(p.dayBackground)).toBeGreaterThan(80);
+ });
+
+ it('lightens the structural body relative to the cyber world', () => {
+ const theme = getTheme('classic-midnight');
+ const cyber = deriveCityPalette(theme, 'cyber');
+ const vibes = deriveCityPalette(theme, 'vibes');
+ expect(hexLum(vibes.buildingBody)).toBeGreaterThan(hexLum(cyber.buildingBody));
+ });
+
+ it('swaps the decorative spread but keeps the theme accent leading, in both styles', () => {
+ const theme = getTheme('classic-midnight');
+ const cyber = deriveCityPalette(theme, 'cyber');
+ const vibes = deriveCityPalette(theme, 'vibes');
+ expect(vibes.neonAccents[0]).toBe(vibes.accent);
+ expect(cyber.neonAccents[0]).toBe(cyber.accent);
+ expect(vibes.neonAccents.slice(1)).not.toEqual(cyber.neonAccents.slice(1));
+ expect(vibes.neonAccents).toHaveLength(cyber.neonAccents.length);
+ });
+
+ it('keeps status colors semantic in both styles', () => {
+ const theme = getTheme('classic-midnight');
+ for (const style of ['cyber', 'vibes']) {
+ const p = deriveCityPalette(theme, style);
+ expect(p.getBuildingColor('stopped')).toBe(CITY_COLORS.building.stopped);
+ expect(p.getBuildingColor('online', true)).toBe(CITY_COLORS.building.archived);
+ }
+ });
+});
+
describe('deriveCityPalette brand surfaces', () => {
it('carries themed brand surfaces derived from the accent', () => {
const p = deriveCityPalette(getTheme('black-ice-terminal-day'));
@@ -199,7 +273,7 @@ describe('deriveCityPalette brand surfaces', () => {
it('re-tints the building body toward the accent, preserving its darkness', () => {
const ORIGINAL_BODY = '#0c0c24';
- const p = deriveCityPalette(getTheme('black-ice-terminal-day')); // green accent
+ const p = deriveCityPalette(getTheme('black-ice-terminal-day'), 'cyber'); // green accent
expect(p.buildingBody).not.toBe(ORIGINAL_BODY); // picked up the theme
expect(hexLum(p.buildingBody)).toBeCloseTo(hexLum(ORIGINAL_BODY), 0); // still a dark body
});
@@ -327,3 +401,64 @@ describe('quality-preset gates', () => {
});
});
// @vitest-environment node
+
+describe('resolveWorldStyle / getWorldStyle', () => {
+ it('passes through a known style', () => {
+ for (const style of WORLD_STYLES) expect(resolveWorldStyle(style)).toBe(style);
+ });
+
+ it('falls back to the default for absent, legacy, or malformed values', () => {
+ for (const bad of [undefined, null, '', 'CYBER', 'neon', 0, {}]) {
+ expect(resolveWorldStyle(bad)).toBe(DEFAULT_WORLD_STYLE);
+ }
+ });
+
+ it('always returns a real definition, even for a bad style', () => {
+ for (const bad of [undefined, null, '', 'neon', 0, {}]) {
+ expect(getWorldStyle(bad)).toBe(WORLD_STYLE_DEFS[DEFAULT_WORLD_STYLE]);
+ }
+ });
+
+ it('gates the neon-only scene layers on the cyber style alone', () => {
+ // CityScene mounts the galaxy spheremap, starfield, data rain, embers, volumetric
+ // cones, and neon signage on palette.neonLayers. An absent style must NOT read as
+ // cyber — that would haze the default bright world.
+ expect(deriveCityPalette(undefined, 'cyber').neonLayers).toBe(true);
+ expect(deriveCityPalette(undefined, 'vibes').neonLayers).toBe(false);
+ expect(deriveCityPalette(undefined).neonLayers).toBe(false);
+ expect(deriveCityPalette(undefined, 'nonsense').neonLayers).toBe(false);
+ });
+
+ it('every style definition is complete, so a new row cannot half-register', () => {
+ for (const [id, def] of Object.entries(WORLD_STYLE_DEFS)) {
+ expect(def.id).toBe(id);
+ expect(def.label).toBeTruthy();
+ // Both preset keys must name a real time-of-day preset, or the sky renders undefined.
+ expect(getTimeOfDayPreset(def.presets.day)).toBeDefined();
+ expect(getTimeOfDayPreset(def.presets.night)).toBeDefined();
+ expect(CITY_COLORS.timeOfDay[def.presets.day]).toBeDefined();
+ expect(CITY_COLORS.timeOfDay[def.presets.night]).toBeDefined();
+ expect(typeof def.lowPoly).toBe('boolean');
+ expect(typeof def.neonLayers).toBe('boolean');
+ expect(typeof def.themeCrt).toBe('boolean');
+ expect(def.accents.length).toBeGreaterThan(1);
+ expect(def.buildingBody).toMatch(/^#[0-9a-f]{6}$/i);
+ for (const band of ['inner', 'meadow', 'ridge']) {
+ expect(def.terrain[band]).toMatch(/^#[0-9a-f]{6}$/i);
+ }
+ }
+ });
+
+ it('carries a style-appropriate material surface for structural meshes', () => {
+ // flatShading is part of three.js's shader program cache key, so this must be a
+ // concrete boolean on both styles rather than absent on one of them.
+ expect(deriveCityPalette(undefined, 'vibes').surface)
+ .toEqual({ flatShading: true, roughness: 0.95, metalness: 0 });
+ expect(deriveCityPalette(undefined, 'cyber').surface).toEqual({ flatShading: false });
+ });
+
+ it('exposes the style terrain bands so components do not hardcode hexes', () => {
+ expect(deriveCityPalette(undefined, 'vibes').terrain).toEqual(WORLD_STYLE_DEFS.vibes.terrain);
+ expect(deriveCityPalette(undefined, 'cyber').terrain).toEqual(WORLD_STYLE_DEFS.cyber.terrain);
+ });
+});
diff --git a/client/src/hooks/useCitySettings.js b/client/src/hooks/useCitySettings.js
index 019d6f7efd..83f45f6ebd 100644
--- a/client/src/hooks/useCitySettings.js
+++ b/client/src/hooks/useCitySettings.js
@@ -50,6 +50,11 @@ const DEFAULT_SETTINGS = {
qualityMode: 'auto', // 'auto' = adaptive render budget; 'manual' = fixed preset
qualityPreset: 'high',
timeOfDay: 'auto', // 'auto' follows the active theme's day/night mode; 'day'/'night' force it
+ // Art direction: 'vibes' is the low-poly bright open world (default); 'cyber' restores
+ // the original neon-night CyberCity look. Existing installs have no stored value and so
+ // land on the new default — deliberate, this IS the world's new look — and the picker in
+ // the Visual tab switches back with no migration.
+ worldStyle: 'vibes',
explorationMode: false,
cameraView: 'third', // exploration camera: 'third' follows the cyber-runner; 'first' is classic FPS (V toggles)
...QUALITY_PRESETS.high,
diff --git a/client/src/pages/OpenWorld.fastTravel.test.jsx b/client/src/pages/OpenWorld.fastTravel.test.jsx
new file mode 100644
index 0000000000..8a23cbc0a6
--- /dev/null
+++ b/client/src/pages/OpenWorld.fastTravel.test.jsx
@@ -0,0 +1,194 @@
+import { describe, it, expect, beforeEach, vi } from 'vitest';
+import { render, screen, fireEvent, act } from '@testing-library/react';
+import { MemoryRouter, Routes, Route, useLocation } from 'react-router';
+
+// The 3D scene and the cockpit HUD are stubbed: this suite is about the page's fast-travel
+// WIRING (route param → scene props, M → panel, pick → navigate + teleport), not about
+// rendering WebGL in jsdom. The scene stub records the props it received so the assertions
+// can read them directly.
+const sceneProps = { current: null };
+vi.mock('../components/city/CityScene', () => ({
+ default: (props) => {
+ sceneProps.current = props;
+ return <div data-testid="scene" />;
+ },
+}));
+vi.mock('../components/city/CityHud', () => ({
+ default: ({ onOpenFastTravel, activeRegion }) => (
+ <div>
+ <button type="button" onClick={onOpenFastTravel}>hud-fast-travel</button>
+ <span data-testid="hud-region">{activeRegion?.id || 'none'}</span>
+ </div>
+ ),
+}));
+vi.mock('../components/city/CityScanlines', () => ({ default: () => null }));
+vi.mock('../components/city/CityPhotoOverlay', () => ({ default: () => null }));
+vi.mock('../components/city/CityPlaybackOverlay', () => ({ default: () => null }));
+vi.mock('../components/city/CitySettingsDrawer', () => ({ default: () => null }));
+
+vi.mock('../hooks/useCityData', () => ({
+ useCityData: () => ({
+ apps: [], cosAgents: [], cosStatus: {}, eventLogs: [], agentMap: new Map(),
+ reviewCounts: {}, instances: {}, systemHealth: null, notificationCounts: {},
+ backupStatus: null, cosTasks: [], healthMetrics: null, voiceState: null,
+ character: null, aiActivity: null, loading: false, connected: true,
+ }),
+}));
+vi.mock('../hooks/useCityPlayback', () => ({
+ useCityPlayback: () => ({
+ active: false, currentFrame: null, snapshots: [], frameIndex: 0, stats: null,
+ playing: false, speed: 1, loading: false, error: null,
+ enter: vi.fn(), exit: vi.fn(), seek: vi.fn(), step: vi.fn(),
+ togglePlay: vi.fn(), cycleSpeed: vi.fn(),
+ }),
+}));
+vi.mock('../hooks/useCityAudio', () => ({ default: () => ({ playSfx: vi.fn(), isAudioReady: false }) }));
+vi.mock('../hooks/useAutoRefetch', () => ({ useAutoRefetch: () => ({ data: null }) }));
+// Only the endpoints this page polls. `useAutoRefetch` is stubbed above so none of them
+// actually fire — the mock exists to keep the real api module (and its socket import) out
+// of the jsdom run.
+vi.mock('../services/api', () => ({
+ getCosQuickSummary: vi.fn(async () => null),
+ getCosActivityCalendar: vi.fn(async () => null),
+ getGoals: vi.fn(async () => null),
+ getChronotype: vi.fn(async () => null),
+ getMemoryGraph: vi.fn(async () => null),
+ getBrainInbox: vi.fn(async () => null),
+ getCityIntrospection: vi.fn(async () => null),
+ getMySprintTickets: vi.fn(async () => []),
+}));
+
+const OpenWorld = (await import('./OpenWorld')).default;
+
+function LocationProbe() {
+ const location = useLocation();
+ return <span data-testid="path">{location.pathname}</span>;
+}
+
+const renderAt = (path) => render(
+ <MemoryRouter initialEntries={[path]}>
+ <LocationProbe />
+ <Routes>
+ <Route path="/openworld" element={<OpenWorld />} />
+ <Route path="/openworld/region/:regionId" element={<OpenWorld />} />
+ <Route path="/brain/inbox" element={<div>brain page</div>} />
+ </Routes>
+ </MemoryRouter>
+);
+
+describe('OpenWorld — fast travel wiring', () => {
+ beforeEach(() => {
+ sceneProps.current = null;
+ localStorage.clear();
+ });
+
+ it('hands the scene no region on the plain overview route', () => {
+ renderAt('/openworld');
+ expect(sceneProps.current.focusedRegion).toBeNull();
+ });
+
+ it('resolves the :regionId route param into a region for the camera', () => {
+ renderAt('/openworld/region/memory');
+ expect(sceneProps.current.focusedRegion.id).toBe('memory');
+ // Geography comes from the master town plan, not from the route.
+ expect(sceneProps.current.focusedRegion.anchor).toBeDefined();
+ });
+
+ it('hands the scene a null region for an unknown id rather than crashing', () => {
+ renderAt('/openworld/region/atlantis');
+ expect(sceneProps.current.focusedRegion).toBeNull();
+ });
+
+ it('defaults to the Vibes world style, and reflects it in the scene settings', () => {
+ renderAt('/openworld');
+ expect(sceneProps.current.settings.worldStyle).toBe('vibes');
+ expect(sceneProps.current.settings.timeOfDay).toMatch(/^vibes/);
+ expect(sceneProps.current.palette.lowPoly).toBe(true);
+ });
+
+ it('honors a stored cyber style, restoring the original preset pair', () => {
+ localStorage.setItem('portos-city-settings', JSON.stringify({ worldStyle: 'cyber' }));
+ renderAt('/openworld');
+ expect(sceneProps.current.settings.worldStyle).toBe('cyber');
+ expect(['noon', 'sunset']).toContain(sceneProps.current.settings.timeOfDay);
+ expect(sceneProps.current.palette.lowPoly).toBe(false);
+ });
+
+ it('opens fast travel with M and warps to the picked region', () => {
+ renderAt('/openworld');
+ act(() => { fireEvent.keyDown(window, { key: 'm' }); });
+
+ fireEvent.click(screen.getByLabelText('Travel to Memory Quarter'));
+
+ expect(screen.getByTestId('path')).toHaveTextContent('/openworld/region/memory');
+ expect(sceneProps.current.focusedRegion.id).toBe('memory');
+ });
+
+ it('opens fast travel from the HUD button too', () => {
+ renderAt('/openworld');
+ fireEvent.click(screen.getByText('hud-fast-travel'));
+ expect(screen.getByLabelText('Travel to Memory Quarter')).toBeInTheDocument();
+ });
+
+ it('closes fast travel with Escape', () => {
+ renderAt('/openworld');
+ act(() => { fireEvent.keyDown(window, { key: 'm' }); });
+ expect(screen.getByLabelText('Search regions')).toBeInTheDocument();
+
+ act(() => { fireEvent.keyDown(window, { key: 'Escape' }); });
+ expect(screen.queryByLabelText('Search regions')).not.toBeInTheDocument();
+ });
+
+ it('does not teleport the player while flying the overview camera', () => {
+ 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();
+ });
+
+ it('teleports the player when warping on foot', () => {
+ localStorage.setItem('portos-city-settings', JSON.stringify({ explorationMode: true }));
+ renderAt('/openworld');
+ act(() => { fireEvent.keyDown(window, { key: 'm' }); });
+ fireEvent.click(screen.getByLabelText('Travel to Memory Quarter'));
+
+ const teleport = sceneProps.current.playerTeleport;
+ expect(teleport).toMatchObject({ x: expect.any(Number), z: expect.any(Number) });
+ expect(teleport.token).toBe(1);
+ });
+
+ 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' }); });
+ fireEvent.click(screen.getByLabelText('Travel to Memory Quarter'));
+ expect(sceneProps.current.playerTeleport.token).toBe(1);
+
+ act(() => { fireEvent.keyDown(window, { key: 'm' }); });
+ fireEvent.click(screen.getByLabelText('Travel to Memory Quarter'));
+ // Same destination, new warp — a plain {x,z} identity check would have swallowed this.
+ expect(sceneProps.current.playerTeleport.token).toBe(2);
+ });
+
+ it('tells the HUD which region is active', () => {
+ renderAt('/openworld/region/data-harbor');
+ expect(screen.getByTestId('hud-region')).toHaveTextContent('data-harbor');
+ });
+
+ it('opens the PortOS page a region stands for', () => {
+ renderAt('/openworld/region/memory');
+ act(() => { fireEvent.keyDown(window, { key: 'm' }); });
+ fireEvent.click(screen.getByTitle('Open /brain/inbox'));
+ expect(screen.getByTestId('path')).toHaveTextContent('/brain/inbox');
+ });
+
+ it('returns to the overview from the panel', () => {
+ renderAt('/openworld/region/memory');
+ act(() => { fireEvent.keyDown(window, { key: 'm' }); });
+ fireEvent.click(screen.getByText('OVERVIEW'));
+ expect(screen.getByTestId('path')).toHaveTextContent('/openworld');
+ expect(sceneProps.current.focusedRegion).toBeNull();
+ });
+});
diff --git a/client/src/pages/CyberCity.jsx b/client/src/pages/OpenWorld.jsx
similarity index 82%
rename from client/src/pages/CyberCity.jsx
rename to client/src/pages/OpenWorld.jsx
index 4a90c58c4b..0b4c2e894f 100644
--- a/client/src/pages/CyberCity.jsx
+++ b/client/src/pages/OpenWorld.jsx
@@ -4,6 +4,7 @@ import { useCityData } from '../hooks/useCityData';
import { useCityPlayback } from '../hooks/useCityPlayback';
import useCityAudio from '../hooks/useCityAudio';
import useKeyboardControls from '../hooks/useKeyboardControls';
+import useKeyboardShortcuts from '../hooks/useKeyboardShortcuts';
import { useAutoRefetch } from '../hooks/useAutoRefetch';
import { mergeFrameIntoCityProps } from '../lib/cityPlaybackFrame';
import * as api from '../services/api';
@@ -20,11 +21,13 @@ import { resolveCityFocus } from '../utils/cityFocusState';
import useCityViewport from '../hooks/useCityViewport';
import { DEFAULT_PRESET_ID, cyclePreset } from '../utils/cityPhotoMode';
import { computeSoundscape } from '../utils/citySoundscape';
-import { CITY_COLORS, deriveCityPalette, resolveCityTimeOfDay } from '../components/city/cityConstants';
+import { deriveCityPalette, getTimeOfDayPreset, resolveCityTimeOfDay, resolveWorldStyle } from '../components/city/cityConstants';
+import OpenWorldFastTravel from '../components/city/OpenWorldFastTravel';
+import { getRegion, regionArrivalPoint, regionPath } from '../utils/openWorldRegions';
import { CityPaletteProvider } from '../components/city/CityPaletteContext';
import { useThemeContext } from '../components/ThemeContext';
-function CyberCityInner() {
+function OpenWorldInner() {
const { apps, cosAgents, cosStatus, eventLogs, agentMap, reviewCounts, instances, systemHealth, notificationCounts, backupStatus, cosTasks, healthMetrics, voiceState, character, aiActivity, loading, connected } = useCityData();
const { settings, updateSetting, resetNonce } = useCitySettingsContext();
@@ -41,15 +44,21 @@ function CyberCityInner() {
const { playSfx } = useCityAudio(settings, soundscape);
const navigate = useNavigate();
const location = useLocation();
- const { appId } = useParams();
+ const { appId, regionId } = useParams();
const { isDesktop } = useCityViewport();
- // URL-addressed building focus (issue #2593). The `/city/apps/:appId` route param is the single
- // source of truth for "which borough is focused" — reload/back-forward/deep-link all restore it.
+ // URL-addressed building focus (issue #2593). The `/openworld/apps/:appId` route param is the
+ // single source of truth for "which borough is focused" — reload/back-forward/deep-link all
+ // restore it.
const { hasFocus, focusedApp, notFound: focusNotFound } = useMemo(
() => resolveCityFocus(appId, apps, { loading }),
[appId, apps, loading],
);
+ // Fast travel: `/openworld/region/:regionId` is the same contract one level out — the URL says
+ // which region you warped to, so a warp is shareable, bookmarkable, and reachable from ⌘K and
+ // voice. The registry is static (no loading race), and an unknown id resolves to null, which
+ // simply leaves the camera on the overview.
+ const focusedRegion = useMemo(() => getRegion(regionId), [regionId]);
const focusAgents = useMemo(() => agentMap?.get?.(appId)?.agents || [], [agentMap, appId]);
// HUD safe area the focus camera frames around: the detail panel sits on the right (desktop) or
// as a bottom sheet (compact), so keep the borough clear of it.
@@ -58,21 +67,28 @@ function CyberCityInner() {
[isDesktop],
);
- // CyberCity follows the active PortOS theme: the HUD recolors via the
+ // OpenWorld follows the active PortOS theme: the HUD recolors via the
// `cybercity-themed` CSS scope (see index.css) and the 3D scene's brand colors
// + surround are derived from the same theme here.
const { theme: cityTheme } = useThemeContext();
+ // Art direction — 'vibes' (bright low-poly open world, the default) or 'cyber' (the
+ // original neon night). It selects the time-of-day preset pair and the palette's
+ // structural/decorative surfaces, so it must resolve before either.
+ const worldStyle = resolveWorldStyle(settings?.worldStyle);
// Pure: derive the themed palette and hand it down through CityPaletteContext (and,
// inside <Canvas>, a second provider in CityScene since r3f's reconciler doesn't
// bridge context). No more during-render mutation of a shared singleton.
- const cityPalette = useMemo(() => deriveCityPalette(cityTheme), [cityTheme]);
+ const cityPalette = useMemo(() => deriveCityPalette(cityTheme, worldStyle), [cityTheme, worldStyle]);
- // The city renders day or night, following the theme mode by default (see
+ // The world 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 blue day sky and the dark night void to match.
- const cityTimeOfDay = resolveCityTimeOfDay(settings?.timeOfDay, cityPalette.isDay);
- const sceneBackground = cityTimeOfDay.daytime ? CITY_COLORS.timeOfDay.noon.midSky : cityPalette.nightBackground;
+ // settings override (CitySky/CityLights/CityGround read settings.timeOfDay), and the
+ // backdrop takes the matching preset's mid-sky band so the DOM surround behind the
+ // canvas agrees with the sky the scene actually paints, in either art direction.
+ const cityTimeOfDay = resolveCityTimeOfDay(settings?.timeOfDay, cityPalette.isDay, worldStyle);
+ const sceneBackground = cityTimeOfDay.daytime
+ ? getTimeOfDayPreset(cityTimeOfDay.presetKey).midSky
+ : cityPalette.nightBackground;
// Auto quality mode (issue #2592). In Auto, an adaptive render budget picks the
// effective tier at runtime (starting at High); in Manual, the effective tier is the
@@ -139,13 +155,13 @@ function CyberCityInner() {
[apps, agentMap, filter.status, filter.search]
);
- const showSettings = location.pathname === '/city/settings';
+ const showSettings = location.pathname === '/openworld/settings';
// Mode precedence (issue #2593): entering exploration/photo/history while a borough is focused
// clears the focused route first, so the focus camera + detail panel stand down deterministically
// before the new mode takes the camera. `hasFocus` reads the URL, the single source of truth.
const clearFocusRoute = useCallback(() => {
- if (hasFocus) navigate('/city');
+ if (hasFocus) navigate('/openworld');
}, [hasFocus, navigate]);
const handleToggleExploration = useCallback(() => {
@@ -160,6 +176,36 @@ function CyberCityInner() {
const keysRef = useKeyboardControls(handleToggleExploration);
+ // --- Fast travel ----------------------------------------------------------
+ // Warping navigates to `/openworld/region/:regionId`; the route param then drives the
+ // 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.
+ 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 }));
+ }
+ playSfx?.('dataPulse');
+ }, [navigate, settings?.explorationMode, 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
// the overlay (outside the Canvas) can trigger a grab. Exiting photo mode clears the fn.
@@ -338,7 +384,7 @@ function CyberCityInner() {
const handleBuildingClick = useCallback((app) => {
if (!app?.id) return;
if (settings?.explorationMode) navigate(`/apps/${app.id}`);
- else navigate(`/city/apps/${app.id}`);
+ else navigate(`/openworld/apps/${app.id}`);
}, [navigate, settings?.explorationMode]);
const handleJumpToFirst = useCallback(() => {
@@ -346,11 +392,11 @@ function CyberCityInner() {
if (!first?.id) return;
// Mirror handleBuildingClick: focus in-place from the overview, open the app page in exploration.
if (settings?.explorationMode) navigate(`/apps/${first.id}`);
- else navigate(`/city/apps/${first.id}`);
+ else navigate(`/openworld/apps/${first.id}`);
}, [filterResult.matches, navigate, settings?.explorationMode]);
// Close focus → back to the plain overview. Open app → the existing app detail page (explicit).
- const handleCloseFocus = useCallback(() => navigate('/city'), [navigate]);
+ const handleCloseFocus = useCallback(() => navigate('/openworld'), [navigate]);
const handleOpenApp = useCallback((id) => { if (id) navigate(`/apps/${id}`); }, [navigate]);
// Headline numbers baked onto a captured city postcard. Derived from data the page already
@@ -386,13 +432,13 @@ function CyberCityInner() {
return (
<div className="flex flex-col items-center justify-center h-full gap-4 cybercity-themed" style={{ background: cityPalette.background }}>
<div className="font-pixel text-cyan-400 text-lg tracking-widest animate-pulse" style={{ textShadow: '0 0 12px rgba(6,182,212,0.5)' }}>
- INITIALIZING CITY
+ ENTERING OPENWORLD
</div>
<div className="w-48 h-1 bg-gray-800 rounded-full overflow-hidden">
<div className="h-full bg-cyan-500 rounded-full animate-pulse" style={{ width: '60%', boxShadow: '0 0 8px rgba(6,182,212,0.5)' }} />
</div>
<div className="font-pixel text-[10px] text-cyan-500/40 tracking-wider">
- LOADING SYSTEMS...
+ LOADING WORLD...
</div>
</div>
);
@@ -450,6 +496,8 @@ function CyberCityInner() {
onAutoTierChange={setAutoTier}
onAutoDiagnostics={setAutoDiagnostics}
focusedAppId={appId || null}
+ focusedRegion={focusedRegion}
+ playerTeleport={playerTeleport}
hudSafe={focusHudSafe}
/>
{/* The full HUD hides in photo + playback mode so the view is clean; each
@@ -483,6 +531,8 @@ function CyberCityInner() {
focusAgents={focusAgents}
onCloseFocus={handleCloseFocus}
onOpenApp={handleOpenApp}
+ onOpenFastTravel={openFastTravel}
+ activeRegion={focusedRegion}
/>
)}
<CityPhotoOverlay
@@ -511,13 +561,24 @@ function CyberCityInner() {
onCycleSpeed={playback.cycleSpeed}
onExit={playback.exit}
/>
+ {/* Fast travel (M). Hidden in photo + playback mode, which own the camera and would
+ fight a warp. Mounted OUTSIDE the HUD's pointer-events-none shell so it can take
+ clicks, and above the CRT overlay so its panel isn't scanlined. */}
+ <OpenWorldFastTravel
+ open={fastTravelOpen && !photoMode && !playback.active}
+ onClose={() => setFastTravelOpen(false)}
+ onTravel={handleTravelToRegion}
+ onOpenPage={(path) => navigate(path)}
+ activeRegionId={focusedRegion?.id || null}
+ onLeaveRegion={() => navigate('/openworld')}
+ />
<CityScanlines settings={settings} crt={cityPalette.crt} />
{/* Settings on the shared Drawer (issue #2591). Closing preserves other query
params (e.g. an open cityPane) so the disclosure state survives. The Auto-quality
props (#2592) drive the Performance tab's effective-tier label + local diagnostics. */}
<CitySettingsDrawer
open={showSettings}
- onClose={() => navigate(`/city${location.search}`)}
+ onClose={() => navigate(`/openworld${location.search}`)}
qualityMode={qualityMode}
effectiveTier={effectiveTier}
diagnostics={qualityMode === 'auto' ? autoDiagnostics : null}
@@ -527,10 +588,10 @@ function CyberCityInner() {
);
}
-export default function CyberCity() {
+export default function OpenWorld() {
return (
<CitySettingsProvider>
- <CyberCityInner />
+ <OpenWorldInner />
</CitySettingsProvider>
);
}
diff --git a/client/src/utils/README.md b/client/src/utils/README.md
index f593dbb3cd..ea7279dbd5 100644
--- a/client/src/utils/README.md
+++ b/client/src/utils/README.md
@@ -82,8 +82,8 @@ its tunable constants and placement helpers.
| `cityEasterEggs` | Unlockable easter eggs from context (date/character/goals) → placements (`computeEasterEggs`). |
| `cityFederation` | Sync-peer reachability horizon: status color/opacity, bridge state, peer placement (`computeFederationHorizon`). |
| `cityFilter` | Status-filter definitions and app-filtering result (`computeFilterResult`). |
-| `cityFocusCamera` | Pure camera-framing math for building focus mode: orbital `position`/`target` that frame one borough for a given aspect ratio + HUD safe area (`computeFocusCamera`). |
-| `cityFocusState` | Resolve the `/city/apps/:appId` route param + app list into `{ hasFocus, focusedApp, notFound }`, deferring the not-found flag until apps finish loading (`resolveCityFocus`). |
+| `cityFocusCamera` | Pure camera-framing math for OpenWorld's camera targets: orbital `position`/`target` framing one borough (`computeFocusCamera`) or a whole fast-travel region (`computeRegionCamera`) for a given aspect ratio + HUD safe area. |
+| `cityFocusState` | Resolve the `/openworld/apps/:appId` route param + app list into `{ hasFocus, focusedApp, notFound }`, deferring the not-found flag until apps finish loading (`resolveCityFocus`). |
| `cityFlowLines` | Inter-building flow-line connections between active/agent nodes (`computeFlowConnections`). |
| `cityGoalMonuments` | Goal monuments & forest: stall detection, milestone segments, placement (`computeGoalMonuments`, `computeGoalForest`). |
| `cityHealthTower` | Health-metric tower segments from the latest health entry (`computeHealthTower`). |
@@ -93,6 +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`). |
| `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/cityFocusCamera.js b/client/src/utils/cityFocusCamera.js
index 1c266104d2..8a85a7b14a 100644
--- a/client/src/utils/cityFocusCamera.js
+++ b/client/src/utils/cityFocusCamera.js
@@ -51,14 +51,31 @@ export function computeFocusCamera({ building, aspect = 1, fovDeg = CITY_CAMERA_
const heightRaw = finiteOr(building?.height, 4);
const height = heightRaw > 0 ? heightRaw : 4;
- const safeAspect = Number.isFinite(aspect) && aspect > 0 ? aspect : 1;
- const safeFov = Number.isFinite(fovDeg) && fovDeg > 0 ? fovDeg : CITY_CAMERA_FOV_DEG;
-
// Bounding radius: the wider of the borough's ground footprint and half its tower height (plus the
// hologram/agent clearance above), so a tall skinny tower, a short wide cluster, and a
// many-agent borough all stay fully in frame.
const radius = Math.max(BOROUGH_GROUND_RADIUS, height * 0.6 + BOROUGH_TOP_CLEARANCE) * FRAMING_MARGIN;
+ return frameFromRadius({
+ centerX: bx,
+ centerZ: bz,
+ targetY: height * 0.45,
+ radius,
+ aspect,
+ fovDeg,
+ hudSafe,
+ pitchRad: PITCH_RAD,
+ });
+}
+
+// Shared optics for every framing helper here: given a bounding sphere on the ground plane,
+// back the camera off far enough that the sphere fits the HUD-reduced viewport, then pan the
+// whole shot clear of the HUD panels. Kept in one place so a borough and a whole district
+// can't drift into different framing rules.
+function frameFromRadius({ centerX, centerZ, targetY, radius, aspect, fovDeg, hudSafe, pitchRad }) {
+ const safeAspect = Number.isFinite(aspect) && aspect > 0 ? aspect : 1;
+ const safeFov = Number.isFinite(fovDeg) && fovDeg > 0 ? fovDeg : CITY_CAMERA_FOV_DEG;
+
// Usable viewport fraction once the HUD safe area is subtracted, clamped to a floor.
const right = clamp01(hudSafe?.right ?? 0);
const bottom = clamp01(hudSafe?.bottom ?? 0);
@@ -73,22 +90,67 @@ export function computeFocusCamera({ building, aspect = 1, fovDeg = CITY_CAMERA_
const distH = radius / (halfH * usableW);
const distance = Math.max(distV, distH);
- // Pan the framed region so the borough sits in the clear area: push it left of a right-edge panel
+ // Pan the framed region so the subject sits in the clear area: push it left of a right-edge panel
// and up above a bottom-edge panel. Panning moves camera + target by the same world delta.
const visHalfW = distance * halfH;
const visHalfH = distance * halfV;
const shiftX = right * visHalfW;
const shiftY = bottom * visHalfH;
- const targetY = height * 0.45;
- const target = [bx + shiftX, targetY - shiftY, bz];
+ const target = [centerX + shiftX, targetY - shiftY, centerZ];
- // Camera above + on the +Z side (like the overview camera), pitched down by PITCH_RAD.
+ // Camera above + on the +Z side (like the overview camera), pitched down by `pitchRad`.
const position = [
target[0],
- target[1] + distance * Math.sin(PITCH_RAD),
- bz + distance * Math.cos(PITCH_RAD),
+ target[1] + distance * Math.sin(pitchRad),
+ centerZ + distance * Math.cos(pitchRad),
];
return { position, target, distance, radius };
}
+
+// --- Region framing (fast travel) -------------------------------------------
+// Same optics as computeFocusCamera, but framing a whole district parcel instead of one
+// borough: the bounding radius comes from the parcel's [w × d] footprint rather than a
+// tower's height. Used by the `/openworld/region/:regionId` warp so every region arrives
+// at a consistent, fully-in-frame establishing shot.
+
+// Empty space around a framed region — a touch tighter than a single borough's, since a
+// district already reads as a group and doesn't need the extra breathing room.
+const REGION_FRAMING_MARGIN = 1.2;
+
+// A parcel with no declared footprint (or a degenerate one) still needs a usable shot.
+const MIN_REGION_RADIUS = 10;
+
+// Regions are framed from a little higher than a borough (~46°) so the district's LAYOUT
+// reads — you're arriving to see a place, not to inspect one building's facade.
+const REGION_PITCH_RAD = (46 * Math.PI) / 180;
+
+// Look slightly above the ground plane so the district's structures, not the pavement,
+// sit at the center of frame.
+const REGION_TARGET_Y = 3;
+
+// Compute the establishing camera for one fast-travel region.
+// region — { anchor: [x, y, z], w, d } (from openWorldRegions.getRegion).
+// aspect / fovDeg / hudSafe — as computeFocusCamera.
+// Returns { position:[x,y,z], target:[x,y,z], distance, radius }.
+export function computeRegionCamera({ region, aspect = 1, fovDeg = CITY_CAMERA_FOV_DEG, hudSafe } = {}) {
+ const anchor = Array.isArray(region?.anchor) ? region.anchor : [];
+ const cx = finiteOr(anchor[0], 0);
+ const cz = finiteOr(anchor[2], 0);
+ const w = Math.max(0, finiteOr(region?.w, 0));
+ const d = Math.max(0, finiteOr(region?.d, 0));
+
+ const radius = Math.max(MIN_REGION_RADIUS, Math.hypot(w, d) / 2) * REGION_FRAMING_MARGIN;
+
+ return frameFromRadius({
+ centerX: cx,
+ centerZ: cz,
+ targetY: REGION_TARGET_Y,
+ radius,
+ aspect,
+ fovDeg,
+ hudSafe,
+ pitchRad: REGION_PITCH_RAD,
+ });
+}
diff --git a/client/src/utils/cityFocusCamera.test.js b/client/src/utils/cityFocusCamera.test.js
index 6eab7890f8..03eec1c5d8 100644
--- a/client/src/utils/cityFocusCamera.test.js
+++ b/client/src/utils/cityFocusCamera.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { computeFocusCamera, BOROUGH_GROUND_RADIUS, CITY_CAMERA_FOV_DEG } from './cityFocusCamera';
+import { computeFocusCamera, BOROUGH_GROUND_RADIUS, CITY_CAMERA_FOV_DEG, computeRegionCamera } from './cityFocusCamera';
const building = { x: 12, z: -24, height: 6 };
@@ -74,3 +74,44 @@ describe('computeFocusCamera', () => {
});
});
// @vitest-environment node
+
+describe('computeRegionCamera', () => {
+ const region = { id: 'memory', anchor: [-44, 0, -30], w: 22, d: 22 };
+
+ it('centers the shot on the parcel anchor', () => {
+ const { target } = computeRegionCamera({ region, aspect: 16 / 9 });
+ expect(target[0]).toBeCloseTo(region.anchor[0], 6);
+ expect(target[2]).toBeCloseTo(region.anchor[2], 6);
+ });
+
+ it('sits above and on the +Z side of the region, like the overview camera', () => {
+ const { position, target } = computeRegionCamera({ region, aspect: 16 / 9 });
+ expect(position[1]).toBeGreaterThan(target[1]);
+ expect(position[2]).toBeGreaterThan(region.anchor[2]);
+ });
+
+ it('backs off farther for a bigger parcel', () => {
+ const small = computeRegionCamera({ region, aspect: 16 / 9 });
+ const big = computeRegionCamera({ region: { ...region, w: 66, d: 40 }, aspect: 16 / 9 });
+ expect(big.distance).toBeGreaterThan(small.distance);
+ });
+
+ it('floors the radius so a zero-footprint parcel still frames usefully', () => {
+ const { distance, radius } = computeRegionCamera({ region: { anchor: [0, 0, 0], w: 0, d: 0 }, aspect: 1 });
+ expect(radius).toBeGreaterThan(0);
+ expect(Number.isFinite(distance)).toBe(true);
+ });
+
+ it('pans clear of the HUD safe area', () => {
+ const bare = computeRegionCamera({ region, aspect: 16 / 9 });
+ const withPanel = computeRegionCamera({ region, aspect: 16 / 9, hudSafe: { right: 0.28 } });
+ expect(withPanel.target[0]).toBeGreaterThan(bare.target[0]);
+ });
+
+ it('survives a missing/degenerate region without producing NaNs', () => {
+ for (const bad of [undefined, {}, { anchor: null }, { anchor: [NaN, 0, NaN], w: NaN, d: NaN }]) {
+ const { position, target } = computeRegionCamera({ region: bad, aspect: 16 / 9 });
+ for (const n of [...position, ...target]) expect(Number.isFinite(n)).toBe(true);
+ }
+ });
+});
diff --git a/client/src/utils/cityFocusState.js b/client/src/utils/cityFocusState.js
index d82c67ab13..f214ffb63a 100644
--- a/client/src/utils/cityFocusState.js
+++ b/client/src/utils/cityFocusState.js
@@ -1,5 +1,5 @@
-// Pure resolver for CyberCity's URL-addressed building focus (issue #2593). Maps the
-// `/city/apps/:appId` route param + the live app list into a concrete render state.
+// Pure resolver for OpenWorld's URL-addressed building focus (issue #2593). Maps the
+// `/openworld/apps/:appId` route param + the live app list into a concrete render state.
//
// The key subtlety: a valid deep link whose app list is still loading must NOT flash the
// "building not found" fallback. So `notFound` is only true once the list has finished loading
diff --git a/client/src/utils/index.js b/client/src/utils/index.js
index 6e804411f7..22840dacb1 100644
--- a/client/src/utils/index.js
+++ b/client/src/utils/index.js
@@ -72,3 +72,4 @@ export * from './cityTaskFlowRiver.js';
export * from './cityTaskQueue.js';
export * from './cityTimeline.js';
export * from './cityVoiceMarker.js';
+export * from './openWorldRegions.js';
diff --git a/client/src/utils/openWorldRegions.js b/client/src/utils/openWorldRegions.js
new file mode 100644
index 0000000000..367718c569
--- /dev/null
+++ b/client/src/utils/openWorldRegions.js
@@ -0,0 +1,104 @@
+// OpenWorld's fast-travel region registry — the list of named places you can warp to and
+// the PortOS page each one stands for. This is what turns the world from "one city you pan
+// around" into an open world you teleport across (Breath-of-the-Wild style): every region is
+// a real destination with a name, a one-line pitch, and a door back into the 2D app.
+//
+// Geography is NOT re-declared here. Each region names a parcel in the master town plan
+// (`cityPlan.js` PARCELS) and reads its anchor/footprint from there, so moving a district on
+// the plan moves its fast-travel marker too — the same no-drift rule the mini-map follows.
+//
+// No React / three.js imports so the registry stays unit-testable in node (mirrors
+// cityMiniMap.js / cityFocusCamera.js). `OPEN_WORLD_REGIONS` is ALSO the source of truth for
+// the `/openworld/region/:regionId` nav-manifest entries — `server/lib/navManifest.test.js`
+// scrapes the `id:` values out of this array and fails if a region has no ⌘K / voice command
+// (or vice versa), so a new region can't ship unreachable.
+
+import { PARCELS } from './cityPlan';
+
+// Ordered for the fast-travel list: the two places you look at most first, then a clockwise
+// sweep of the outer districts, then the far shore. `parcel` keys into PARCELS for geography;
+// `appPath` is the 2D PortOS page the region visualizes (null for pure set dressing).
+export const OPEN_WORLD_REGIONS = [
+ { id: 'downtown', parcel: 'downtown', label: 'Downtown', blurb: 'Every managed app, one tower each.', appPath: '/apps', aliases: ['downtown', 'apps district', 'app towers'] },
+ { id: 'ai-core', parcel: 'aiCore', label: 'AI Core Plaza', blurb: 'The reactor at the center — live AI provider activity.', appPath: '/ai', aliases: ['ai core', 'core plaza', 'the core', 'reactor'] },
+ { id: 'task-queue', parcel: 'taskQueue', label: 'Task Queue', blurb: 'Chief of Staff work stacked up and moving.', appPath: '/cos/tasks', aliases: ['task queue', 'queue', 'cos queue'] },
+ { id: 'wellness', parcel: 'health', label: 'Wellness Tower', blurb: 'System vitals — CPU, memory, disk.', appPath: '/system-resources/overview', aliases: ['wellness tower', 'health tower', 'vitals tower'] },
+ { id: 'archive', parcel: 'warehouse', label: 'Archive District', blurb: 'Cold storage for archived apps.', appPath: '/apps', aliases: ['archive district', 'warehouse', 'cold storage'] },
+ { id: 'quiet-corner', parcel: 'easterEggs', label: 'Quiet Corner', blurb: 'The odd little things the world keeps to itself.', appPath: null, aliases: ['quiet corner', 'easter eggs'] },
+ { id: 'productivity', parcel: 'productivity', label: 'Productivity Terrace', blurb: 'Streaks, throughput, and the activity heatmap.', appPath: '/insights/overview', aliases: ['productivity terrace', 'productivity', 'streak district'] },
+ { id: 'backup-vault', parcel: 'backupVault', label: 'Backup Vault', blurb: 'The sealed door — last backup and its health.', appPath: '/settings/backup', aliases: ['backup vault', 'the vault'] },
+ { id: 'memory', parcel: 'memory', label: 'Memory Quarter', blurb: 'Crystal clusters of long-term memory and the inbox well.', appPath: '/brain/inbox', aliases: ['memory quarter', 'memory district', 'knowledge district'] },
+ { id: 'sprint-yard', parcel: 'jira', label: 'Sprint Yard', blurb: 'The current sprint, laid out as a yard of tickets.', appPath: '/devtools/jira', aliases: ['sprint yard', 'jira yard', 'sprint district'] },
+ { id: 'voice', parcel: 'voice', label: 'Voice Beacon', blurb: 'Lights up while the voice agent is listening.', appPath: '/digital-twin/voice', aliases: ['voice beacon', 'the beacon'] },
+ { id: 'goals', parcel: 'goals', label: 'Goal Monuments', blurb: 'One monument per life goal, height by progress.', appPath: '/goals/tree', aliases: ['goal monuments', 'monuments', 'goals district'] },
+ { id: 'artifacts', parcel: 'artifacts', label: 'Hall of Achievements', blurb: 'Earned artifacts on display.', appPath: '/character', aliases: ['hall of achievements', 'artifact hall', 'achievements hall'] },
+ { id: 'data-harbor', parcel: 'dataHarbor', label: 'Data Harbor', blurb: 'Piers over the bay — database tables and data domains.', appPath: '/data', aliases: ['data harbor', 'the harbor', 'piers'] },
+];
+
+// Route prefix the fast-travel deep links live under. Exported so callers build the URL from
+// one constant instead of re-typing it (and so the nav-manifest guard can name the prefix).
+export const OPEN_WORLD_REGION_PREFIX = '/openworld/region';
+
+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).
+export function getRegion(id) {
+ const region = REGIONS_BY_ID.get(id);
+ if (!region) return null;
+ const parcel = PARCELS[region.parcel];
+ if (!parcel) return null;
+ return {
+ ...region,
+ anchor: parcel.anchor,
+ w: parcel.w,
+ d: parcel.d,
+ planLabel: parcel.label,
+ };
+}
+
+// Every region, geography resolved, in fast-travel order. Regions whose parcel has vanished
+// from the plan are dropped rather than rendered at [0,0,0].
+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) {
+ const q = (query || '').trim().toLowerCase();
+ const all = listRegions();
+ if (!q) return all;
+ return all.filter((r) =>
+ r.label.toLowerCase().includes(q)
+ || r.id.includes(q)
+ || (r.blurb || '').toLowerCase().includes(q)
+ || (r.aliases || []).some((a) => a.includes(q)));
+}
+
+// Where a walking player lands when they warp in. Ground level at the parcel's near (+Z)
+// edge, pulled back far enough to see the district rather than spawning inside a monument.
+// Regions over the water (the harbor) land on the pier itself, which `isWalkable` allows.
+export const REGION_ARRIVAL_SETBACK = 6;
+
+export function regionArrivalPoint(region) {
+ if (!region) return null;
+ const [x, , z] = region.anchor;
+ return { x, z: z + region.d / 2 + REGION_ARRIVAL_SETBACK };
+}
diff --git a/client/src/utils/openWorldRegions.test.js b/client/src/utils/openWorldRegions.test.js
new file mode 100644
index 0000000000..0d18bdad55
--- /dev/null
+++ b/client/src/utils/openWorldRegions.test.js
@@ -0,0 +1,138 @@
+import { describe, it, expect } from 'vitest';
+import {
+ OPEN_WORLD_REGIONS,
+ OPEN_WORLD_REGION_PREFIX,
+ getRegion,
+ listRegions,
+ regionArrivalPoint,
+ regionPath,
+ resolveRegion,
+ searchRegions,
+ REGION_ARRIVAL_SETBACK,
+} from './openWorldRegions';
+import { PARCELS, isWalkable } from './cityPlan';
+
+describe('OPEN_WORLD_REGIONS registry', () => {
+ it('has unique, URL-safe ids', () => {
+ const ids = OPEN_WORLD_REGIONS.map((r) => r.id);
+ expect(new Set(ids).size).toBe(ids.length);
+ for (const id of ids) expect(id).toMatch(/^[a-z0-9-]+$/);
+ });
+
+ it('every region names a parcel that exists in the master town plan', () => {
+ const missing = OPEN_WORLD_REGIONS.filter((r) => !PARCELS[r.parcel]);
+ expect(missing.map((r) => `${r.id}→${r.parcel}`)).toEqual([]);
+ });
+
+ it('every region carries a label and a blurb', () => {
+ for (const region of OPEN_WORLD_REGIONS) {
+ expect(region.label).toBeTruthy();
+ expect(region.blurb).toBeTruthy();
+ }
+ });
+
+ it('app paths are absolute PortOS routes (or an explicit null for set dressing)', () => {
+ for (const region of OPEN_WORLD_REGIONS) {
+ if (region.appPath === null) continue;
+ expect(region.appPath).toMatch(/^\//);
+ }
+ });
+
+ it('builds deep links under the region prefix', () => {
+ expect(regionPath('memory')).toBe(`${OPEN_WORLD_REGION_PREFIX}/memory`);
+ });
+});
+
+describe('getRegion', () => {
+ it('resolves geography from the plan rather than re-declaring it', () => {
+ const region = getRegion('memory');
+ expect(region.anchor).toBe(PARCELS.memory.anchor);
+ expect(region.w).toBe(PARCELS.memory.w);
+ expect(region.d).toBe(PARCELS.memory.d);
+ expect(region.planLabel).toBe(PARCELS.memory.label);
+ });
+
+ it('returns null for an unknown id', () => {
+ expect(getRegion('atlantis')).toBeNull();
+ expect(getRegion('')).toBeNull();
+ expect(getRegion(undefined)).toBeNull();
+ });
+});
+
+describe('listRegions', () => {
+ it('returns every region, geography resolved, in registry order', () => {
+ const list = listRegions();
+ expect(list).toHaveLength(OPEN_WORLD_REGIONS.length);
+ expect(list.map((r) => r.id)).toEqual(OPEN_WORLD_REGIONS.map((r) => r.id));
+ for (const region of list) expect(Array.isArray(region.anchor)).toBe(true);
+ });
+});
+
+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);
+ expect(searchRegions(' ')).toHaveLength(OPEN_WORLD_REGIONS.length);
+ expect(searchRegions(undefined)).toHaveLength(OPEN_WORLD_REGIONS.length);
+ });
+
+ it('matches labels case-insensitively', () => {
+ expect(searchRegions('MEMORY').map((r) => r.id)).toContain('memory');
+ });
+
+ it('matches aliases the label does not contain', () => {
+ // "jira yard" is an alias of the Sprint Yard — the label never says JIRA.
+ expect(searchRegions('jira').map((r) => r.id)).toContain('sprint-yard');
+ });
+
+ it('preserves registry order so the list does not reshuffle as you type', () => {
+ const order = OPEN_WORLD_REGIONS.map((r) => r.id);
+ const hits = searchRegions('t').map((r) => r.id);
+ expect(hits).toEqual(order.filter((id) => hits.includes(id)));
+ });
+
+ it('returns an empty list for a query nothing matches', () => {
+ expect(searchRegions('zzzzz-nothing')).toEqual([]);
+ });
+});
+
+describe('regionArrivalPoint', () => {
+ it('lands on the near (+Z) edge of the parcel, set back so you can see it', () => {
+ const region = getRegion('goals');
+ const point = regionArrivalPoint(region);
+ expect(point.x).toBe(PARCELS.goals.anchor[0]);
+ expect(point.z).toBe(PARCELS.goals.anchor[2] + PARCELS.goals.d / 2 + REGION_ARRIVAL_SETBACK);
+ });
+
+ it('never drops a walking player into the bay', () => {
+ for (const region of listRegions()) {
+ const { x, z } = regionArrivalPoint(region);
+ expect(isWalkable(x, z)).toBe(true);
+ }
+ });
+
+ it('is null-safe', () => {
+ expect(regionArrivalPoint(null)).toBeNull();
+ expect(regionArrivalPoint(undefined)).toBeNull();
+ });
+});
diff --git a/docs/README.md b/docs/README.md
index 6d7a3f1156..10a3deb87a 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -40,7 +40,7 @@ Identity & self: [digital-twin](./features/digital-twin.md) · [identity-system]
Knowledge: [brain-system](./features/brain-system.md) · [messages-security](./features/messages-security.md)
-Create: [writers-room](./features/writers-room.md) · [cybercity-v2](./features/cybercity-v2.md) · [sprite-export-contract](./features/sprite-export-contract.md) · [video-text-encoders](./features/video-text-encoders.md)
+Create: [writers-room](./features/writers-room.md) · [openworld](./features/openworld.md) · [sprite-export-contract](./features/sprite-export-contract.md) · [video-text-encoders](./features/video-text-encoders.md)
Comms & voice: [openclaw-operator-chat](./features/openclaw-operator-chat.md) ([pre-build audit](./research/2026-03-31-openclaw-operator-chat-audit.md)) · [stacker-news](./features/stacker-news.md) · [voice](./features/voice.md)
diff --git a/docs/features/cybercity-v2.md b/docs/features/openworld.md
similarity index 76%
rename from docs/features/cybercity-v2.md
rename to docs/features/openworld.md
index c6f0470db2..8cd135b112 100644
--- a/docs/features/cybercity-v2.md
+++ b/docs/features/openworld.md
@@ -1,10 +1,17 @@
-# CyberCity v2
+# OpenWorld
+
+> **Renamed 2026-08-19.** This surface shipped as *CyberCity* at `/city`. It is now
+> **OpenWorld** at `/openworld`; the whole `/city` prefix (including `/city/settings`
+> and `/city/apps/:appId`) redirects, so old bookmarks, pinned sidebar rows, stored ⌘K
+> history, and peers' deep links keep working. The nav-command **ids** are deliberately
+> unchanged (`nav.cybercity`) — they're opaque and persisted in palette history — and the
+> module/file prefix is still `city*` pending a separate mechanical sweep (#4571).
## Intent
-CyberCity is the **spatial systems map** of PortOS. A single `/cybercity` page that
+OpenWorld is the **spatial systems map** of PortOS. A single `/openworld` page that
turns the abstract state of every managed app, every active agent, every system
-signal into a 3D environment you can glance at, search, and act in.
+signal into a 3D world you can glance at, search, teleport across, and act in.
It does three jobs:
@@ -118,7 +125,7 @@ what makes CyberCity worth visiting daily; later phases add depth.
### Phase 1 — Operational Legibility (current focus)
-Goal: a person walking into `/cybercity` for the first time can immediately see
+Goal: a person walking into `/openworld` for the first time can immediately see
what's healthy, what's not, find a specific app, and take action.
| ID | Item | Effort |
@@ -180,9 +187,64 @@ Goal: the city feels alive, distinctive, and earned.
on the basis of the active quality preset
- All new components must respect the existing settings panel quality dial
+## Fast travel (regions)
+
+The world is navigated by **warping**, not only by panning. Every district on the master
+town plan is a named **region** with a one-line pitch and a door into the 2D PortOS page it
+visualizes — Memory Quarter → `/brain/inbox`, Sprint Yard → `/devtools/jira`, Data Harbor
+→ `/data`, and so on.
+
+- **Registry:** `client/src/utils/openWorldRegions.js`. Geography is *not* re-declared —
+ each region names a parcel in `cityPlan.js` and reads its anchor/footprint from there, so
+ moving a district on the plan moves its warp marker with it.
+- **Route:** `/openworld/region/:regionId`. The URL is the single source of truth for
+ "where you warped to" — same contract as building focus — so a warp is shareable,
+ bookmarkable, and reachable from ⌘K and voice.
+- **UI:** `M` (or the HUD's FAST TRAVEL button / the compact dock's navigation icon) opens
+ `OpenWorldFastTravel`, a searchable list beside a plate of the world with a marker per
+ region. Picking one flies the orbital camera via `computeRegionCamera`; if you're on foot
+ in exploration mode it also teleports the player rig to the region's arrival point.
+- **Reachability guard:** `server/lib/navManifest.test.js` scrapes `OPEN_WORLD_REGIONS` and
+ fails in both directions — a region with no `/openworld/region/<id>` nav command, or a
+ command left behind by a deleted region.
+
+## World style (art direction)
+
+`settings.worldStyle` picks one of two looks; it is persisted with the rest of the city
+settings and switchable from the Visual tab of the settings drawer.
+
+| Style | Look | Time-of-day presets |
+|-------|------|---------------------|
+| `vibes` (default) | Bright low-poly open world — teal-to-warm sky, meadow ground, flat-shaded facades, warm sun | `vibesDay` / `vibesDusk` |
+| `cyber` | The original neon-night CyberCity | `noon` / `sunset` |
+
+The style is a single lever with three effects, all in `cityConstants.js`:
+
+1. `resolveCityTimeOfDay` picks the preset pair, which feeds `CitySky`, `CityLights`, and
+ `CityGround` — and, through `daylightFactor` → `cityDayMix`, every surface that already
+ lerps between its night and day form.
+2. `deriveCityPalette` swaps the *decorative and structural* surfaces (accent spread,
+ building body, both surrounds, the CRT profile). Status colors stay semantic in both.
+3. `isCyberStyle` gates the neon-only scene layers — galaxy spheremap, starfield, shooting
+ stars, data rain, embers, volumetric light cones, neon signage — so they don't mount at
+ all under `vibes` rather than being faded out per frame. `palette.lowPoly` turns on flat
+ shading for facades and terrain.
+
+Keeping `cyber` as a real option isn't only nostalgia: it keeps the whole neon layer
+exercised by the suite instead of bit-rotting behind a default nobody selects.
+
+What the style change does NOT do is replace the world's *geometry* — buildings are still
+the cyber-era extruded slabs, and only three meshes so far spread the palette's `surface`.
+The low-poly asset pass is #4572; diegetic in-world warp pads are #4573; a touch-sized
+fast-travel map for phones is #4574.
+
## Critical Files
-- `client/src/pages/CyberCity.jsx` — page wrapper
+- `client/src/pages/OpenWorld.jsx` — page wrapper
+- `client/src/utils/openWorldRegions.js` — fast-travel region registry (also the nav-guard source)
+- `client/src/components/city/OpenWorldFastTravel.jsx` — the warp panel (M)
+- `client/src/utils/cityFocusCamera.js` — framing math for a borough (`computeFocusCamera`) and a region (`computeRegionCamera`)
+- `client/src/components/city/cityConstants.js` — world styles, time-of-day presets, palette derivation
- `client/src/components/city/CityScene.jsx` — Canvas, 3D containers, controls
- `client/src/components/city/CityHud.jsx` — overlay HUD (most Phase 1 UX changes)
- `client/src/components/city/Building.jsx`, `Borough.jsx` — façade work (1.1, 1.2, 1.13)
@@ -230,13 +292,13 @@ Existing events the city should hook into more deeply:
## Verification per phase
-**Phase 1 acceptance test:** open `/cybercity`, confirm at a glance which apps
+**Phase 1 acceptance test:** open `/openworld`, confirm at a glance which apps
need attention, search for a specific app by name in <2s, click any HUD stat
and land on the relevant page, work the same flow on a phone via Tailscale.
**Phase 2 acceptance test:** every major system in PortOS has a visible spatial
representation; new socket events animate the city in real time; opening
-`/cybercity` instead of `/dashboard` is a viable daily workflow.
+`/openworld` instead of `/dashboard` is a viable daily workflow.
**Phase 3 acceptance test:** the city feels distinctive — soundscape and mood
shift with system state, milestones leave permanent visual artifacts, and
diff --git a/docs/features/product-surfaces.md b/docs/features/product-surfaces.md
index 46d7226521..31fce9a838 100644
--- a/docs/features/product-surfaces.md
+++ b/docs/features/product-surfaces.md
@@ -22,7 +22,7 @@ PortOS is a local-first operating system for a developer's machines, work, and p
- **Writers Room, Authors, and Story Builder** — Draft prose, manage works and versions, and develop a story through guided stages. See [Writers Room](./writers-room.md).
- **Universe Builder and Catalog** — Build a world bible, establish canon, and reuse its characters, places, objects, and lore throughout the Create suite.
- **Series Pipeline** — Plan a serial production, write and review issues, generate storyboards, and track editorial readiness.
-- **Image, video, 3D, LoRA, and media libraries** — Generate or organize visual assets, models, collections, mood boards, timelines, and annotations. The [Sprite Export Contract](./sprite-export-contract.md) documents the game-sprite handoff; [CyberCity](./cybercity-v2.md) covers the 3D operational view.
+- **Image, video, 3D, LoRA, and media libraries** — Generate or organize visual assets, models, collections, mood boards, timelines, and annotations. The [Sprite Export Contract](./sprite-export-contract.md) documents the game-sprite handoff; [OpenWorld](./openworld.md) covers the 3D operational world.
- **Creative Director, Creative Commissions, and Music Video** — Turn a brief or track into a treatment, plan, renders, and reviewable media project.
- **Music, SongBook, Rounds, and Ambient** — Create and organize artists, albums, tracks, musical rounds, song references, and ambient sound work.
- **Importer and Sharing** — Convert an outside manuscript into a PortOS project and exchange supported creative records through configured share buckets.
diff --git a/server/lib/navManifest.js b/server/lib/navManifest.js
index 08b1546e54..d3ef4af04d 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -5,11 +5,42 @@
import { PORTOS_APP_ID } from './appIdentity.js';
+// Fast-travel destinations — one command per region in the client's OPEN_WORLD_REGIONS
+// registry (client/src/utils/openWorldRegions.js), so ⌘K and voice ("take me to the
+// memory quarter") can warp straight into the world. The list is duplicated rather than
+// imported because a server lib can't reach into client code; navManifest.test.js scrapes
+// the registry and fails on drift in the paths, the labels, AND the aliases.
+// Written as [id, label, aliases] tuples so the axis that varies is the only thing repeated.
+const OPEN_WORLD_REGION_COMMANDS = [
+ ['downtown', 'Downtown', ['downtown', 'apps district', 'app towers']],
+ ['ai-core', 'AI Core Plaza', ['ai core', 'core plaza', 'the core', 'reactor']],
+ ['task-queue', 'Task Queue', ['task queue', 'queue', 'cos queue']],
+ ['wellness', 'Wellness Tower', ['wellness tower', 'health tower', 'vitals tower']],
+ ['archive', 'Archive District', ['archive district', 'warehouse', 'cold storage']],
+ ['quiet-corner', 'Quiet Corner', ['quiet corner', 'easter eggs']],
+ ['productivity', 'Productivity Terrace', ['productivity terrace', 'productivity', 'streak district']],
+ ['backup-vault', 'Backup Vault', ['backup vault', 'the vault']],
+ ['memory', 'Memory Quarter', ['memory quarter', 'memory district', 'knowledge district']],
+ ['sprint-yard', 'Sprint Yard', ['sprint yard', 'jira yard', 'sprint district']],
+ ['voice', 'Voice Beacon', ['voice beacon', 'the beacon']],
+ ['goals', 'Goal Monuments', ['goal monuments', 'monuments', 'goals district']],
+ ['artifacts', 'Hall of Achievements', ['hall of achievements', 'artifact hall', 'achievements hall']],
+ ['data-harbor', 'Data Harbor', ['data harbor', 'the harbor', 'piers']],
+].map(([id, label, aliases]) => ({
+ id: `nav.openworld.region.${id}`,
+ path: `/openworld/region/${id}`,
+ label,
+ section: 'Main',
+ aliases,
+ keywords: ['openworld', 'fast travel', 'warp', 'region', 'teleport'],
+}));
+
export const NAV_COMMANDS = [
{ id: 'nav.dashboard', path: '/', label: 'Dashboard', section: 'Main', aliases: ['dashboard', 'home'], keywords: ['overview', 'start'] },
{ id: 'nav.review-hub', path: '/review', label: 'Review Hub', section: 'Main', aliases: ['review', 'review-hub'] },
- { id: 'nav.cybercity', path: '/city', label: 'City', section: 'Main', aliases: ['city', 'cybercity'], keywords: ['3d', 'visualization', 'cybercity'] },
- { id: 'nav.cybercity.settings', path: '/city/settings', label: 'City Settings', section: 'Main', aliases: ['city settings', 'cybercity settings', 'city-settings', 'cybercity-config'], keywords: ['cybercity', 'settings', '3d', 'configure'] },
+ { id: 'nav.cybercity', path: '/openworld', label: 'OpenWorld', section: 'Main', aliases: ['openworld', 'open world', 'open-world', 'city', 'cybercity'], keywords: ['3d', 'visualization', 'cybercity', 'game', 'map', 'explore'] },
+ { id: 'nav.cybercity.settings', path: '/openworld/settings', label: 'OpenWorld Settings', section: 'Main', aliases: ['openworld settings', 'open world settings', 'world settings', 'city settings', 'cybercity settings', 'city-settings', 'cybercity-config'], keywords: ['cybercity', 'openworld', 'settings', '3d', 'configure', 'world style', 'low poly'] },
+ ...OPEN_WORLD_REGION_COMMANDS,
{ id: 'nav.apps', path: '/apps', label: 'Apps', section: 'Main', aliases: ['apps'] },
// Submodules are per-app (a tab on the app detail page), so this entry is
// explicitly PortOS's own — the only repo whose app id is a fixed constant.
diff --git a/server/lib/navManifest.test.js b/server/lib/navManifest.test.js
index 70884f929a..91d244c3a9 100644
--- a/server/lib/navManifest.test.js
+++ b/server/lib/navManifest.test.js
@@ -34,6 +34,11 @@ const TABBED_PAGES = [
{ prefix: '/wiki', file: 'client/src/pages/Wiki.jsx', kind: 'ids', constName: 'TABS' },
{ prefix: '/settings', file: 'client/src/components/settings/SettingsTabsHeader.jsx', kind: 'links', constName: 'TABS' },
{ prefix: '/sharing', file: 'client/src/pages/Sharing.jsx', kind: 'links', constName: 'SECTIONS' },
+ // OpenWorld's fast-travel destinations aren't page tabs, but they follow the same
+ // contract: one `/openworld/region/<id>` nav command per region in the client's
+ // registry, so every warp target is reachable from ⌘K and voice — and a region
+ // added without a command (or a command left behind by a deleted region) fails here.
+ { prefix: '/openworld/region', file: 'client/src/utils/openWorldRegions.js', kind: 'ids', constName: 'OPEN_WORLD_REGIONS' },
// POST's morse tab has routed `:mode` sub-pages (/post/morse/copy|send) and the
// memory tab has the Elements study sub-page (/post/memory/elements) plus its
// own routed practice modes — none are top-level switch cases, so declare their
@@ -50,12 +55,15 @@ const TABBED_PAGES = [
// Pull the inner text of `export const <constName> = [ … ];` (requiring `export`
// also asserts the constant stays importable — a forgotten `export` fails loudly).
-// Assumes a FLAT array (entries are `{ id|to|path, label, icon }` objects, no
-// nested array literals): the non-greedy `]` stops at the first `];`, so a tab
-// object carrying a nested array would truncate the block and drop later tabs.
-// True for every tab/section constant today; revisit if a nested literal lands.
+// The terminator is line-anchored, so a nested array literal — OPEN_WORLD_REGIONS'
+// per-region `aliases: [...]`, the first such source here — closes with `],` mid-line
+// and cannot end the block early. Only a `];` at column 0 terminates; a nested literal
+// formatted that way would still truncate the guard, but no source does that today.
function extractConstArrayBlock(src, constName) {
- const block = src.match(new RegExp(`export const ${constName}\\s*=\\s*\\[([\\s\\S]*?)\\];`));
+ // Terminator is line-anchored (`^];`) so a NESTED array literal — e.g. the per-region
+ // `aliases: [...]` in OPEN_WORLD_REGIONS, the first source here to carry one — can't end
+ // the block early and silently truncate the guard to the entries above it.
+ const block = src.match(new RegExp(`export const ${constName}\\s*=\\s*\\[([\\s\\S]*?)^\\];`, 'm'));
if (!block) throw new Error(`No exported ${constName} array found`);
return block[1];
}
@@ -237,6 +245,60 @@ describe('nav contract — tabbed pages match their tab constants', () => {
}
});
+// The `ids` guard above pins the region PATHS, but a region's user-visible label and its
+// spoken/typed aliases live in the client registry too — and those are what ⌘K and voice
+// actually match on. Without this, the two lists can pass the path guard while the alias
+// sets silently diverge, so "take me to the memory quarter" resolves in the panel's search
+// box but not in the palette. Read straight out of the registry source so there is one
+// source of truth for what a region is called.
+describe('nav contract — OpenWorld regions match the registry labels and aliases', () => {
+ const REGIONS_FILE = 'client/src/utils/openWorldRegions.js';
+
+ // Each registry entry is one `{ … }` object literal on its own line; pull the fields the
+ // nav manifest also declares. Read inside it() bodies so a moved file fails focused.
+ const readRegistry = () => {
+ const src = fs.readFileSync(path.join(REPO_ROOT, REGIONS_FILE), 'utf8');
+ const block = src.match(/export const OPEN_WORLD_REGIONS\s*=\s*\[([\s\S]*?)^\];/m);
+ if (!block) throw new Error('No exported OPEN_WORLD_REGIONS array found');
+ return [...block[1].matchAll(/\{[^{}]*\}/g)].map((m) => {
+ const entry = m[0];
+ const field = (name) => entry.match(new RegExp(`${name}:\\s*'([^']*)'`))?.[1];
+ const aliases = entry.match(/aliases:\s*\[([^\]]*)\]/)?.[1] || '';
+ return {
+ id: field('id'),
+ label: field('label'),
+ aliases: [...aliases.matchAll(/'([^']*)'/g)].map((a) => a[1]),
+ };
+ });
+ };
+
+ const navByPath = new Map(NAV_COMMANDS.map((c) => [c.path, c]));
+
+ it('reads a non-empty registry (the extractor still matches the file shape)', () => {
+ const regions = readRegistry();
+ expect(regions.length).toBeGreaterThan(0);
+ expect(regions.every((r) => r.id && r.label)).toBe(true);
+ });
+
+ it('every region command carries the registry label', () => {
+ const wrong = readRegistry()
+ .map((r) => ({ r, cmd: navByPath.get(`/openworld/region/${r.id}`) }))
+ .filter(({ r, cmd }) => cmd && cmd.label !== r.label)
+ .map(({ r, cmd }) => `${r.id}: nav "${cmd.label}" ≠ registry "${r.label}"`);
+ expect(wrong).toEqual([]);
+ });
+
+ it('every registry alias is addressable as a nav alias', () => {
+ const missing = readRegistry().flatMap((r) => {
+ const cmd = navByPath.get(`/openworld/region/${r.id}`);
+ if (!cmd) return [];
+ const navAliases = new Set(cmd.aliases || []);
+ return r.aliases.filter((a) => !navAliases.has(a)).map((a) => `${r.id}: "${a}"`);
+ });
+ expect(missing).toEqual([]);
+ });
+});
+
// Settings is the one tabbed page whose tab bar (SettingsTabsHeader.jsx `TABS`,
// the nav guard's source of truth for /settings) and render dispatch live in
// separate files: `Settings.jsx`'s `switch (activeTab)`. They're hand-kept in