feat: implement BLE notifier for JCODE devices and enhance channel no…#21
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThis PR introduces Bluetooth Low Energy (BLE) notification support for JCODE-* IoT devices using the Nordic UART Service. It adds lifecycle event abstractions (EventType, NotifyEvent, Notifier interface), implements a BLE-backed notifier with background connection management, creates adapters for existing Channels, and integrates both into the interactive and web handlers with structured event emission tied to agent working/approval/completion states. Changes
Sequence DiagramsequenceDiagram
participant Agent as Agent/Handler
participant NotifyH as NotifyingHandler
participant BLENotif as BLE Notifier
participant ChanNotif as Channel Notifier
participant BLEDev as BLE Device (IoT)
participant WeChat as WeChat Channel
Agent->>NotifyH: OnAgentText (first call)
NotifyH->>NotifyH: sentWorking=true, notifyAll(EventWorking)
NotifyH->>BLENotif: Notify(EventWorking)
NotifyH->>ChanNotif: Notify(EventWorking)
BLENotif->>BLENotif: Format EventWorking → (cmd, val)
BLENotif->>BLEDev: WriteWithoutResponse (RX char)
ChanNotif->>WeChat: RichWorking(now) → SendText
Agent->>NotifyH: OnApprovalRequest
NotifyH->>NotifyH: notifyAll(EventApproval, Tool)
NotifyH->>BLENotif: Notify(EventApproval)
BLENotif->>BLEDev: WriteWithoutResponse (attention+tool)
Agent->>NotifyH: OnApprovalResponse(Approved=true)
NotifyH->>NotifyH: notifyAll(EventWorking)
NotifyH->>BLENotif: Notify(EventWorking)
NotifyH->>ChanNotif: Notify(EventWorking)
Agent->>NotifyH: OnCompletion(EventDone)
NotifyH->>NotifyH: notifyAll(EventDone)
NotifyH->>BLENotif: Notify(EventDone)
NotifyH->>ChanNotif: Notify(EventDone) [ignored]
BLENotif->>BLEDev: WriteWithoutResponse (complete)
NotifyH->>NotifyH: After 5s: notifyAll(EventIdle)
NotifyH->>BLENotif: Notify(EventIdle)
NotifyH->>ChanNotif: Notify(EventIdle)
BLENotif->>BLEDev: WriteWithoutResponse (idle/ready)
ChanNotif->>WeChat: RichIdle(now) → SendText
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…tifications
Summary by CodeRabbit