mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 02:14:01 +00:00
Merge pull request #1462 from quanticsoul4772/upstream/voice-alias-hint-budget
fix(voice): leave aliases a layer id already spells out of the alias hint
This commit is contained in:
5 files changed
+43
-9
No files matched your search
@@ -0,0 +1,5 @@
|
||||
- Leave layer aliases the layer id already spells, such as "dams" for
|
||||
`local-dams`, out of the voice layer hint. The Realtime prompt is 305
|
||||
characters shorter, leaving room under the 52,000 gate for new
|
||||
voice-toggleable layers; every alias is still accepted (@quanticsoul4772,
|
||||
#1462).
|
||||
@@ -1029,10 +1029,11 @@ test('the voice TOOL SCHEMA matches the pinned contract — the mission mapping
|
||||
// Panel adds timeout and named voice/provider targets; consolidated guidance
|
||||
// preserves the mission mapping and globe-rotation arguments.
|
||||
// S2 GhostMaps extends the generated layer enums; both feature contracts remain.
|
||||
assert.equal(block.length, 31206, 'serialized tool schema length drifted');
|
||||
// The layer alias hint leaves out aliases the layer id already spells.
|
||||
assert.equal(block.length, 30901, 'serialized tool schema length drifted');
|
||||
assert.equal(
|
||||
crypto.createHash('sha256').update(block).digest('hex'),
|
||||
'f772df95404494bf492e02fde1beabffdfe61986940bffd0cf9ad5a38d768746',
|
||||
'9e1bd8fde648953c47718ba248758415a95c1484b0da6369df6b89b0505c0de2',
|
||||
'the first-run missions must ride EXISTING tools: no schema edit, no cache bust',
|
||||
);
|
||||
const instructions = fs.readFileSync(
|
||||
|
||||
@@ -47,7 +47,8 @@ test('the complete Realtime tool payload pins the manifest-generated layer relea
|
||||
// is consolidated without changing either feature's arguments.
|
||||
// Snow leaves the set_visual_style enum.
|
||||
// The Operator HUD layout leaves set_hud's layout enum.
|
||||
'f47a7f78f13b1f79978fa524fad2618e32bd813e1a5dfd746bf35d29909fc91b',
|
||||
// The layer alias hint leaves out aliases the layer id already spells.
|
||||
'e65812db60a2702cebb496fca257cb04a28f1bbbf250cb9ab65a3db33005e0c8',
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -525,22 +525,31 @@ const SELF_EVIDENT_IDS = new Set([
|
||||
'radio',
|
||||
'wind',
|
||||
'directions',
|
||||
// The brand is already the layer id; all spoken aliases remain accepted.
|
||||
's2-ghostmaps',
|
||||
]);
|
||||
|
||||
/** Lower case with spaces and hyphens removed: "Data centers" → "datacenters". */
|
||||
const spelled = (text) => text.toLowerCase().replace(/[\s-]+/g, '');
|
||||
|
||||
/**
|
||||
* Compact model-facing alias hint: "alias/alias→id; …" for toggleable layers
|
||||
* whose id is not already the spoken word. At most two aliases per layer keep
|
||||
* the tool JSON small; the runner accepts the full alias list.
|
||||
* the tool JSON small; the runner accepts the full alias list. Of those two,
|
||||
* an alias the id already spells ("dams"→local-dams, "weather radar"→
|
||||
* weather-radar) is left out, and a layer with neither left gets no hint.
|
||||
* @returns {string} One line for the layerId description.
|
||||
*/
|
||||
export function voiceLayerAliasHint() {
|
||||
return VOICE_LAYER_MANIFEST.filter(
|
||||
(entry) =>
|
||||
entry.toggle && entry.aliases.length && !SELF_EVIDENT_IDS.has(entry.id),
|
||||
(entry) => entry.toggle && !SELF_EVIDENT_IDS.has(entry.id),
|
||||
)
|
||||
.map((entry) => `${entry.aliases.slice(0, 2).join('/')}→${entry.id}`)
|
||||
.map((entry) => ({
|
||||
id: entry.id,
|
||||
aliases: entry.aliases
|
||||
.slice(0, 2)
|
||||
.filter((alias) => !spelled(entry.id).includes(spelled(alias))),
|
||||
}))
|
||||
.filter((entry) => entry.aliases.length)
|
||||
.map((entry) => `${entry.aliases.join('/')}→${entry.id}`)
|
||||
.join(';');
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
VOICE_TOGGLE_LAYER_IDS,
|
||||
VOICE_CONTEXT_LAYER_IDS,
|
||||
VOICE_QUERY_LAYER_IDS,
|
||||
voiceLayerAliasHint,
|
||||
voiceLayerAliasMap,
|
||||
} from './layerManifest.js';
|
||||
|
||||
@@ -78,6 +79,23 @@ test('tool enums are generated from the manifest', () => {
|
||||
assert.ok(panels.includes('weather-panel') && panels.includes('recent-imagery-panel'));
|
||||
});
|
||||
|
||||
test('the alias hint leaves out names the layer id already spells', () => {
|
||||
const hint = voiceLayerAliasHint();
|
||||
const entries = hint.split(';').map((entry) => entry.split('→'));
|
||||
const flat = (text) => text.toLowerCase().replace(/[\s-]+/g, '');
|
||||
for (const [aliases, id] of entries) {
|
||||
for (const alias of aliases.split('/')) {
|
||||
assert.ok(!flat(id).includes(flat(alias)), `"${alias}" is already spelled by ${id}`);
|
||||
}
|
||||
}
|
||||
const ids = entries.map(([, id]) => id);
|
||||
assert.ok(!ids.includes('local-dams'), 'a layer left with no alias gets no entry');
|
||||
assert.ok(!ids.includes('weather-radar'));
|
||||
assert.match(hint, /(^|;)aqhi→air-quality(;|$)/, 'an alias the id does not spell stays');
|
||||
assert.match(hint, /(^|;)hurricanes→weather-cyclones(;|$)/);
|
||||
assert.match(hint, /(^|;)fires\/wildfires→local-firms(;|$)/);
|
||||
});
|
||||
|
||||
test('spoken aliases resolve to real layers, keep every legacy phrase and never collide', () => {
|
||||
const aliases = voiceLayerAliasMap();
|
||||
for (const id of aliases.values()) assert.ok(manifestIds.includes(id), id);
|
||||
|
||||
Reference in new issue
Block a user