Add node location access RPCs and operator visibility

This commit is contained in:
William Valentin
2026-02-16 12:30:55 -08:00
parent 1d16cd54e6
commit fe8674e108
19 changed files with 693 additions and 15 deletions
+53
View File
@@ -598,6 +598,7 @@ describe('GatewayServer node registration and capability negotiation', () => {
enabled: true,
allowedRoles: ['companion'],
featureGates: { 'ui.canvas': true },
locationEnabled: true,
},
});
await nodeServer.start();
@@ -659,4 +660,56 @@ describe('GatewayServer node registration and capability negotiation', () => {
}
}
});
it('supports node location set/get after registration', async () => {
if (!LISTEN_ALLOWED) {
return;
}
const ws = await new Promise<WebSocket>((resolve, reject) => {
const c = new WebSocket(`ws://127.0.0.1:${NODE_PORT}`);
c.on('open', () => resolve(c));
c.on('error', reject);
});
try {
const registered = await sendAndReceive(ws, {
id: 10,
method: 'node.register',
params: {
nodeId: 'node-loc',
role: 'companion',
protocolVersion: 1,
capabilities: ['location'],
},
});
expect(((registered as GatewayResponse).result as { registered: boolean }).registered).toBe(true);
const setResult = await sendAndReceive(ws, {
id: 11,
method: 'node.location.set',
params: {
latitude: 51.5074,
longitude: -0.1278,
source: 'gps',
},
});
expect(((setResult as GatewayResponse).result as { updated: boolean }).updated).toBe(true);
const getResult = await sendAndReceive(ws, {
id: 12,
method: 'node.location.get',
params: {},
});
const location = ((getResult as GatewayResponse).result as {
location: { latitude: number; longitude: number };
}).location;
expect(location.latitude).toBe(51.5074);
expect(location.longitude).toBe(-0.1278);
} finally {
if (ws.readyState === WebSocket.OPEN) {
ws.close();
}
}
});
});