Merge origin/main into german/navara

Conflict resolutions:
- src/main.js: upstream's PHOTON_URL place-search setting is read once at
  module level and passed as geospatial: { endpoints: { photon } } by
  createApplication(), so every engine start of the switch flow gets it; the
  old single top-level createStandaloneApplication() call stays removed.
- src/layers/bikeshare/render/cesium/rendering.js: upstream's
  publishedCapacity fix applied with this branch's
  resolveCapacity(model, capacity, status) signature. The same fix is ported
  to src/layers/bikeshare/render/navara.js (record.publishedCapacity, status
  polls resolve from it), with a Navara regression test; upstream's
  proxyRoute test imports the moved render/cesium/rendering.js.
- src/layers/traffic/flow.js: upstream's nextTask() yield and current()
  check kept before the scene is taken from this branch's
  _trafficScene?.() ?? _viewer?.scene with its missing-scene return.
- scripts/package-boundaries.json, scripts/format-scope.json: union of both
  sides' file lists.
- src/voice/actionSchemas.test.mjs: both history comments kept, payload hash
  recomputed for the merged schemas (Sentinel-2 map stack enum plus the
  shorter layer alias hint).
- src/hudAltitudeDatum.test.mjs: this branch's engine-based IntelHUD
  construction with upstream's placeLabels summary context.
This commit is contained in:
German Khokhlov committed 2026-11-03 15:36:06 +04:00
commit 1a1eef0e5c
494 files changed
+28358 -1361

No files matched your search

