Make Space Missions an ordinary layer with its own panel

Space Missions no longer runs as a Context mode. The launches layer owns
its Satellites dependency, including the rule that a Satellites off
asked for after Space Missions was switched on ends it (request order
decides), and a small controller connects the layer to its own panel and
store. Context no longer isolates, snapshots or restores Space Missions
or Satellites, so Contacts and Space Missions run together in either
order, and scene playback no longer exits an isolating mode. Settled by
the owner: Contacts leaves Satellites as it is, and only a person's or
voice Satellites off ends Space Missions; a scene, story, preset or
other programmatic off does not.

Turning the layer on by hand or by voice, choosing it at first run, or
picking a mission on the globe opens the Space Missions panel, and on a
phone its Missions sheet. Asking voice to open the panel while the layer
is off is refused with a reason, and voice never opens it while the
Cockpit owns the screen. With no Context mode on, a voice Context off
switches Space Missions off. A failed Satellites restore no longer cuts
the layer's teardown short. Mission labels on the globe select their
mission. The layer names a failed first index load itself, so the
Context toast no longer imports Space Missions code.

Also carries the satellites request ordering and
DataLayerManager.waitForLayerIdle, the share token for the panel, voice
panel ids, Cockpit folding the panel away and the phone tab ellipsis.
The panel shares the rail gutters and hover border of the other side
panels.

On top of the Omnibar: "open space missions panel" reaches the new
panel, and Open Context no longer answers to "missions".

Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
Manjunath PaparajuandSameh Khamis authored and Sameh Khamis committed 2026-11-18 16:03:51 -08:00
1 parent 8b2ca602e5
commit 0a6fd5f43f
101 files changed
+2885 -1673

No files matched your search

