mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
feat: add aviation and satellite tools
Add aircraft_in_area, find_aircraft, get_aircraft_track and get_aircraft_info over the live aircraft sources, with an optional military feed, and next_satellite_pass and satellites_overhead over the satellite catalog and the existing pass predictor. Source failures from the live contract now become tool errors with the matching code, so a rate limit reaches clients as retry_later with a wait time. Tool schemas may use pattern.
This commit is contained in:
1 parent
9895942633
commit
22c3fe40b0
16 files changed
+1111
-16
No files matched your search
@@ -31,10 +31,10 @@ test('definitions are validated, frozen and read-only by default', () => {
|
||||
echo('x', {
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: { a: { type: 'string', pattern: '.' } },
|
||||
properties: { a: { type: 'string', format: 'email' } },
|
||||
},
|
||||
}),
|
||||
/unsupported keyword pattern/,
|
||||
/unsupported keyword format/,
|
||||
);
|
||||
assert.throws(
|
||||
() => echo('x', { inputSchema: { type: 'string' } }),
|
||||
@@ -129,6 +129,45 @@ test('tool errors only use known codes', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('only live source errors are translated', async () => {
|
||||
const { fromSourceError } = await import('./catalog.js');
|
||||
const plain = new Error('x');
|
||||
assert.equal(fromSourceError(plain), plain);
|
||||
const denied = Object.assign(new Error('refused'), {
|
||||
name: 'LiveSourceError',
|
||||
code: 'denied',
|
||||
});
|
||||
const translated = fromSourceError(denied);
|
||||
assert.equal(translated.code, 'unavailable');
|
||||
assert.equal(translated.retryAfterSeconds, null);
|
||||
const odd = Object.assign(new Error('?'), {
|
||||
name: 'LiveSourceError',
|
||||
code: 'toString',
|
||||
});
|
||||
assert.equal(fromSourceError(odd), odd);
|
||||
});
|
||||
|
||||
test('patterns are validated and must compile', () => {
|
||||
const schema = {
|
||||
type: 'object',
|
||||
properties: { id: { type: 'string', pattern: '^[a-f]{2}$' } },
|
||||
};
|
||||
assert.deepEqual(validateValue(schema, { id: 'ab' }), []);
|
||||
assert.deepEqual(validateValue(schema, { id: 'xy' }), [
|
||||
'arguments.id must match ^[a-f]{2}$',
|
||||
]);
|
||||
assert.throws(
|
||||
() =>
|
||||
echo('x', {
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: { id: { type: 'string', pattern: '(' } },
|
||||
},
|
||||
}),
|
||||
SyntaxError,
|
||||
);
|
||||
});
|
||||
|
||||
test('the validator checks every supported keyword', () => {
|
||||
const schema = {
|
||||
type: 'object',
|
||||
|
||||
Reference in new issue
Block a user