Merge main into feat/shipwrecks

Main added the News layer at the same places: both layers are kept in the
layer names, panel order (News stays last of Events), standalone sources,
voice manifest, credits, DATA_SOURCES and the CURRENT-STATE table. News took
share-link token 00 first, so Shipwrecks moves to 01 (ledger, registry,
CURRENT-STATE and the token tests). The catalog now has 40 layers and the
share-link registry 38. Shipwreck strings are added to the new Hebrew
catalog; the other catalogs keep both sides' strings.
This commit is contained in:
Sameh Khamis committed 2026-11-10 14:03:39 -08:00
commit 8ff22f1a12
466 files changed
+57748 -1865

No files matched your search

+4 -2
View File
@@ -74,9 +74,11 @@ test('bikeshare stations join coordinates from station information', () => {
assert.deepEqual(methods.getAnalystRecords(), []);
});
test('launches carry time and hours until launch', () => {
const at = Date.now() + 5 * 3_600_000;
test('launches carry time and hours until launch at the world time', () => {
const now = Date.UTC(2026, 10, 1);
const at = now + 5 * 3_600_000;
const state = {
now: () => now,
_enabled: true,
_launches: [
{
+1 -1
View File
@@ -70,7 +70,7 @@ const cases = [
// Transit's coverage text when nothing is in view (transit/queries.js).
const transitCoverage = [
'transit: Fly below 3,000 km to a covered region',
'transit: Fly below 2,850 km to a covered region',
'transit: No feed here yet · 12 regions available',
];
+25 -11
View File
@@ -1,4 +1,5 @@
import { interruptGlobeRotation } from '../cameraVerbs.js';
import { normalizeDisplayText } from '../data/displayText.js';
import {
layerSnapshot,
feedProvenanceEnvelope,
@@ -5068,13 +5069,7 @@ function uniqueStrings(values) {
* @returns {string} Sanitized single-line label (max 120 chars).
*/
function sanitizeLabel(value) {
const text = String(value || '');
let out = '';
for (const ch of text) {
const code = ch.codePointAt(0);
out += code < 0x20 || code === 0x7f ? ' ' : ch; // drop control chars incl. newlines
}
return out.replace(/\s+/g, ' ').trim().slice(0, 120);
return normalizeDisplayText(value, 120);
}
function cachePrecision(service) {
@@ -5191,10 +5186,8 @@ function compactProperties(props) {
}
function cleanText(value) {
if (value == null || typeof value === 'object') return '';
const text = String(value).trim();
if (!text || text === 'undefined' || text === 'null') return '';
return text.length > 180 ? `${text.slice(0, 177)}...` : text;
const text = normalizeDisplayText(value);
return text === 'undefined' || text === 'null' ? '' : text;
}
function layerTitle(layerId) {
@@ -5359,6 +5352,22 @@ const ANALYST_IDENTITY_FIELDS = Object.freeze([
'noradId',
]);
/**
* Keys that identify an analyst record. The referent registry, track_entity,
* locateLayerEntity and follow-up filters match on them, so they skip
* display-text normalization.
*/
const ANALYST_CANONICAL_FIELDS = new Set([
'layerKey',
'id',
'icao24',
'mmsi',
'noradId',
'registration',
'callsign',
'routeId',
]);
/**
* Compact one analyst record for the voice payload: identity, position (so a
* follow-up can fly to it), distance, and that layer's manifest fields with
@@ -5396,6 +5405,11 @@ function compactAnalystItem(r) {
} else compact[key] = r[key];
}
if (present(r.ageHours)) compact.ageHours = r.ageHours;
// Canonical keys stay raw: bikeshare's id is the raw station name.
for (const key of Object.keys(compact)) {
if (typeof compact[key] === 'string' && !ANALYST_CANONICAL_FIELDS.has(key))
compact[key] = normalizeDisplayText(compact[key]);
}
return compact;
}
+78
View File
@@ -6548,6 +6548,84 @@ test('analyst-only lookup distinguishes duplicate names and uses canonical aircr
assert.equal(plane.latitude, 36, 'canonical ID resolves the current position, not old coordinates');
});
test('analyst item display strings are single-line and bounded for voice', async () => {
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
const rows = [{ id: 'stable-id', name: 'Şehir\n' + 'x'.repeat(3000), label: 'Town\tStation', operator: 'City\nPD', lat: 30, lon: -97 }];
const { runner } = manifestRunner({ bikeshare: { getStats: () => ({ count: 1, lastUpdate: Date.now() }), getAnalystRecords: () => rows } });
const result = await runner('analyst_query', { layers: ['bikeshare'], scope: { kind: 'anywhere' }, limit: 1 });
assert.equal(result.ok, true);
assert.equal(result.items[0].name.length, 180);
assert.equal(result.items[0].label, 'Town Station');
assert.equal(result.items[0].id, 'stable-id');
for (const value of Object.values(result.items[0])) if (typeof value === 'string') assert.doesNotMatch(value, /[\r\n\t]/);
});
test('analyst_query keeps canonical IDs raw so numbered references still fly to the station', async () => {
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
const { viewer, styleManager } = createVoiceNavigationHarness();
const referents = createReferentRegistry();
const longName = 'Station ' + 'é'.repeat(200);
const spaced = 'Congress Ave & 2nd';
const stations = [
{ id: spaced, name: spaced, lat: 30.2672, lon: -97.7431 },
{ id: longName, name: longName, lat: 30.2711, lon: -97.7437 },
];
const bikeshare = { getStats: () => ({ count: stations.length, lastUpdate: Date.now() }), getAnalystRecords: () => stations };
const runner = createActionRunner({
viewer, styleManager,
dataManager: {
layers: new Map([['bikeshare', { module: bikeshare }]]),
isEnabled: () => true,
getAll: () => [{ id: 'bikeshare', name: 'bikeshare', enabled: true, stats: bikeshare.getStats() }],
},
deixis: { referents },
});
const listed = await runner('analyst_query', { layers: ['bikeshare'], scope: { kind: 'anywhere' }, limit: 2 });
assert.equal(listed.ok, true);
const bySpaced = listed.items.find((item) => item.id === spaced);
const byLong = listed.items.find((item) => item.id === longName);
assert.ok(bySpaced && byLong, 'compact items keep the raw station-name IDs');
assert.equal(bySpaced.name, 'Congress Ave & 2nd', 'display name is still normalized');
assert.equal(byLong.name.length, 180, 'display name is still bounded');
assert.equal(byLong.id.length, longName.length);
const registered = referents.list();
assert.equal(registered.length, 2, 'the analyst result became the numbered list');
for (const ref of registered) {
const station = stations.find((row) => row.id === ref.id);
assert.ok(station, `referent ${ref.n} keeps the canonical ID`);
const flown = await runner('fly_to_location', { referent: ref.n });
assert.equal(flown.ok, true, `referent ${ref.n} resolves instead of "no longer loaded"`);
assert.equal(flown.latitude, station.lat);
assert.equal(flown.longitude, station.lon);
}
});
test('analyst_query keeps transit route IDs raw so a follow-up filter still matches', async () => {
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
for (const routeId of ['Route 17', 'R'.repeat(181)]) {
const { viewer, styleManager } = createVoiceNavigationHarness();
const vehicles = [{ id: 'bus-1', routeId, lat: 30, lon: -97 }];
const transit = { getStats: () => ({ count: 1, lastUpdate: Date.now() }), getAnalystRecords: () => vehicles };
const runner = createActionRunner({
viewer, styleManager,
dataManager: {
layers: new Map([['transit', { module: transit }]]),
isEnabled: () => true,
getAll: () => [{ id: 'transit', name: 'transit', enabled: true, stats: transit.getStats() }],
},
});
const listed = await runner('analyst_query', { layers: ['transit'], scope: { kind: 'anywhere' }, limit: 1 });
assert.equal(listed.ok, true);
assert.equal(listed.items[0].routeId, routeId);
const followUp = await runner('analyst_query', {
followUp: true,
filters: [{ field: 'routeId', op: 'eq', value: listed.items[0].routeId }],
});
assert.equal(followUp.ok, true);
assert.equal(followUp.count, 1, 'the returned route ID matches the same vehicle');
}
});
test('set_panel_open accepts the Authoring name for the scene panel', async () => {
const calls = [];
const runner = createGevActionRunner({
+1
View File
@@ -457,6 +457,7 @@ export const VOICE_OFF_LAYERS = Object.freeze({
// query for this layer wait until there is room.
'drone-airspace':
'informational airspace layer; no room in the prompt budget',
news: 'browsed in the News panel; voice tools are a later step',
// Same budget: a historical wreck archive waits for room too.
shipwrecks: 'historical shipwreck archive; no room in the prompt budget',
'wildlife-sightings':
+5 -26
View File
@@ -29,7 +29,7 @@ import {
} from '../i18n/index.js';
import { layerNameForId, sourceLabel } from '../ui/layerNames.js';
import { localizePlaceName } from '../ui/placeNames.js';
import { translateStatusLine } from '../ui/statusText.js';
import { translateStatusMessage } from '../ui/statusText.js';
import { formatQuantity } from '../ui/unitLabels.js';
/** Split "a; b" caveat text into separate notes. */
@@ -397,27 +397,6 @@ const NOTE_PATTERNS = [
'Contacts panel snapshot — the same retained cohort supplies the card, speech, and follow-up memory',
)) + period,
],
// Transit's empty note when no feed covers the view (transit/queries.js);
// the model gets the English.
[
/^Fly below ([\d,]+) km to a covered region$/,
([, km]) =>
t('Fly below {km} km to a covered region', {
km: formatNumber(Number(km.replace(/,/g, ''))),
}),
],
[
/^No feed here yet · ([\d,]+) regions available$/,
([, regions]) => {
const count = Number(regions.replace(/,/g, ''));
return tn(
count,
'No feed here yet · {n} region available',
'No feed here yet · {n} regions available',
{ n: formatNumber(count) },
);
},
],
[
/^([a-z0-9-]+) (off|loading|error)$/,
([, key, status]) =>
@@ -444,10 +423,10 @@ function shownNote(text) {
const shown = match ? show(match) : null;
if (shown) return shown;
}
// A layer's empty note can be its status line, English pieces joined by
// " · " ("feeds 1090, 978 stale · 0 heard", "TTC 0 (95s old)").
const known = translateKnown(text);
return known !== text ? known : translateStatusLine(text);
// A layer's empty note can be its coverage note ("Fly below 2,850 km to a
// covered region") or its status line, English pieces joined by " · "
// ("feeds 1090, 978 stale · 0 heard", "TTC 0 (95s old)").
return translateStatusMessage(text);
}
/** Feed states as the card's chips show them; the values stay English. */