+1
View File
@@ -211,6 +211,7 @@ const schemas = [
'utilities-panel',
'pp-toggles',
'global-context-panel',
'space-missions-panel',
'weather-panel',
'recent-imagery-panel',
'voice-settings',
+17 -1
View File
@@ -62,7 +62,8 @@ test('the complete Realtime tool payload pins the manifest-generated layer relea
// open_stories adds the Stories Explore entry action.
// The Cyber HUD layout leaves set_hud's layout enum (its sonar is a
// visual style; set_cyber_sonar is excluded above).
'97f78bc5e66d757da87333c515ebdbf5c2a6908156b3e676e9c2ca45e9b5e4f3',
// The Space Missions panel adds one panel target.
'09abe70ef3a1fc4320e25cff997dd3b04db7e78ff31b8530e17bbbbb8156b4c6',
);
});
@@ -195,6 +196,7 @@ test('all legacy action arguments are byte-identical after removing the delibera
'voice-preview',
'provider-settings',
'utilities-panel',
'space-missions-panel',
].includes(id),
);
for (const tool of legacy) {
@@ -342,3 +344,17 @@ test('tilt accepts an angle with no direction', () => {
validateArgs(schema, { motion: 'tilt', pitchDeg: 'steep' }).length > 0,
);
});
test('set_panel_open accepts the Space Missions panel', () => {
const schema = GEV_ACTION_SCHEMAS.find(
(tool) => tool.name === 'set_panel_open',
).parameters;
assert.deepEqual(
validateArgs(schema, { panelId: 'space-missions-panel', open: true }),
[],
);
assert.ok(
validateArgs(schema, { panelId: 'space-missions', open: true }).length > 0,
'the Context mode name is not a panel id',
);
});
+72
View File
@@ -138,6 +138,9 @@ const PANEL_ALIASES = new Map([
['global context', 'global-context-panel'],
['right context', 'global-context-panel'],
['context right panel', 'global-context-panel'],
['space missions panel', 'space-missions-panel'],
['missions panel', 'space-missions-panel'],
['mission panel', 'space-missions-panel'],
['utilities', 'utilities-panel'],
['utilities panel', 'utilities-panel'],
['draw', 'utilities-panel'],
@@ -167,6 +170,7 @@ const PANEL_IDS = new Set([
'cctv-panel',
'radio-panel',
'global-context-panel',
'space-missions-panel',
'utilities-panel',
'scene-panel',
'pp-toggles',
@@ -607,6 +611,12 @@ export function createGevActionRunner({
changeOptions,
);
}
if (layerId === 'satellites') {
// A Satellites OFF can end Space Missions, which needs it.
await dataManager.layers
.get('rocket-launches')
?.module?.waitForSatelliteIntents?.();
}
if (layerId === 'rocket-launches' || layerId === 'satellites') {
await styleManager?._waitForContextLayerSettlement?.();
}
@@ -981,6 +991,27 @@ export function createGevActionRunner({
...(!applied ? { error: say } : {}),
};
}
// The Space Missions panel exists only while its layer is on; opening it
// otherwise would fold the other right-rail panels for nothing.
if (
open &&
panelId === 'space-missions-panel' &&
!dataManager?.isEnabled?.('rocket-launches')
) {
const say = dataManager?.isEffectivelyEnabled?.('rocket-launches')
? 'Space Missions is still starting; its panel opens when it is on.'
: 'The Space Missions panel shows while Space Missions is on. Turn on Space Missions first.';
return {
ok: false,
action: 'set_panel_open',
panelId,
open,
applied: false,
unavailable: true,
say,
error: say,
};
}
if (!setPanelOpen(styleManager, panelId, open)) {
const say = 'There is no panel to open here.';
return {
@@ -1030,6 +1061,47 @@ export function createGevActionRunner({
...cancellationState(),
};
}
if (mode === 'space-missions') {
// Space Missions is an ordinary layer with its own panel, not a
// Context mode; older phrasings still reach it through this alias.
const result = await runGevAction(
'set_layer_visibility',
{ layerId: 'rocket-launches', enabled: true },
runOptions,
);
// Open the panel even when the layer was already on, but never under
// the Cockpit, which owns the screen (as the layer's own reveal).
if (
result?.ok === true &&
current() &&
!styleManager?.getCockpitState?.()?.active
) {
setPanelOpen(styleManager, 'space-missions-panel', true);
}
return {
...result,
action: 'set_context_mode',
mode: 'space-missions',
};
}
if (
mode === 'off' &&
!styleManager.getContextModeState?.()?.mode &&
dataManager.isEnabled?.('rocket-launches')
) {
// "Exit Space Missions" still arrives as context off. With no Context
// mode on, Space Missions is what is being left: switch its layer off.
const result = await runGevAction(
'set_layer_visibility',
{ layerId: 'rocket-launches', enabled: false },
runOptions,
);
return {
...result,
action: 'set_context_mode',
mode: 'off',
};
}
if (mode && mode !== 'off') {
setPanelOpen(styleManager, 'global-context-panel', true);
}
+217 -1
View File
@@ -4742,7 +4742,7 @@ test('a lost cross-mode switch reports every mode field in the shared vocabulary
styleManager,
dataManager: { layers: new Map(), getAll: () => [] },
});
const result = await runner('set_context_mode', { mode: 'space-missions' });
const result = await runner('set_context_mode', { mode: 'contacts' });
assert.equal(result.mode, 'off');
assert.equal(result.modeInternal, null);
assert.equal(
@@ -4760,6 +4760,137 @@ test('a lost cross-mode switch reports every mode field in the shared vocabulary
);
});
/** A runner over one Space Missions layer whose switch answers `enable`. */
function spaceMissionsVoiceRig({
enable = true,
cockpit = false,
missionsOn = false,
contextMode = null,
} = {}) {
globalThis.window = globalThis.window || {
clearTimeout,
setTimeout,
requestIdleCallback: null,
};
const calls = { setEnabled: [], panels: [], contextModes: [], waits: 0 };
let satellitesOn = true;
const missions = {
id: 'rocket-launches',
name: 'Space Missions (30d)',
async waitForSatelliteIntents() {
calls.waits += 1;
missionsOn = false;
return true;
},
};
const dataManager = {
layers: new Map([
['rocket-launches', { module: missions }],
['satellites', { module: { id: 'satellites', name: 'Satellites' } }],
]),
getAll: () => [
{ id: 'rocket-launches', name: missions.name, enabled: missionsOn },
{ id: 'satellites', name: 'Satellites', enabled: satellitesOn },
],
isEnabled: (id) => (id === 'rocket-launches' ? missionsOn : satellitesOn),
async setEnabled(id, enabled, options) {
calls.setEnabled.push([id, enabled, options?.origin]);
if (id === 'rocket-launches') missionsOn = enable && enabled;
else satellitesOn = enabled;
return id === 'rocket-launches' ? enable || !enabled : true;
},
};
const styleManager = {
getContextModeState: () => ({
mode: contextMode,
active: Boolean(contextMode),
}),
getCockpitState: () => ({ active: cockpit }),
setPanelCollapsed: (...args) => calls.panels.push(args),
async setContextMode(mode) {
calls.contextModes.push(mode);
return { ok: true, mode };
},
};
const runner = createGevActionRunner({
viewer: {
clock: { onTick: { addEventListener: () => () => {} } },
scene: { canvas: { addEventListener() {}, removeEventListener() {} } },
camera: { moveEnd: { addEventListener() {} } },
},
styleManager,
dataManager,
});
return { calls, runner };
}
test('set_context_mode space-missions switches the layer on and opens its panel', async () => {
for (const mode of ['space-missions', 'missions', 'space mission']) {
const { calls, runner } = spaceMissionsVoiceRig();
const result = await runner('set_context_mode', { mode });
assert.equal(result.ok, true, mode);
assert.equal(result.action, 'set_context_mode');
assert.equal(result.mode, 'space-missions');
assert.equal(result.layerId, 'rocket-launches');
assert.deepEqual(calls.contextModes, [], 'Space Missions is not a Context mode');
assert.deepEqual(calls.setEnabled, [['rocket-launches', true, 'voice']]);
assert.deepEqual(calls.panels, [
['space-missions-panel', false, { explicit: true }],
]);
}
});
test('set_context_mode off leaves Space Missions when no Context mode is on', async () => {
const { calls, runner } = spaceMissionsVoiceRig({ missionsOn: true });
const result = await runner('set_context_mode', { mode: 'off' });
assert.equal(result.ok, true);
assert.equal(result.mode, 'off');
assert.deepEqual(calls.setEnabled, [['rocket-launches', false, 'voice']]);
assert.deepEqual(calls.contextModes, [], 'Context is not asked to change');
});
test('set_context_mode off still ends Contacts first and leaves Space Missions on', async () => {
const { calls, runner } = spaceMissionsVoiceRig({
missionsOn: true,
contextMode: 'flights',
});
await runner('set_context_mode', { mode: 'off' });
assert.deepEqual(calls.contextModes, [null]);
assert.deepEqual(calls.setEnabled, []);
});
test('set_context_mode space-missions leaves the panel shut under the Cockpit', async () => {
const { calls, runner } = spaceMissionsVoiceRig({ cockpit: true });
const result = await runner('set_context_mode', { mode: 'space-missions' });
assert.equal(result.ok, true, 'the layer still switches on');
assert.deepEqual(calls.setEnabled, [['rocket-launches', true, 'voice']]);
assert.deepEqual(
calls.panels,
[],
'no panel write while the Cockpit owns the screen',
);
});
test('a Space Missions start that fails opens no panel and says so', async () => {
const { calls, runner } = spaceMissionsVoiceRig({ enable: false });
const result = await runner('set_context_mode', { mode: 'space-missions' });
assert.equal(result.ok, false);
assert.equal(result.action, 'set_context_mode');
assert.match(result.error, /Could not enable/);
assert.deepEqual(calls.panels, []);
assert.deepEqual(calls.contextModes, []);
});
test('a voice Satellites OFF waits for Space Missions to finish reacting', async () => {
const { calls, runner } = spaceMissionsVoiceRig();
const result = await runner('set_layer_visibility', {
layerId: 'satellites',
enabled: false,
});
assert.equal(result.ok, true);
assert.equal(calls.waits, 1);
});
test('an absent secondary mode stays absent instead of claiming to be off', async () => {
globalThis.window = globalThis.window || {
clearTimeout,
@@ -7480,6 +7611,91 @@ 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 Space Missions panel by its id or name', 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 ['space-missions-panel', 'space missions panel']) {
const result = await runner('set_panel_open', {
panelId: panel,
open: false,
});
assert.equal(result.panelId, 'space-missions-panel', panel);
}
assert.deepEqual(calls.at(-1), [
'space-missions-panel',
true,
{ explicit: true },
]);
});
test('set_panel_open opens the Space Missions panel only while its layer is on', async () => {
const calls = [];
let missionsOn = false;
let starting = false;
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: (id) => id === 'rocket-launches' && missionsOn,
isEffectivelyEnabled: (id) =>
id === 'rocket-launches' && (missionsOn || starting),
getAll: () => [],
},
});
const refused = await runner('set_panel_open', {
panelId: 'space-missions-panel',
open: true,
});
assert.equal(refused.ok, false);
assert.equal(refused.applied, false);
assert.match(refused.say, /Turn on Space Missions first/);
assert.deepEqual(calls, [], 'no right-rail panel is folded for nothing');
starting = true;
const early = await runner('set_panel_open', {
panelId: 'space-missions-panel',
open: true,
});
assert.equal(early.ok, false);
assert.match(early.say, /still starting/);
assert.deepEqual(calls, []);
missionsOn = true;
const opened = await runner('set_panel_open', {
panelId: 'space-missions-panel',
open: true,
});
assert.equal(opened.ok, true);
assert.deepEqual(calls, [
['space-missions-panel', false, { explicit: true }],
]);
});
test('set_panel_open reaches the Utilities panel by its name, Draw or Import', async () => {
const calls = [];
const runner = createGevActionRunner({