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

+38
View File
@@ -1827,6 +1827,44 @@ export class LayerLifecycle {
await entry.toggleChain.catch(() => {});
}
/**
* Wait until a layer's lifecycle queue is idle, following any request that
* joins it while waiting, but no longer than `timeoutMs` or `signal` allows.
* @param {string} layerId Layer id.
* @param {{signal?: AbortSignal, timeoutMs?: number}} [options]
* @returns {Promise<boolean>} true once idle; false on timeout or abort.
*/
async waitForLayerIdle(layerId, { signal, timeoutMs = 30000 } = {}) {
const entry = this.layers.get(layerId);
if (!entry) return true;
if (signal?.aborted) return false;
let timer = null;
let onAbort = null;
const givenUp = new Promise((resolve) => {
timer = setTimeout(() => resolve(false), timeoutMs);
onAbort = () => resolve(false);
signal?.addEventListener('abort', onAbort, { once: true });
});
try {
let pending;
do {
pending = entry.toggleChain;
const idle = await Promise.race([
pending.then(
() => true,
() => true,
),
givenUp,
]);
if (!idle) return false;
} while (pending !== entry.toggleChain);
return true;
} finally {
clearTimeout(timer);
signal?.removeEventListener('abort', onAbort);
}
}
_reserveLayerParamsIntent(layerId, params, origin = 'programmatic') {
const entry = this.layers.get(layerId);
if (
+45 -8
View File
@@ -1503,6 +1503,43 @@ test('waitForLayerSettled defers reconciliation until the captured queue complet
await mgr.destroyAll();
});
test('waitForLayerIdle follows queued requests and gives up at its bound', async () => {
const mgr = new DataLayerManager({});
const gates = [];
const layer = makeSlowLayer('satellites', { updateInterval: 0 });
layer.module.enable = () => new Promise((resolve) => { gates.push(resolve); });
mgr.register(layer.module);
assert.equal(await mgr.waitForLayerIdle('satellites'), true, 'idle at once');
assert.equal(await mgr.waitForLayerIdle('unknown-layer'), true);
const first = mgr.setEnabled('satellites', true);
while (!gates.length) await new Promise((resolve) => setTimeout(resolve, 1));
let idle = null;
const waiting = mgr.waitForLayerIdle('satellites', { timeoutMs: 1000 })
.then((value) => { idle = value; });
// A request that joins the queue while waiting is waited for too.
const second = mgr.setEnabled('satellites', false);
gates[0]();
await Promise.all([first, second, waiting]);
assert.equal(idle, true);
// A queue that never drains returns false at the deadline or on abort.
const hung = mgr.setEnabled('satellites', true);
assert.equal(await mgr.waitForLayerIdle('satellites', { timeoutMs: 20 }), false);
const controller = new AbortController();
const aborted = mgr.waitForLayerIdle('satellites', { signal: controller.signal });
controller.abort();
assert.equal(await aborted, false);
assert.equal(
await mgr.waitForLayerIdle('satellites', { signal: controller.signal }),
false,
'an already aborted signal returns at once',
);
for (const release of gates) release();
await hung;
await mgr.destroyAll();
});
test('programmatic Context enables neither create nor replace a restoration snapshot', async () => {
const mgr = new DataLayerManager({});
const missions = makeSlowLayer('rocket-launches', { updateInterval: 0 });
@@ -1854,10 +1891,10 @@ test('pre-transition subscribers capture the exact enabled set before user chang
test('absolute Context entry intent is excluded from its own pre-entry restore snapshot', async () => {
const mgr = new DataLayerManager({});
const missions = makeSlowLayer('rocket-launches', { updateInterval: 0 });
const satellites = makeSlowLayer('satellites', { updateInterval: 0 });
mgr.register(missions.module);
mgr.register(satellites.module);
const contacts = makeSlowLayer('military-awareness', { updateInterval: 0 });
const flights = makeSlowLayer('flights', { updateInterval: 0 });
mgr.register(contacts.module);
mgr.register(flights.module);
let snapshot = null;
mgr.subscribe((change) => {
if (shouldCaptureContextSession(change)) {
@@ -1869,13 +1906,13 @@ test('absolute Context entry intent is excluded from its own pre-entry restore s
}
});
await mgr.setEnabled('rocket-launches', true, { origin: 'user' });
await mgr.setEnabled('military-awareness', true, { origin: 'user' });
assert.deepEqual([...snapshot], []);
await mgr.setEnabled('rocket-launches', false, { origin: 'user' });
await mgr.setEnabled('military-awareness', false, { origin: 'user' });
await mgr.restoreEnabledLayerIds(snapshot, { origin: 'context-restore' });
assert.equal(mgr.isEnabled('rocket-launches'), false);
assert.equal(mgr.isEnabled('satellites'), false);
assert.equal(mgr.isEnabled('military-awareness'), false);
assert.equal(mgr.isEnabled('flights'), false);
await mgr.destroyAll();
});