mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
Merge upstream main (voice geometry: resolve_area, find_imagery, osm_query) into pr/street-level-show-action
This commit is contained in:
commit
34f694c6f2
138 files changed
+17718
-1136
No files matched your search
@@ -4,6 +4,9 @@ import assert from 'node:assert/strict';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { GEV_ACTION_SCHEMAS, createActionTools } from './actionSchemas.js';
|
||||
import { GEV_REALTIME_TOOLS } from '../../server/providers/openai/tools.js';
|
||||
import { createAreaStore } from '../data/areaStore.js';
|
||||
import { createAreaResolver } from '../data/areaResolver.js';
|
||||
import { findAdminCandidates } from '../data/adminBoundaries.js';
|
||||
import {
|
||||
validateArgs,
|
||||
validateCall,
|
||||
@@ -38,13 +41,21 @@ test('the complete Realtime tool payload pins the manifest-generated layer relea
|
||||
// consolidated tool wording (each policy stated once); model-facing tools
|
||||
// omit top-level anyOf (OpenAI rejects it). Contacts list routing preserves
|
||||
// requested radius and center authority in descriptions only.
|
||||
// Street Level, GNSS and air quality (ECCC AQHI) extend the manifest;
|
||||
// tracked and analyst aircraft describe broadcasts; globe rotation adds
|
||||
// one motion; S2 GhostMaps, the Utilities panel target, the voice panel
|
||||
// (named targets, timeout) and the sea-mark and ski-piste overlays follow; Snow leaves the set_visual_style enum, the Operator HUD layout
|
||||
// leaves set_hud's layout enum and the layer alias hint leaves out aliases
|
||||
// the layer id already spells; show_street_level (map, source, photo) is
|
||||
// the only change on top of main.
|
||||
// Street Level and GNSS extend the manifest; tracked and analyst aircraft describe broadcasts.
|
||||
// Air quality (ECCC AQHI) extends the manifest.
|
||||
// Globe rotation adds one motion; visual keyhole fit and explicit
|
||||
// reset guidance/defaults update only move_camera and mode descriptions.
|
||||
// S2 GhostMaps extends the generated layer enums.
|
||||
// The Utilities panel (Directions, Draw, Import) adds one panel target.
|
||||
// Panel adds named voice targets and timeout; shared Panel/Cockpit guidance
|
||||
// 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.
|
||||
// The layer alias hint leaves out aliases the layer id already spells.
|
||||
// Voice geometry adds resolve_area, find_imagery, osm_query, the analyst
|
||||
// area scopes and the osm-places layer; natural-region candidates and the
|
||||
// tightened area tool wording follow review.
|
||||
// show_street_level (map, source, photo) is the only change on top of main.
|
||||
SHOW_STREET_LEVEL_PAYLOAD_DIGEST,
|
||||
);
|
||||
// Every shipped tool is byte-identical to the previous release: the new
|
||||
@@ -63,12 +74,12 @@ test('the complete Realtime tool payload pins the manifest-generated layer relea
|
||||
.digest('hex');
|
||||
assert.equal(
|
||||
shipped,
|
||||
'7f113854cdfe3114b9edd69f49995502276c718ce8878320161a68bafb63ebe2',
|
||||
'd0c5ad733670972713a54cb10676c42b7c6e78834bfff52b473c0e8a45e742c3',
|
||||
);
|
||||
});
|
||||
|
||||
const SHOW_STREET_LEVEL_PAYLOAD_DIGEST =
|
||||
'05d4ad396091ce78a86bb8521e1336b12f3dd11007c53ecf5c76291fbf8af283';
|
||||
'3ffa77ea3f4a1c9a14eddf4963c4498d6d32330414818a3ef0f24e744878e5aa';
|
||||
|
||||
test('descriptions customize wording without changing immutable shared arguments', () => {
|
||||
const descriptions = {
|
||||
@@ -96,6 +107,37 @@ test('descriptions customize wording without changing immutable shared arguments
|
||||
);
|
||||
});
|
||||
|
||||
test('every emitted area candidate round-trips through the production schema', async () => {
|
||||
const candidateSchema = GEV_ACTION_SCHEMAS.find(
|
||||
(tool) => tool.name === 'resolve_area',
|
||||
).parameters.properties.candidateId;
|
||||
const resolver = createAreaResolver({
|
||||
store: createAreaStore(),
|
||||
findAdminCandidates,
|
||||
});
|
||||
const ambiguous = await resolver.resolve({ query: 'Georgia' });
|
||||
assert.equal(ambiguous.needsClarification, true);
|
||||
for (const choice of ambiguous.candidates) {
|
||||
assert.ok(choice.candidateId.length >= candidateSchema.minLength);
|
||||
assert.ok(choice.candidateId.length <= candidateSchema.maxLength);
|
||||
assert.match(choice.candidateId, new RegExp(candidateSchema.pattern, 'u'));
|
||||
assert.equal(
|
||||
(await resolver.resolve({ candidateId: choice.candidateId })).ok,
|
||||
true,
|
||||
);
|
||||
}
|
||||
assert.equal(ambiguous.candidates[0].candidateId.length, 44);
|
||||
const grammar = new RegExp(candidateSchema.pattern, 'u');
|
||||
for (const malformed of [
|
||||
'ne:state:bad slug',
|
||||
'ne:state:../../etc',
|
||||
'ne:state:!!!',
|
||||
'ne:state:a_b',
|
||||
])
|
||||
assert.doesNotMatch(malformed, grammar);
|
||||
assert.ok(`ne:state:${'x'.repeat(80)}`.length > candidateSchema.maxLength);
|
||||
});
|
||||
|
||||
test('metadata cannot add tools, fields, types or enum values', () => {
|
||||
for (const descriptions of [
|
||||
{ execute_shell: { description: 'not an action' } },
|
||||
@@ -129,6 +171,9 @@ test('all legacy action arguments are byte-identical after removing the delibera
|
||||
'next_satellite_pass',
|
||||
'set_cyber_sonar',
|
||||
'set_voice_inactivity_timeout',
|
||||
'resolve_area',
|
||||
'find_imagery',
|
||||
'osm_query',
|
||||
'show_street_level',
|
||||
].includes(tool.name),
|
||||
);
|
||||
@@ -182,6 +227,13 @@ test('all legacy action arguments are byte-identical after removing the delibera
|
||||
analystScopeKind.enum = analystScopeKind.enum.filter(
|
||||
(key) => key !== 'pointer',
|
||||
);
|
||||
// Area handles add three scope kinds and their two identifiers.
|
||||
const scope = property('analyst_query').scope;
|
||||
scope.properties.kind.enum = scope.properties.kind.enum.filter(
|
||||
(kind) => !['area', 'drawn', 'annotation'].includes(kind),
|
||||
);
|
||||
delete scope.properties.areaId;
|
||||
delete scope.properties.id;
|
||||
// The analyst centre now requires a real coordinate.
|
||||
const center = property('analyst_query').scope.properties.center;
|
||||
delete center.required;
|
||||
|
||||
Reference in new issue
Block a user