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

+122 -8
View File
@@ -1,3 +1,7 @@
import { nextTick } from 'vue';
import { bindAssistantPanelLayout, bindLayoutDock } from './panelLayout.js';
import { bindChatControl } from './chatControl.js';
import { bindVoiceMiniPreview } from './voiceMiniPreview.js';
import { createVoiceControl, voiceStatusLabel } from './control.js';
import { createVoiceSession } from './session.js';
import { VoiceCardControls } from './voiceCard.js';
@@ -115,7 +119,10 @@ export function createVoiceCommands({
ui.update('detail', {
text: () => detail || (idle ? t('Voice off') : t('Voice active')),
});
ui.update('button', { pressed: session.isActive() });
// A typed chat session is not the microphone.
ui.update('button', {
pressed: session.isActive() && !adapter.getStartOptions?.().textOnly,
});
ui.update('error', {
text: () =>
event.state === 'error'
@@ -136,15 +143,50 @@ export function createVoiceCommands({
observer: actionObserver,
nativeProvider: nativePanelProvider,
});
const updatePanel = panelMount ? session.subscribe(panelMount.handle) : null;
// Typed chat turns belong to the chat panel, not the voice card or panel.
const voicePresentation = (handle) => (event) => {
if (event.type !== 'state' && adapter.getStartOptions?.().textOnly) return;
handle(event);
};
const updatePanel = panelMount
? session.subscribe(voicePresentation(panelMount.handle))
: null;
const updateCard =
card && !panelMount
? session.subscribe((event) => card.handle(event))
? session.subscribe(voicePresentation((event) => card.handle(event)))
: null;
controls.voiceCard = card;
if (panelMount) {
controls.voicePanel = panelMount.panel;
controls.captureVoicePanelOperation = panelMount.captureOperation;
// An explicit, successful show hands the frame from chat to the voice
// panel, which chat's open state hides. Closing chat keeps its typed
// session, running turn and messages; reopening chat restores them.
// Focus held in chat (its composer, or chat Settings' Back) would be
// left on a hidden control, so it moves to the panel's view, as the
// panel's own tabs do; focus anywhere else stays where it is.
controls.captureVoicePanelOperation = () => {
const operation = panelMount.captureOperation();
return {
...operation,
show(view, open = true) {
const focused = globalThis.document?.activeElement;
const inChat =
Boolean(focused) &&
(ui.element('chatPanel')?.contains?.(focused) ||
focused === ui.element('chatBack'));
const result = operation.show(view, open);
if (!open || !result.ok) return result;
chat?.close();
if (inChat)
void ui.focus(
result.view === 'settings'
? ['settingsTab', 'voiceBack', 'settingsClose']
: ['previewTab', 'settingsTab', 'settingsClose'],
);
return result;
},
};
};
controls.getVoicePanelState = panelMount.snapshot;
controls.getVoicePreferences = panelHost.snapshot;
}
@@ -153,11 +195,16 @@ export function createVoiceCommands({
const reticle = pointer ? createReticle(pointer) : null;
const updatePointer = session.subscribe((event) => {
reticle?.handle(event);
if (event.type === 'state' && ['idle', 'error'].includes(event.state)) {
// A failed typed turn ends only that reply; its conversation continues.
if (
event.type === 'state' &&
(event.state === 'idle' ||
(event.state === 'error' && !adapter.getStartOptions?.().textOnly))
) {
pointer?.clear();
referents?.clear();
// Conversation memory ("those", "the last answer") ends with the
// session.
// session; area handles live for the page.
runner.resetConversation?.();
}
});
@@ -171,21 +218,88 @@ export function createVoiceCommands({
card?.outline(event);
session.sendMapEvent({ type: 'map_annotation_outline', ...event });
});
const chat = panelMount
? bindChatControl({
ui,
session,
dataManager,
onOpen: () => panelMount?.panel.close(),
})
: null;
function minimizeVoicePanel() {
const panel = ui.element('voicePanel');
const holdsFocus = panel?.contains?.(globalThis.document?.activeElement);
ui.update('voicePanel', { minimized: true });
// Keep focus on the bar's expand button, not the mic (Space there would
// end voice), without a keyboard ring.
if (holdsFocus)
void nextTick(() =>
panel
?.querySelector?.('[data-layout-minimize]')
?.focus?.({ focusVisible: false }),
);
}
const layouts = panelMount
? [
bindLayoutDock(ui),
bindAssistantPanelLayout({
ui,
name: 'chatPanel',
minimize: () => chat?.minimize({ focus: false }),
restore: () => chat?.restore({ focus: false }),
}),
bindAssistantPanelLayout({
ui,
name: 'voicePanel',
minimize: minimizeVoicePanel,
restore: () => ui.update('voicePanel', { minimized: false }),
}),
ui.on('voice-minimize', () => {
if (ui.state.voicePanel.minimized)
ui.update('voicePanel', { minimized: false });
else minimizeVoicePanel();
}),
]
: [];
const unbindMiniPreview = panelMount
? bindVoiceMiniPreview({ ui, session })
: null;
const startVoice = () => {
if (panelMount?.panel.snapshot().previewEnabled)
panelMount.panel.select('preview');
void session.start({ pushToTalk: false });
};
const buttonHandler = () => {
if (adapter.ignoreButtonClick?.()) return;
if (session.isActive()) {
chat?.close();
if (session.isActive() && adapter.getStartOptions?.().textOnly) {
session.stop();
startVoice();
} else if (session.isActive()) {
const ticket = panelMount?.stopTicket();
session.stop();
panelMount?.closeAfterStop(ticket);
} else void session.start({ pushToTalk: false });
} else startVoice();
};
const offButton = ui.on('button', buttonHandler);
// The panel's close turns voice off, as chat's close ends the chat. A typed
// session belongs to chat, which handles its own close.
const offClose = ui.on('settings-close', () => {
if (!session.isActive() || adapter.getStartOptions?.().textOnly) return;
const ticket = panelMount?.stopTicket();
session.stop();
panelMount?.closeAfterStop(ticket);
});
let cleaned = false;
const cleanup = () => {
if (cleaned) return;
cleaned = true;
offButton();
offClose();
offProvider?.();
for (const off of layouts) off();
unbindMiniPreview?.();
chat?.destroy();
annotationUnsubscribe?.();
updateStatus();
updateCard?.();