fix(voice): Navara refusals reach speech, analyst queries and stop_tracking

Review of 10a (low):
- The spoken answer to set_layer_visibility on a layer this engine lacks is
  the refusal's own sentence (why, and the switch to ?engine=cesium), not
  only "Couldn't turn on".
- analyst_query naming layers the catalog left out (no viewer) refuses with
  UNAVAILABLE_ON_ENGINE and the layer ids instead of answering zero.
- stop_tracking skips layers the engine does not have, so with nothing
  tracked it is a no-op success on Navara (it reported the absent military
  and satellites layers as failures).
Tests for each (the old code fails the last two); Cesium unchanged.
This commit is contained in:
German Khokhlov committed 2026-10-17 01:18:12 +04:00
1 parent 443c581280
commit 1dd3220812
3 files changed
+86 -1

No files matched your search

+7
View File
@@ -103,6 +103,13 @@ function setLayerVisibility(result, args = {}) {
if (result?.cancelled) return null;
if (!result?.ok) {
const wanted = args.enabled === false ? 'off' : 'on';
// An engine without the layer says why and what to do (the refusal's
// own sentence), not only that it failed.
if (result?.code === 'UNAVAILABLE_ON_ENGINE' && result.error)
return {
say: result.error,
display: { title: label, lines: [result.error] },
};
return {
say: `Couldn't turn ${wanted} ${label}.`,
display: { title: label, lines: [result?.error].filter(Boolean) },