feat(voice): attach feed-state provenance to analyst and HUD answers

Share one layer snapshot envelope so analyst_query, get_current_view_state,
and HUD summaries narrate the same chip feed-state instead of treating stale
or degraded feeds as live.

Co-authored-by: Matt Van Horn <[email protected]>
This commit is contained in:
Cursor AgentandMatt Van Horn committed 2026-09-12 16:00:43 +00:00
1 parent aacfa06a31
commit cfb0d6e247
15 files changed
+881 -118

No files matched your search

+66
View File
@@ -732,6 +732,9 @@ test('Data Layers voice inventory hides the Context coordinator while current-vi
assert.deepEqual(menu.layers.map(({ id }) => id), ['flights']);
const current = await runner('get_current_view_state');
assert.deepEqual(current.layers.map(({ id }) => id), ['flights', 'military-awareness']);
assert.equal(current.layers.find(({ id }) => id === 'flights').feedState, 'off');
assert.equal(current.layers.find(({ id }) => id === 'military-awareness').feedState, 'nominal');
assert.equal(current.feedProvenance.overall, 'nominal');
// The Contacts mode's internal id is 'flights'; the tools accept 'contacts'.
// State output reports the accepted word so the model cannot read its own
// active context as "off", with the internal id kept for layer reasoning.
@@ -3020,3 +3023,66 @@ test('front5: 0.99 km due EAST is the subject, though a degree box rejects it',
assert.equal(result.window.centeredOn, 'N546PC');
});
});
test('analyst_query and get_current_view_state carry stale feed provenance', async () => {
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
const now = Date.now();
const flights = {
id: 'flights',
source: 'OpenSky Network',
getStats: () => ({
source: 'OpenSky Network',
stale: true,
count: 12,
lastUpdate: now - 240_000,
}),
getAnalystRecords: () => ([
{ id: 'SWA1', icao24: 'aaa001', lat: 30.27, lon: -97.74, altitudeM: 11000, onGround: false },
]),
};
const viewer = {
clock: { onTick: { addEventListener: () => () => {} } },
scene: { canvas: { addEventListener() {}, removeEventListener() {} } },
camera: {
moveEnd: { addEventListener() {} },
positionWC: Cesium.Cartesian3.fromDegrees(-97.7, 30.2, 1000),
positionCartographic: { height: 300_000, latitude: 0.52, longitude: -1.71 },
},
};
const dataManager = {
layers: new Map([['flights', { module: flights }]]),
isEnabled: (id) => id === 'flights',
getAll: () => [{
id: 'flights',
name: 'Live Flights',
enabled: true,
source: 'OpenSky Network',
stats: flights.getStats(),
}],
};
const runner = createGevActionRunner({
viewer,
styleManager: {
activeStyle: 'normal',
getContextModeState: () => ({ mode: null, active: false }),
getCockpitState: () => ({ active: false }),
getControlState: () => null,
},
dataManager,
});
const view = await runner('get_current_view_state');
assert.equal(view.layers[0].feedState, 'stale');
assert.equal(view.feedProvenance.overall, 'stale');
assert.match(view.feedProvenance.note, /STALE/);
const query = await runner('analyst_query', {
layers: ['flights'],
scope: { kind: 'view' },
limit: 5,
});
assert.equal(query.ok, true);
assert.equal(query.feedState, 'stale');
assert.equal(query.feedProvenance.overall, 'stale');
assert.equal(query.coverage.layersQueried[0].feedState, 'stale');
assert.match(query.feedProvenance.note, /do not describe this as live/i);
});