update on the agents and registry side

This commit is contained in:
2026-09-30 12:03:13 +05:30
parent 92e8da2842
commit 53199127ba
73 changed files with 7268 additions and 1134 deletions

View File

@@ -0,0 +1,39 @@
import { RiderBatterySafetySkill } from '@/lib/assistant/skills/definitions/RiderBatterySafetySkill';
describe('RiderBatterySafetySkill', () => {
it('detects active deliveries where rider device battery is critical', () => {
const rows = [
{
bookingid: 1,
bookingno: 'BK-1',
orderstatus: 'picked',
userid: 50,
ridername: 'Karthik',
battery_percentage: 12,
},
{
bookingid: 2,
bookingno: 'BK-2',
orderstatus: 'picked',
userid: 51,
ridername: 'Praveen',
battery_percentage: 85,
},
];
const findings = RiderBatterySafetySkill.evaluate(rows, '2026-08-31 12:00:00', { criticalBatteryPercent: 15 });
expect(findings.length).toBe(1);
expect(findings[0].id).toBe('rider_critical_battery');
expect(findings[0].count).toBe(1);
expect(findings[0].rows[0].bookingid).toBe(1);
});
it('executes alert_low_battery_rider tool handler', async () => {
const tool = RiderBatterySafetySkill.tools.find((t) => t.name === 'alert_low_battery_rider');
expect(tool).toBeDefined();
const result = await tool.handler({ milerId: 50 });
expect(result.success).toBe(true);
expect(result.proposal.action).toBe('battery_alert');
});
});