Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

Merge remote-tracking branch 'upstream/main' into q686

daikaginzabea76df4547f
diff --cc CHANGELOG.md
index 01b31531f,39cf9b524..aa7983e00
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -1,16 -1,183 +1,194 @@@
# Changelog
+ ## [Unreleased]
+
+- Bound what a caller can grow through `/api/terrain/heights`. Every distinct
+ 5-decimal point was a permanent in-memory entry, a permanent line in an
+ uncapped `.gev-cache/terrain-heights.json`, and a live upstream call, with
+ nothing limiting the rate and only a finite-number check on the coordinates.
+ Coordinates outside WGS-84 range are now rejected with `400`, the point cache
+ holds at most 50,000 entries and evicts oldest-first, a cache file above
+ 24 MB is not read back, and the route is limited to 90 requests/minute per
+ client (270 global). Evicting a point costs one refetch, never a wrong
+ answer, since terrain does not move. Ordinary use is unaffected: a full
+ `test:track` run drives 10 requests, peaking at 8/min.
+
+ ## [0.2.1] — 2026-10-02 — God's Eye View through Your Agent (with security fixes and other features)
+
+ - Ship each bundled data pack once. The region, marine, admin-boundary,
+ county, military-name and neighborhood packs were emitted twice by the
+ production build, as the JSON the browser fetches and as an unused
+ JavaScript copy; `dist/` drops from 54 MB to 42 MB. Under Node the loader
+ reads the JSON file directly (reporting that Node 24.14 or newer is needed
+ on a runtime too old to do so), and a test keeps app code from importing a
+ pack as a module.
+
+ - Apply the Host check before the app's own routes. Vite installs its Host
+ check after the middleware that plugins add, so the provider and `/api`
+ routes used to answer any Host, including a DNS-rebinding name, in every
+ mode. A first-running middleware now applies the same allowed hosts on the
+ dev and preview servers.
+
+ - Refuse cross-site browser requests to the cost-bearing and log endpoints
+ (`/api/realtime/token`, `/api/openai/hud-summary`,
+ `/api/google/nearby-places`, `/api/google/text-search`,
+ `/api/realtime/debug-log`): a foreign or opaque
+ Origin, a cross-site `Sec-Fetch-Site`, or proxy forwarding headers get 403,
+ while loopback tools and LAN use keep working. The dev and preview servers
+ send one shared Content-Security-Policy (James Sumpter, #242).
+
+ - The voice debug log records the server's own time: a record can no longer
+ supply its `loggedAt`. The dev and preview servers also send
+ `X-Content-Type-Options: nosniff` (findings by Sunil, #710).
+
+ - Keep the Host-header check when binding to all interfaces. `HOST=0.0.0.0`
+ used to accept any Host; the dev and preview servers now accept IP
+ addresses, `localhost` and the LAN hostnames listed in `GEV_ALLOWED_HOSTS`
+ (suffix and wildcard entries are ignored), which also keeps DNS-rebinding
+ names out in LAN mode. The `.local` suffix is no longer accepted by default;
+ list such a name explicitly (Puspo Aditya, #97, fixes #21).
+
+ - Throttle the cost-bearing proxies by default instead of on request. The
+ OpenAI endpoints (`/api/realtime/token`, `/api/openai/hud-summary`) now allow
+ 30 requests per minute per client IP and the Google Places endpoints
+ (`/api/google/nearby-places`, `/api/google/text-search`) 120 — the caps the
+ Pinokio build already ships, so the packaged app is unaffected and only an
+ unconfigured server changes, from unlimited to what the product already runs
+ with. `GEV_RATELIMIT_OPENAI_PER_MIN` and `GEV_RATELIMIT_GOOGLE_PER_MIN` still
+ override the caps, and exactly `0` disables them; a value that cannot be read
+ as a number now falls back to the default rather than to unlimited, so a typo
+ cannot silently disarm the guard (daikaginza, #683).
+
+ - Tighten the local MCP server and embed mode. The panel's `panel_request`
+ needs the key in its MCP server's panel page, and refuses Provider
+ Settings, credential and model endpoints, `/mcp` and development server
+ routes in any letter case, encoding or dot suffix; panels on one server share six
+ requests in flight, and further requests wait their turn. `/mcp` applies Provider Settings' proxy and sharing checks,
+ requires a Host on the port it reached and an Origin from that host, and
+ times out request bodies after 30 seconds; stdio honors
+ `notifications/cancelled`. Embed mode is no longer framable unless
+ `GEV_EMBED_FRAME_ANCESTORS` allows the framing page, and view answers go
+ only to the origin that sent the view. SECURITY.md describes the MCP surface
+ and the panel's browser keys.
+
+ - Cockpit now enters on the existing matching map style while keeping one fixed,
+ duplicate-free carousel over `Normal / CRT / NVG / FLIR / Anime / Noir / Snow`.
+ Normal remains a real unfiltered option; Cockpit-only choices still restore
+ the captured map style through both Exit Cockpit and Reset.
+ - Cyber's compact right-rail and Cockpit utility buttons now center their glyphs
+ vertically and share the same inset and edge alignment.
+ - Keep Cyber Voice help/error popups and Location/Visual Presets pins clear of
+ their decorative frames. Leave space above attribution for its full logo row.
+ - Add an intentionally future-facing, opt-in panel surface contract for new
+ panels to inherit compatible Normal, Cyber and Cockpit styling. Its first
+ production adopter will land separately after this change.
+ - Restore the user's previous visual preset when they explicitly switch from
+ Cyber to another HUD layout, without overriding scene or shared-link state.
+ - Move the aligned Cyber side-panel rails upward on desktop so the left stack
+ clears the lower coordinate card; keep Cockpit's independent visor layout.
+
+ ## [0.2.0] — 2026-10-02 — God's Eye View through Your Agent
+
+ - Show God's Eye View inside AI conversations. Answers that can be shown
+ include a view (camera, layers, style, map, marks, something to follow),
+ and `show_in_gods_eye_view` displays it as the live globe in clients that
+ support MCP Apps, such as Claude Desktop and the Codex and ChatGPT desktop
+ apps, and as a link everywhere else. The panel loads the app's panel build
+ (`npm run build:panel`) and its data through the MCP server, so a local
+ server needs no HTTPS or tunnel. `?embed=1` shows the globe alone for pages
+ that frame the app.
+
+ - Add tools for language-model clients and a local MCP server, served over
+ stdio by `npm run mcp` and over HTTP at `/mcp` on the development and preview
+ servers for local requests only. `npm run mcp`
+ serves earthquake, active-fire, launch, aircraft, ship, satellite, camera, radio,
+ place, routing, bike-share, transit, traffic, weather, cyclone, fire-perimeter,
+ terrain, installation and map-feature queries, plus a situation brief, over
+ stdio to clients such as Claude Code, reading
+ from a running app. Tools are defined
+ once in `gods-eye-view/tools`, reuse the layers' source factories, and are
+ exposed through the protocol adapter in `gods-eye-view/tools/mcp`. The
+ catalog also covers weather maps, wind, recent imagery, submarine cables,
+ license plate reader cameras, datacenters and dams, the Bhote Koshi flood,
+ military awareness and links that open the app over an area with layers on.
+ Voice offers the same queries next to its app actions.
+
+ - Public Overpass instances are no longer used by default. Street Traffic
+ roads come from TomTom flow tiles, OpenFreeMap vector tiles, or both, chosen
+ on the layer row (TomTom / OSM / Hybrid) or with `?trafficRoads=`. With a
+ TomTom key the default is Hybrid: TomTom roads with live flow, plus
+ OpenFreeMap roads TomTom does not cover, simulated. Without a key every
+ choice draws OpenFreeMap roads. TomTom mode shows only roads with flow; OSM
+ mode matches TomTom flow onto OpenFreeMap roads for congestion colors,
+ speeds and closures, and unmatched roads stay simulated. Road failures name
+ OpenFreeMap and retain HTTP status or timeout reasons separately from TomTom.
+ Flow coverage counts
+ rendered dots on roads with flow; mapped military areas come from OpenFreeMap and
+ follow settled camera changes with cached tiles and retained site entities.
+ Superseded requests preserve the next view’s pending load.
+ Tile and API transports can be injected independently; the optional Overpass
+ ALPR adapter remains available.
+ OSM-derived layers share one attribution entry and a persistent inline map credit,
+ including routing, Warendorf cameras, datacenters, dams and the Nepal locator.
+ Military areas use bundled Overture/OSM names; wide views show bounded,
+ decluttered named points that follow camera motion while Contacts holds a subject,
+ using the shared world-overlay host for wide-point and polygon titles. Polygons appear while names load; cancelled views
+ cannot publish late names, and stalled name downloads can retry. Merged groups
+ keep their identity and parent name when a pan hides the largest member. Late
+ names reconcile ids across zooms while retaining selection and marker ownership. Wide
+ named points remain visible until matching close polygons take over. Installation
+ titles share datacenter/dam card arbitration and keep incumbents while panning.
+ Selecting an installation replaces its label with one card; deselection restores it.
+ Selected footprints receive a translucent fill draped on the active map surface.
+ ALPR cameras come from an hourly OpenStreetMap extract (US and Canada). Features
+ without a replacement say they are unavailable; area and footprint
+ annotations check once whether an Overpass instance is configured and skip
+ the query when none is. Area annotations outline countries, states and provinces
+ (Natural Earth, including UK constituent countries) and US counties (US Census Bureau) from bundled data, with no
+ lookup. County names are disambiguated across countries by aliases, qualifiers
+ and geography. `OVERPASS_UPSTREAMS` sets an
+ Overpass instance you run or pay for. The cockpit regional brief resolves
+ regions from bundled Natural Earth data instead of Nominatim. Traffic starts on enable and paints
+ locally grounded roads incrementally, shares concurrent tile requests and
+ reuses validated heights across pans. Camera moves and arriving tiles retain
+ existing traffic dots on their roads; budget changes fade in/out incrementally,
+ height refinements ease vertically, and live flow changes color and speed in
+ place. The traffic footprint follows the reticle square at oblique angles, with
+ cached detailed near tiles and coarse distant roads. Failed detail tiles retain
+ coarse roads and retry at most three times. Road-pass deadlines also cancel
+ queued tile paints and terrain callbacks;
+ off-screen height corrections cannot hold loading open, and visible corrections
+ stay pixel-limited at canvas and camera-plane boundaries. Completed road snapshots replace
+ streamed previews without duplicating roads. Unresolved previews no longer delay or suppress detailed street roads.
+ Road admission excludes private, parking, walking and unknown traffic categories;
+ OpenStreetMap service ways and tunnels no longer receive surface vehicles.
+ Detail tiles load alongside previews, arrival bypasses the movement debounce,
+ and geographically validated rendered depth avoids repeated mesh redraws.
+ Traffic releases surface-frame listeners on disable/destroy and reuses unchanged
+ surface identities without frame-by-frame allocations.
+ Grounded dots respect building occlusion instead of drawing through roofs,
+ and the traffic status chip reports completion without a delayed text animation.
+ Short road chunks and local surface elevation keep the budget on visible
+ streets in elevated cities. Congestion and closures respect travel
+ direction. ALPR distinguishes unsupported coverage from empty results and
+ asks for zoom-in before exceeding its tile budget. Installation footprints
+ retain visible fragments without joining separate parcels across zooms or
+ across quantization gaps between different mapped identities. Keyless
+ terrain tiles retry HTTP 429 and transient gateway failures with bounded,
+ shared backoff. Operator-configured Overpass area and footprint queries
+ retain relation member geometry so their outlines remain available.
+ Contacts filters mapped installations to a true 100 km surface radius around
+ the current tracked subject,
+ including in Cockpit, instead of "?" or nothing. Search arrivals frame against the resolved
+ ground and lift the eye above the rendered surface, so Camp Mabry and Denver
+ no longer land underground (Milan Khanal, #118). Arrival corrections yield to
+ new camera owners and are cancelled on layer/app teardown. ALPR floor preparation
+ and marker placement share terrain requests, cancelled when the layer is disabled.
+ Map-source changes reposition every ALPR marker without replacing entities. ALPR loads
+ whole-city views from z9-z12 tiles, drops native ground wedges and clamping,
+ keeps frame time with ALPR on within a few percent of ALPR off, seats nearby
+ badges on the rendered surface and says when no loaded camera is on screen.
+
- CCTV cameras whose bearing is a guess now say so. Packs mark bearings derived
from a hash of the camera id as `headingConfidence: 'low'`, but nothing read the
flag, so roughly 70% of a default catalog rendered like surveyed facings. The HUD
diff --cc scripts/format-scope.json
index 37abecbe1,52f76357b..4b5d830bb
--- a/scripts/format-scope.json
+++ b/scripts/format-scope.json
@@@ -845,5 -855,45 +855,46 @@@
"src/ui/recentImagery.test.mjs",
"src/layers/recentImagery/testDoubles.mjs",
"scripts/qa-recent-imagery.mjs",
+ "scripts/qa-overpass-offload.mjs",
+ "src/overpassOffload.test.mjs",
+ "src/sources/openFreeMap.test.mjs",
+ "src/sources/vectorTiles.test.mjs",
+ "src/sources/militaryTileGeometry.test.mjs",
+ "src/layers/traffic/surface.test.mjs",
+ "src/layers/traffic/roadModes.test.mjs",
+ "scripts/qa-traffic-motion.mjs",
+ "src/layers/traffic/motion.test.mjs",
+ "scripts/qa-journey-recorder.mjs",
+ "scripts/qa-alpr-journey.mjs",
+ "scripts/qa-context-arrivals.mjs",
+ "src/tools/catalog.test.mjs",
+ "src/tools/area.test.mjs",
+ "src/tools/queries/queries.test.mjs",
+ "src/tools/mcp/mcp.test.mjs",
+ "src/tools/localServer.test.mjs",
+ "src/tools/queries/aviation.test.mjs",
+ "src/tools/queries/space.test.mjs",
+ "src/tools/queries/media.test.mjs",
+ "src/tools/queries/places.test.mjs",
+ "src/layers/transit/source.test.mjs",
+ "src/tools/queries/mobility.test.mjs",
+ "src/tools/queries/environment.test.mjs",
+ "src/tools/queries/maritime.test.mjs",
+ "src/tools/queries/share.test.mjs",
+ "src/tools/localRoute.test.mjs",
+ "src/tools/queries/atmosphere.test.mjs",
+ "src/tools/queries/imagery.test.mjs",
+ "src/tools/queries/cables.test.mjs",
+ "src/tools/queries/surveillance.test.mjs",
+ "src/tools/queries/infrastructure.test.mjs",
+ "src/tools/queries/events.test.mjs",
+ "src/tools/functions.test.mjs",
+ "src/tools/surfaces.test.mjs",
+ "src/tools/places.test.mjs",
+ "src/view/index.test.mjs",
+ "src/tools/views.test.mjs",
+ "src/app/embed.test.mjs",
+ "src/tools/globePanel.test.mjs",
- "src/costEndpointThrottle.test.mjs"
++ "src/costEndpointThrottle.test.mjs",
+ "src/terrainHeightsBounds.test.mjs"
]