Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): dodge occupied ring slots when clearing the core plaza
[._.]/ Adam Eivy06c5bb73d95d
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 203b341803..a3d8df7d49 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -22,7 +22,7 @@- **[issue-875] CyberCity district layout internals consolidated** — the city's districts now share one set of layout primitives for grid placement, category tallies, and log-scaled building heights, so each district no longer carries its own copy of that math. No visible change to the city.- **[issue-713] Simpler, collapsed sidebar** — The left navigation is consolidated to a focused set of top-level areas with a "More" group for the long tail. Messaging and your wiki now live under Brain, system and infrastructure tools under Dev Tools, and health tracking is now simply "Health"; Goals is promoted to its own top-level entry. Deep page tabs no longer clutter the sidebar — open a page and its tabs live in the page — and everything stays reachable from ⌘K and voice navigation.- **[issue-919] Internal: shared-helper catalog for the client utility modules** — Added a discovery index and a drift-guard test so the client's pure helper modules stay easy to find and can't silently fall out of the catalog. No user-facing change.-- **City keeps a clear plaza around the AI Core** — downtown buildings that would otherwise grid onto the central AI Core landmark are now pushed out to the edge of a one-cell plaza, so no building or label overlaps the core (a lone app sits at the plaza's front edge facing the camera). The warehouse district is unaffected. District neon signs also gain a styled back panel with a thin accent strip so they read as finished objects when seen from behind instead of flat black cutouts.+- **City keeps downtown clear of the AI Core** — downtown buildings that would otherwise grid onto the central AI Core landmark are now pushed out onto a one-cell plaza ring (dodging occupied slots so two buildings never stack), so no downtown building or label overlaps the core; a lone app sits at the front of the plaza. The warehouse district keeps its existing placement. District neon signs also gain a styled back panel with a thin accent strip so they read as finished objects when seen from behind instead of flat black cutouts.## Fixeddiff --git a/client/src/components/city/cityLayout.js b/client/src/components/city/cityLayout.jsindex af65127685..473bc7bf21 100644--- a/client/src/components/city/cityLayout.js+++ b/client/src/components/city/cityLayout.js@@ -4,23 +4,33 @@ import { autoColumns, gridIndexToPosition } from '../../utils/cityDistrictLayoutconst STATUS_ORDER = { online: 0, stopped: 1, not_started: 2, not_found: 3 };// Keep downtown buildings off the central AI Core landmark: anything that lands-// inside a one-cell plaza radius is pushed radially out to the plaza edge so its+// inside a one-cell plaza radius is pushed out onto the plaza ring so its// tower/label doesn't intersect the core. A building exactly at the origin has no-// direction to push, so it falls back to the front (-Z) edge facing the camera.+// radial direction, so it starts from a fixed front bearing.const CORE_CLEARANCE_RADIUS = BUILDING_PARAMS.spacing;const CENTER_FALLBACK_ANGLE = -Math.PI / 2;const cleanZero = (n) => (Math.abs(n) < 1e-9 ? 0 : n);+const slotKey = (x, z) => `${Math.round(x)},${Math.round(z)}`;-const clearCorePlaza = (x, z) => {- const dist = Math.hypot(x, z);- if (dist >= CORE_CLEARANCE_RADIUS) return { x, z };-- const angle = dist > 0 ? Math.atan2(z, x) : CENTER_FALLBACK_ANGLE;- return {+// Push a cell that sits inside the core plaza out onto the plaza ring, starting+// from its own radial bearing (or the front fallback for a dead-centre cell) and+// fanning out in 45° steps to dodge any slot already taken. Without the dodge, an+// odd×odd grid's centre cell would land on the front-edge cell that's already on+// the ring (e.g. 9 apps → two buildings stacked at (0, -spacing)).+const placeOnPlazaRing = (x, z, occupied) => {+ const baseAngle = (x === 0 && z === 0) ? CENTER_FALLBACK_ANGLE : Math.atan2(z, x);+ const onRing = (angle) => ({x: cleanZero(Math.cos(angle) * CORE_CLEARANCE_RADIUS),z: cleanZero(Math.sin(angle) * CORE_CLEARANCE_RADIUS),- };+ });+ for (let step = 0; step < 8; step++) {+ // 0, +45, -45, +90, -90, … — radial bearing first, then fan symmetrically.+ const offset = Math.ceil(step / 2) * (step % 2 === 1 ? 1 : -1) * (Math.PI / 4);+ const slot = onRing(baseAngle + offset);+ if (!occupied.has(slotKey(slot.x, slot.z))) return slot;+ }+ return onRing(baseAngle);};export const computeCityLayout = (apps) => {@@ -40,24 +50,41 @@ export const computeCityLayout = (apps) => {const positions = new Map();const { spacing } = BUILDING_PARAMS;+ const occupied = new Set();// Downtown district (active apps): a roughly-square grid centered on the origin (both axes).const activeCols = autoColumns(active.length);const activeRows = Math.ceil(active.length / activeCols);- active.forEach((app, i) => {+ const downtownCells = active.map((app, i) => {const [x, , z] = gridIndexToPosition(i, { columns: activeCols, spacing, rowCount: activeRows });- positions.set(app.id, { ...clearCorePlaza(x, z), district: 'downtown', height: getBuildingHeight(app) });+ return { app, x, z };+ });++ // Pass 1: cells already clear of the plaza keep their grid slot (and reserve it).+ const insidePlaza = [];+ downtownCells.forEach((cell) => {+ if (Math.hypot(cell.x, cell.z) >= CORE_CLEARANCE_RADIUS) {+ occupied.add(slotKey(cell.x, cell.z));+ positions.set(cell.app.id, { x: cell.x, z: cell.z, district: 'downtown', height: getBuildingHeight(cell.app) });+ } else {+ insidePlaza.push(cell);+ }+ });++ // Pass 2: cells inside the plaza get pushed to a free spot on the plaza ring.+ insidePlaza.forEach((cell) => {+ const { x, z } = placeOnPlazaRing(cell.x, cell.z, occupied);+ occupied.add(slotKey(x, z));+ positions.set(cell.app.id, { x, z, district: 'downtown', height: getBuildingHeight(cell.app) });});// Warehouse district (archived apps): X-centered grid offset along +Z from downtown.+ // Placement is unchanged by the plaza clearance (downtown-only); see PLAN.md for the+ // separate all-archived warehouse-near-core follow-up.if (archived.length > 0) {const archiveCols = autoColumns(archived.length);- // Floor the downtown row count to 1 so an all-archived install (no active- // apps → activeRows 0/NaN) still offsets the warehouse clear of the core- // plaza instead of collapsing it onto the origin.- const downtownRows = activeRows || 1;- const warehouseZ = downtownRows * spacing / 2 + DISTRICT_PARAMS.gap;+ const warehouseZ = activeRows * spacing / 2 + DISTRICT_PARAMS.gap;archived.forEach((app, i) => {const [x, , z] = gridIndexToPosition(i, {diff --git a/client/src/components/city/cityLayout.test.js b/client/src/components/city/cityLayout.test.jsindex ea8643441c..02d811fda8 100644--- a/client/src/components/city/cityLayout.test.js+++ b/client/src/components/city/cityLayout.test.js@@ -44,6 +44,20 @@ describe('computeCityLayout', () => {expect(pos.get('y')).toMatchObject({ x: 6, z: 10, district: 'warehouse' });});+ it('never stacks two downtown buildings when clearing the core plaza', () => {+ // 9 apps → 3×3 grid: the centre cell sits on the core and must move, but the+ // front-edge slot is already taken, so it must dodge to a free ring slot rather+ // than stack. Assert every resolved position is unique.+ const pos = computeCityLayout(Array.from({ length: 9 }, (_, i) => online(String(i))));+ const seen = new Set();+ for (const p of pos.values()) {+ const key = `${Math.round(p.x)},${Math.round(p.z)}`;+ expect(seen.has(key)).toBe(false);+ seen.add(key);+ }+ expect(seen.size).toBe(9);+ });+it('sorts active apps online-first so status drives grid order', () => {const pos = computeCityLayout([{ id: 'stopped', overallStatus: 'stopped', archived: false },