+1
View File
@@ -174,6 +174,7 @@ const schemas = [
'cctv-panel',
'radio-panel',
'scene-panel',
'utilities-panel',
'pp-toggles',
'global-context-panel',
'weather-panel',
+4 -1
View File
@@ -43,12 +43,14 @@ test('the complete Realtime tool payload pins the manifest-generated layer relea
// Globe rotation adds one motion; visual keyhole fit and explicit
// reset guidance/defaults update only move_camera and mode descriptions.
// S2 GhostMaps extends the generated layer enums.
// The Utilities panel (Directions, Draw, Import) adds one panel target.
// Panel adds named voice targets and timeout; shared Panel/Cockpit guidance
// is consolidated without changing either feature's arguments.
// Snow leaves the set_visual_style enum.
// The Operator HUD layout leaves set_hud's layout enum.
// EOX Sentinel-2 joins the set_map_stack enum.
'c245fc20cb7927181d7dec212ec60279aaa1fdeb494720a7d2ff11e00008a6c6',
// The layer alias hint leaves out aliases the layer id already spells.
'e5ea67d462544eb19d43e6e42837b49346e220f01d58ba1f017bc11dd9d7c053',
);
});
@@ -143,6 +145,7 @@ test('all legacy action arguments are byte-identical after removing the delibera
'voice-settings',
'voice-preview',
'provider-settings',
'utilities-panel',
].includes(id),
);
for (const tool of legacy) {
+27 -9
View File
@@ -101,6 +101,12 @@ const PANEL_ALIASES = new Map([
['global context', 'global-context-panel'],
['right context', 'global-context-panel'],
['context right panel', 'global-context-panel'],
['utilities', 'utilities-panel'],
['utilities panel', 'utilities-panel'],
['draw', 'utilities-panel'],
['drawing', 'utilities-panel'],
['import', 'utilities-panel'],
['import files', 'utilities-panel'],
['authoring', 'scene-panel'],
['scenes', 'scene-panel'],
['scene', 'scene-panel'],
@@ -124,6 +130,7 @@ const PANEL_IDS = new Set([
'cctv-panel',
'radio-panel',
'global-context-panel',
'utilities-panel',
'scene-panel',
'pp-toggles',
'weather-panel',
@@ -1155,15 +1162,18 @@ export function createGevActionRunner({
if (name === 'show_data_layers_menu') {
const layerId = normalizeLayerId(args.layerId || args.layer);
setPanelOpen(styleManager, 'data-panel', true);
const focusedLayer =
const row =
layerId && dataManager.layers.has(layerId)
? focusDataLayerRow(layerId)
? findDataLayerRow(layerId)
: null;
// Open the panel that holds the row: Directions lives in Utilities.
const panelId = row?.closest('[data-panel-id]')?.id || 'data-panel';
setPanelOpen(styleManager, panelId, true);
const focusedLayer = row ? focusDataLayerRow(row, layerId) : null;
return {
ok: true,
action: 'show_data_layers_menu',
panelId: 'data-panel',
panelId,
focusedLayer,
layers: dataManager
.getAll()
@@ -2343,7 +2353,11 @@ export async function controlRadio(
if (!radioActionIsCurrent(options)) return cancelled(summarize);
const prepared = state.selected
? true
: radio.cycleStation?.(1, { focus: false, autoplay: false });
: radio.cycleStation?.(1, {
focus: false,
autoplay: false,
fallback: true,
});
return {
ok: Boolean(prepared),
action: 'control_radio',
@@ -2367,6 +2381,7 @@ export async function controlRadio(
const selected = radio.cycleStation?.(action === 'next' ? 1 : -1, {
focus: false,
autoplay: false,
fallback: true,
});
return {
ok: Boolean(selected),
@@ -3332,11 +3347,14 @@ function normalizeCockpitAction(value) {
return null;
}
function focusDataLayerRow(layerId) {
const row = document.querySelector(
`#data-toggles [data-layer-id="${CSS.escape(layerId)}"]`,
function findDataLayerRow(layerId) {
const selector = `[data-layer-id="${CSS.escape(layerId)}"]`;
return document.querySelector(
`#data-toggles ${selector}, #utilities-toggles ${selector}`,
);
if (!row) return null;
}
function focusDataLayerRow(row, layerId) {
row.scrollIntoView({ block: 'center', behavior: 'smooth' });
row.classList.remove('gev-voice-focus');
void row.offsetWidth;
+96 -1
View File
@@ -753,6 +753,61 @@ test('Data Layers voice inventory hides the Context coordinator while current-vi
assert.deepEqual(current.cockpit, { active: false, entryAllowed: true });
});
test('showing a layer opens the panel that holds its row: Directions lives in Utilities', async () => {
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
const previous = { document: globalThis.document, CSS: globalThis.CSS };
const focused = [];
const rowIn = (panelId) => ({
dataset: { layerName: panelId === 'utilities-panel' ? 'Directions' : 'Live Flights' },
classList: { add: (name) => focused.push(name), remove() {} },
scrollIntoView() {},
closest: (selector) => (selector === '[data-panel-id]' ? { id: panelId } : null),
});
const rows = { directions: rowIn('utilities-panel'), flights: rowIn('data-panel') };
// Each row is found only inside the list that really holds it.
const lists = { directions: '#utilities-toggles', flights: '#data-toggles' };
globalThis.CSS = { escape: (value) => value };
globalThis.document = {
querySelector: (selector) => {
for (const part of selector.split(',')) {
const [, list, id] = /^\s*(#[\w-]+) \[data-layer-id="([^"]+)"\]\s*$/.exec(part) || [];
if (id && lists[id] === list) return rows[id];
}
return null;
},
};
try {
const opened = [];
const layers = [
{ id: 'flights', name: 'Live Flights', enabled: false, showInTogglePanel: true, stats: {} },
{ id: 'directions', name: 'Directions', enabled: false, showInTogglePanel: true, stats: {} },
];
const dataManager = {
layers: new Map(layers.map((layer) => [layer.id, { module: {} }])),
getAll: () => layers,
};
const styleManager = {
setPanelCollapsed: (panelId, collapsed) => opened.push([panelId, collapsed]),
};
const viewer = {
clock: { onTick: { addEventListener: () => () => {} } },
scene: { canvas: { addEventListener() {}, removeEventListener() {} } },
camera: { moveEnd: { addEventListener() {} } },
};
const runner = createGevActionRunner({ viewer, styleManager, dataManager });
const directions = await runner('show_data_layers_menu', { layerId: 'directions' });
assert.equal(directions.panelId, 'utilities-panel');
assert.deepEqual(directions.focusedLayer, { id: 'directions', name: 'Directions' });
const flights = await runner('show_data_layers_menu', { layerId: 'flights' });
assert.equal(flights.panelId, 'data-panel');
assert.deepEqual(opened, [['utilities-panel', false], ['data-panel', false]]);
assert.deepEqual(focused, ['gev-voice-focus', 'gev-voice-focus']);
} finally {
globalThis.document = previous.document;
globalThis.CSS = previous.CSS;
}
});
test('generic layer visibility forwards cancellation and reports semantic failure', async () => {
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
const viewer = {
@@ -1860,7 +1915,7 @@ test('voice Radio resolves Austin and exposes semantic selection, volume, pause,
assert.equal(result.radioAction, 'play');
assert.equal(result.stationId, 'nearest');
assert.equal('station' in result, false);
assert.deepEqual(calls.at(-1), ['cycle', 1, { focus: false, autoplay: false }]);
assert.deepEqual(calls.at(-1), ['cycle', 1, { focus: false, autoplay: false, fallback: true }]);
for (const invalidCoordinates of [
{ latitude: null, longitude: null },
@@ -3981,3 +4036,43 @@ test('set_panel_open accepts the Authoring name for the scene panel', async () =
}
assert.deepEqual(calls.at(-1), ['scene-panel', false, { explicit: true }]);
});
test('set_panel_open reaches the Utilities panel by its name, Draw or Import', async () => {
const calls = [];
const runner = createGevActionRunner({
viewer: {
clock: { onTick: { addEventListener: () => () => {} } },
scene: { canvas: { addEventListener() {}, removeEventListener() {} } },
camera: {
moveEnd: { addEventListener() {} },
positionWC: Cesium.Cartesian3.fromDegrees(-97.7, 30.2, 1000),
},
},
styleManager: {
setPanelCollapsed: (...args) => calls.push(args),
},
dataManager: { layers: new Map(), isEnabled: () => false, getAll: () => [] },
});
for (const panel of ['utilities-panel', 'utilities', 'drawing', 'import']) {
const result = await runner('set_panel_open', { panelId: panel, open: true });
assert.equal(result.panelId, 'utilities-panel', panel);
}
assert.deepEqual(calls.at(-1), ['utilities-panel', false, { explicit: true }]);
});
test('a partial analyst card shows one partial chip', () => {
const card = presentResult('analyst_query', {
ok: true,
action: 'analyst_query',
count: 3,
feedState: 'partial',
partial: true,
unanswered: ['vessels'],
summary: '3 contacts',
scopeLabel: 'within 5 km of X',
display: { scope: 'within 5 km of X' },
coverage: {},
});
const labels = card.display.chips.map((chip) => chip.label);
assert.equal(new Set(labels).size, labels.length, JSON.stringify(labels));
});
+41 -32
View File
@@ -591,41 +591,50 @@ test('replacement input invalidates an in-flight Radio preflight immediately', (
assert.equal(controller.radioHandoffEpoch, priorEpoch + 1);
});
test('direct Radio pause or stop cancels a pending voice handoff', async () => {
const order = [];
let playbackControl = null;
const ui = createTestVoiceUi();
const controller = new GevRealtimeController({
ui,
runner: async () => ({ ok: true }),
radioLayer: {
subscribePlaybackControls(listener) {
playbackControl = listener;
return () => { playbackControl = null; };
for (const [name, control, message] of [
['direct Radio pause or stop cancels a pending voice handoff', 'stop', 'the explicit stop remains authoritative'],
[
'a direct Radio Next that does not play cancels a pending voice handoff',
{ action: 'select', origin: 'user', attemptId: null },
'the user selection is not overridden by voice playback',
],
]) {
test(name, async () => {
const order = [];
let playbackControl = null;
const ui = createTestVoiceUi();
const controller = new GevRealtimeController({
ui,
runner: async () => ({ ok: true }),
radioLayer: {
subscribePlaybackControls(listener) {
playbackControl = listener;
return () => { playbackControl = null; };
},
playForVoice: async () => {
order.push('radio-play');
return true;
},
stopPlayback: () => order.push('radio-stop'),
},
playForVoice: async () => {
order.push('radio-play');
return true;
},
stopPlayback: () => order.push('radio-stop'),
},
});
controller.debugLog = () => {};
controller.dc = {
readyState: 'open',
send() {},
close() { order.push('voice-stop'); },
};
controller.pendingRadioPlaybackResult = { ok: true, radioPlaybackRequested: true };
});
controller.debugLog = () => {};
controller.dc = {
readyState: 'open',
send() {},
close() { order.push('voice-stop'); },
};
controller.pendingRadioPlaybackResult = { ok: true, radioPlaybackRequested: true };
playbackControl('stop');
await controller.handleRealtimeEvent({
data: JSON.stringify({ type: 'response.done', response: { status: 'completed' } }),
});
playbackControl(control);
await controller.handleRealtimeEvent({
data: JSON.stringify({ type: 'response.done', response: { status: 'completed' } }),
});
assert.equal(controller.pendingRadioPlaybackResult, null);
assert.deepEqual(order, [], 'the explicit stop remains authoritative');
});
assert.equal(controller.pendingRadioPlaybackResult, null);
assert.deepEqual(order, [], message);
});
}
test('confirmed manual Radio playback closes active voice without stopping Radio', () => {
const order = [];
+15 -6
View File
@@ -525,22 +525,31 @@ const SELF_EVIDENT_IDS = new Set([
'radio',
'wind',
'directions',
// The brand is already the layer id; all spoken aliases remain accepted.
's2-ghostmaps',
]);
/** Lower case with spaces and hyphens removed: "Data centers" → "datacenters". */
const spelled = (text) => text.toLowerCase().replace(/[\s-]+/g, '');
/**
* Compact model-facing alias hint: "alias/alias→id; …" for toggleable layers
* whose id is not already the spoken word. At most two aliases per layer keep
* the tool JSON small; the runner accepts the full alias list.
* the tool JSON small; the runner accepts the full alias list. Of those two,
* an alias the id already spells ("dams"→local-dams, "weather radar"→
* weather-radar) is left out, and a layer with neither left gets no hint.
* @returns {string} One line for the layerId description.
*/
export function voiceLayerAliasHint() {
return VOICE_LAYER_MANIFEST.filter(
(entry) =>
entry.toggle && entry.aliases.length && !SELF_EVIDENT_IDS.has(entry.id),
(entry) => entry.toggle && !SELF_EVIDENT_IDS.has(entry.id),
)
.map((entry) => `${entry.aliases.slice(0, 2).join('/')}→${entry.id}`)
.map((entry) => ({
id: entry.id,
aliases: entry.aliases
.slice(0, 2)
.filter((alias) => !spelled(entry.id).includes(spelled(alias))),
}))
.filter((entry) => entry.aliases.length)
.map((entry) => `${entry.aliases.join('/')}→${entry.id}`)
.join(';');
}
+18
View File
@@ -9,6 +9,7 @@ import {
VOICE_TOGGLE_LAYER_IDS,
VOICE_CONTEXT_LAYER_IDS,
VOICE_QUERY_LAYER_IDS,
voiceLayerAliasHint,
voiceLayerAliasMap,
} from './layerManifest.js';
@@ -78,6 +79,23 @@ test('tool enums are generated from the manifest', () => {
assert.ok(panels.includes('weather-panel') && panels.includes('recent-imagery-panel'));
});
test('the alias hint leaves out names the layer id already spells', () => {
const hint = voiceLayerAliasHint();
const entries = hint.split(';').map((entry) => entry.split('→'));
const flat = (text) => text.toLowerCase().replace(/[\s-]+/g, '');
for (const [aliases, id] of entries) {
for (const alias of aliases.split('/')) {
assert.ok(!flat(id).includes(flat(alias)), `"${alias}" is already spelled by ${id}`);
}
}
const ids = entries.map(([, id]) => id);
assert.ok(!ids.includes('local-dams'), 'a layer left with no alias gets no entry');
assert.ok(!ids.includes('weather-radar'));
assert.match(hint, /(^|;)aqhi→air-quality(;|$)/, 'an alias the id does not spell stays');
assert.match(hint, /(^|;)hurricanes→weather-cyclones(;|$)/);
assert.match(hint, /(^|;)fires\/wildfires→local-firms(;|$)/);
});
test('spoken aliases resolve to real layers, keep every legacy phrase and never collide', () => {
const aliases = voiceLayerAliasMap();
for (const id of aliases.values()) assert.ok(manifestIds.includes(id), id);
+4
View File
@@ -376,6 +376,10 @@ export class RealtimeConnection {
this.stream = null;
}
if (this.audioEl) {
// This session owns the element's remote media; peer closure is not track release.
const remoteStream = this.audioEl.srcObject;
this.audioEl.srcObject = null;
remoteStream?.getTracks?.().forEach((track) => track.stop());
this.audioEl.remove();
this.audioEl = null;
}
+19 -5
View File
@@ -54,6 +54,10 @@ function browser(t) {
test('retained peer and channel callbacks cannot act after stop or enter a replacement session', async (t) => {
const { peers, streams } = browser(t);
const actions = [];
const remote = () => {
const track = { stops: 0, readyState: 'live', stop() { this.stops++; this.readyState = 'ended'; } };
return { getTracks: () => [track], track };
};
const controller = new GevRealtimeController({
runner: async (name) => { actions.push(name); return { ok: true }; },
backend: {
@@ -67,28 +71,38 @@ test('retained peer and channel callbacks cannot act after stop or enter a repla
const old = peers[0];
old.channel.handlers.get('open')();
assert.equal(controller.status, 'listening');
const oldAudio = controller.audioEl;
const oldRemote = remote();
old.ontrack({ streams: [oldRemote] });
const message = { data: JSON.stringify({ type: 'response.function_call_arguments.done', name: 'get_entity_context', call_id: 'stale', arguments: '{}' }) };
controller.stop();
assert.equal(oldRemote.track.stops, 1, 'Stop releases its owned remote track');
assert.equal(oldRemote.track.readyState, 'ended');
assert.equal(oldAudio.srcObject, null);
assert.doesNotThrow(() => old.ontrack({ streams: [{}] }));
await old.channel.handlers.get('message')(message);
await controller.start();
const current = peers[1];
current.channel.handlers.get('open')();
const audio = controller.audioEl;
const incoming = remote();
current.ontrack({ streams: [incoming] });
old.channel.readyState = 'open'; // Model an already queued callback from the old transport.
old.channel.handlers.get('open')();
await old.channel.handlers.get('message')(message);
old.ontrack({ streams: [{}] });
old.ontrack({ streams: [oldRemote] });
old.onicecandidateerror({ errorText: 'stale error' });
assert.equal(controller.status, 'listening');
assert.equal(controller.pc, current);
assert.equal(controller.audioEl, audio);
assert.equal(audio.srcObject, undefined);
assert.equal(audio.srcObject, incoming, 'a stale track cannot replace the current remote stream');
assert.equal(incoming.track.stops, 0, 'a stale callback cannot stop the current remote track');
assert.deepEqual(actions, []);
const incoming = {};
current.ontrack({ streams: [incoming] });
assert.equal(audio.srcObject, incoming, 'the current peer still delivers audio');
controller.stop();
controller.stop();
assert.equal(audio.srcObject, null);
assert.deepEqual([oldRemote, incoming].map(s => s.track.stops), [1, 1], 'repeated Stop does not restop remote tracks');
assert.equal(incoming.track.readyState, 'ended');
assert.deepEqual(streams.map(s => s.track.stops), [1, 1]);
});
+1 -1
View File
@@ -65,7 +65,7 @@ export class RealtimeRadio {
: control || {};
if (
event.origin === 'user' &&
(event.action === 'pause' || event.action === 'stop')
['pause', 'stop', 'select'].includes(event.action)
) {
this.cancelRadioHandoff();
} else if (
+4 -1
View File
@@ -422,7 +422,10 @@ function analystCard(result) {
...(result.feedState && result.feedState !== 'nominal'
? [{ label: shownFeedState(result.feedState) }]
: []),
...(result.partial ? [{ label: t('partial') }] : []),
// A partial feed state already says it.
...(result.partial && result.feedState !== 'partial'
? [{ label: t('partial') }]
: []),
],
// Coverage qualifications lead the feed detail. The bounded card groups
// overflow in its existing Notes disclosure rather than dropping them.