feat(app): voice on the Navara engine

createViewerlessTools creates the voice commands with viewer: null on the
engine (tools.js passes it the voice options and place search), so
window.__gevVoiceCommands exists in ?engine=navara: the W1 tools drive the
engine and the viewer-only tools answer UNAVAILABLE_ON_ENGINE. The Cesium
path hands its engine to initGevVoiceCommands explicitly.

viewerlessTools.test.mjs: the Navara tools now return voice commands
(created without DOM through injected control and session stand-ins),
whose runner answers get_current_view_state on the engine and refuses
control_scene; the debug handle carries them and teardown removes them.
This commit is contained in:
German Khokhlov committed 2026-10-16 22:52:21 +04:00
1 parent bc281ab246
commit 18b5475b8a
3 files changed
+74 -12

No files matched your search

+28 -3
View File
@@ -12,6 +12,7 @@ import {
installRenderGovernor,
uninstallRenderGovernor,
} from '../renderGovernor.js';
import { initGevVoiceCommands } from '../voice/gevRealtime.js';
/** The Navara globe module, loaded on demand. */
const loadNavaraGlobeModule = async () =>
@@ -109,14 +110,17 @@ export async function createNavaraScene({
/**
* The tools without a viewer (the experimental Navara engine): the startup
* chrome, the render governor on the engine, hidden-tab handling and the
* debug handle. The shell shows which features are unavailable.
* chrome, the render governor on the engine, hidden-tab handling, voice on
* the engine and the debug handle. The shell shows which features are
* unavailable.
*/
export function createViewerlessTools({
scene: { engine, mapStackController, operations },
controls: { styleManager },
data,
loadingScreen,
placeSearch,
voice = {},
startChrome,
signal,
defer,
@@ -170,5 +174,26 @@ export function createViewerlessTools({
defer(() => {
if (window.__godsEyeView === debug) delete window.__godsEyeView;
});
return { sceneDirector: null, annotations: null, voiceCommands: null };
// Voice on the engine (phase 3, Task 9): the W1 tools drive the engine;
// the viewer-only ones (director, annotations, cockpit, radio…) refuse.
const voiceCommands = initGevVoiceCommands({
...voice,
annotationResolver: operations.annotationResolver,
searchNavigation: operations.searchAndFlyTo,
signal,
placeSearch,
viewer: null,
engine,
styleManager,
dataManager,
sceneDirector: null,
annotations: null,
});
defer(() => {
voiceCommands.stop({ removeUi: true });
if (window.__gevVoiceCommands === voiceCommands)
delete window.__gevVoiceCommands;
});
debug.voiceCommands = voiceCommands;
return { sceneDirector: null, annotations: null, voiceCommands };
}