Merge origin/main into german/navara

Main's new layers (drone airspace, OSM places, sea marks, ski pistes) are
Cesium-only for now: they join the layer directory and the Cesium catalog,
are built afresh for each Cesium catalog, and show as unavailable on Navara.

The zoom-out guard is a scene part that attaches to Cesium globes only. The
awareness range pulses and their echoes draw on Cesium through the awareness
display's viewer; Navara keeps the plain range ring. Camera-input wakes go
through the display, and the analyst keeps the session-owned memory with
main's area presentation. A disposed voice runner aborts work in flight, and
an engine switch still keeps the last answer.

Modules main added that read Cesium while they load (zoomOutGuard,
awarenessEcho, the ground-sampling scratch in localGeojsonCore) now build
those values on first use or use src/geo, so a Navara page still starts
without the SDK. The OSM view box reads the engine's view rectangle.

Main grew its own main chunk by 93,873 bytes gzip-9 since the merge base, so
the baseline is raised to the merged size.
This commit is contained in:
German Khokhlov committed 2026-11-04 23:11:31 +04:00
commit db9bf64821
264 files changed
+33864 -1424

No files matched your search

+127 -6
View File
@@ -1,10 +1,19 @@
/**
* The action runner wired to fakes that behave like the real services:
* aircraft records, an annotation board, the referent registry and a turn
* pointer. Shared by the cross-feature voice contract tests.
* The action runner with every cross-feature workflow wired to fakes that
* behave like the real services: aircraft records, an annotation board, OSM
* places, the real Recent Imagery layer over a manual catalog, the outline
* ladder with Kathmandu and an ambiguous "Punjab", the referent registry and
* a turn pointer. Shared by the cross-feature voice contract tests.
*/
import { createGevActionRunner } from './gevActions.js';
import { createReferentRegistry } from './referents.js';
import { createFakeEngine } from '../globe/testing/fakeEngine.js';
import { createRecentImageryLayer } from '../layers/recentImagery/index.js';
import {
fakeCatalog,
fakeRenderer,
fakeThumbnails,
} from '../layers/recentImagery/testDoubles.mjs';
globalThis.window = globalThis.window || {
clearTimeout,
@@ -12,6 +21,55 @@ globalThis.window = globalThis.window || {
requestIdleCallback: null,
};
const square = (w, s, e, n) => [
[w, s],
[e, s],
[e, n],
[w, n],
[w, s],
];
const punjab = (country, box) => ({
kind: 'state',
name: 'Punjab',
country,
source: 'natural-earth',
polygons: [[square(...box)]],
});
/** Bundled units sharing a name, as data/adminBoundaries.js lists them. */
const PUNJABS = [
punjab('India', [73.9, 29.5, 76.9, 32.5]),
punjab('Pakistan', [69.3, 27.7, 73.8, 34.0]),
];
/**
* The annotation outline ladder: Kathmandu comes back from the guarded
* Nominatim route; any other name anchors with no outline.
*/
async function resolveAnnotationTarget({ target }) {
if (/kathmandu/i.test(target || ''))
return {
lat: 27.7,
lon: 85.3,
label: 'Kathmandu', // i18n-ignore: harness fixture place name
ring: null,
resolveOutline: async () => ({
ring: square(85.2, 27.6, 85.4, 27.8),
polygons: [[square(85.2, 27.6, 85.4, 27.8)]],
synthesized: false,
outlineSource: 'nominatim',
}),
};
return { lat: 37.795, lon: -122.393, ring: null };
}
const HOSPITALS = [
{ id: 'node/1', lat: 27.7, lon: 85.31, tags: { name: 'Bir Hospital' } },
{ id: 'node/2', lat: 27.71, lon: 85.33, tags: { name: 'Military Hospital' } },
{ id: 'node/3', lat: 27.72, lon: 85.35, tags: {} },
];
/** An annotation board that marks every spec it is given. */
function fakeAnnotations() {
const marks = [];
@@ -22,8 +80,11 @@ function fakeAnnotations() {
const results = specs.map((spec) => {
const mark = {
id: `anno-${(seq += 1)}`,
ring: spec.ring,
label: spec.label,
target: spec.target,
areaId: spec.areaId || null,
origin: spec.manual ? spec.origin || 'drawn' : 'voice',
createdAt: seq,
};
marks.push(mark);
@@ -32,16 +93,48 @@ function fakeAnnotations() {
return { drawn: results.length, failed: 0, results };
},
list: () => marks,
generation: () => 0,
};
}
/** The runner with aircraft, annotations, referents and a turn pointer wired. */
function osmPlacesModule() {
let records = [];
return {
setResults(next) {
records = next.slice();
},
getAnalystRecords: (max = 2000) => records.slice(0, max),
getStats: () => ({ count: records.length, lastUpdate: Date.now() }),
};
}
function realImageryLayer() {
const catalog = fakeCatalog();
const layer = createRecentImageryLayer({
catalog,
renderer: fakeRenderer(),
thumbnails: fakeThumbnails(),
host: () => ({ collection: {}, kind: 'globe' }),
now: () => new Date('2026-09-23T12:00:00Z'),
});
layer.init({ camera: {} });
layer.enable();
return { layer, catalog };
}
/**
* The runner with every workflow wired: aircraft, annotations, OSM places,
* imagery, areas, the referent registry and a turn pointer.
*/
export function harness({
flights = null,
pointer = null,
on = ['flights'],
osmHits = HOSPITALS,
osmSearch = null,
on = ['flights', 'recent-imagery'],
runnerOptions = {},
} = {}) {
const imagery = realImageryLayer();
const modules = {
flights: flights || {
getStats: () => ({ count: 3, lastUpdate: Date.now() }),
@@ -51,6 +144,8 @@ export function harness({
{ id: 'SWA3', icao24: 'a3', callsign: 'SWA3', lat: 30.2, lon: -97 },
],
},
'osm-places': osmPlacesModule(),
'recent-imagery': imagery.layer,
};
const enabled = new Set(on);
const viewer = {
@@ -58,6 +153,13 @@ export function harness({
scene: { canvas: { addEventListener() {}, removeEventListener() {} } },
camera: {
moveEnd: { addEventListener() {} },
// The view: a box over Kathmandu, in radians.
computeViewRectangle: () => ({
west: (85.2 * Math.PI) / 180,
south: (27.6 * Math.PI) / 180,
east: (85.4 * Math.PI) / 180,
north: (27.8 * Math.PI) / 180,
}),
positionCartographic: {
height: 300_000,
latitude: 0.52,
@@ -65,16 +167,33 @@ export function harness({
},
},
};
// The runner reads the view through the globe engine: the same box.
const engine = createFakeEngine();
engine.fake.script('viewRectangle', () =>
viewer.camera.computeViewRectangle(),
);
const referents = createReferentRegistry();
let snapshot = pointer;
const osmCalls = [];
const runner = createGevActionRunner({
viewer,
engine,
styleManager: {},
annotations: fakeAnnotations(),
annotationResolver: {
resolveRegionRingForQuery: async () => null,
resolveAnnotationTarget: async () => ({ lat: 37.795, lon: -122.393 }),
resolveAnnotationTarget,
},
areaOptions: {
findRegion: async () => null,
findAdminCandidates: async (q) => (/^punjab$/i.test(q) ? PUNJABS : []),
},
osmSearch:
osmSearch ||
(async (request) => {
osmCalls.push(request);
return { ok: true, features: osmHits, truncated: false };
}),
deixis: {
pointer: { activeSnapshot: () => snapshot },
referents,
@@ -103,6 +222,8 @@ export function harness({
return {
runner,
referents,
imagery,
osmCalls,
setPointer: (next) => (snapshot = next),
};
}