"""Drive a fake LiveKit data-channel payload through the MotorBridge to prove
the wire format end-to-end. This is exactly what livekit_bridge.run_livekit
will call when the agent publishes {"op":"motor", ...} on the data channel."""
import asyncio
from motor_bridge import MotorBridge

async def main():
    bridge = MotorBridge("http://127.0.0.1:8765")
    print("--> ping:", await bridge.handle_command('{"op":"ping"}'))
    print("--> motor arm 2s:", await bridge.handle_command('{"op":"motor","name":"arm","seconds":2}'))
    await asyncio.sleep(0.2)
    print("--> stop:", await bridge.handle_command('{"op":"stop"}'))
    print("--> bogus:", await bridge.handle_command('not json'))

asyncio.run(main())