| .. | .. |
|---|
| 192 | 192 | void _sendKey(String key) { |
|---|
| 193 | 193 | _haptic(); |
|---|
| 194 | 194 | |
|---|
| 195 | | - // Send via WebSocket - the chat screen's WS is in the provider |
|---|
| 196 | | - // We need to access the WS through the provider system |
|---|
| 197 | | - // For now, send a nav command message |
|---|
| 195 | + // Send via MQTT - the chat screen's MQTT service is in the provider |
|---|
| 198 | 196 | final activeSessionId = ref.read(activeSessionIdProvider); |
|---|
| 199 | 197 | |
|---|
| 200 | | - // Build the navigate command |
|---|
| 201 | | - // This sends a key press to the AIBroker daemon |
|---|
| 202 | | - // which forwards it to the active terminal session |
|---|
| 203 | | - // The WS is managed by ChatScreen, so we'll use a message approach |
|---|
| 204 | | - |
|---|
| 205 | | - // Since we can't directly access the WS from here, |
|---|
| 206 | | - // we send through the provider approach - the message will be picked up |
|---|
| 207 | | - // by the WS service in ChatScreen via a shared notification mechanism. |
|---|
| 208 | | - // For simplicity, we use a global event bus pattern. |
|---|
| 198 | + // Send a key press to the AIBroker daemon via the MQTT service. |
|---|
| 199 | + // NavigateNotifier bridges the navigate screen to the chat screen's MQTT service. |
|---|
| 209 | 200 | |
|---|
| 210 | 201 | NavigateNotifier.instance?.sendKey(key, activeSessionId); |
|---|
| 211 | 202 | |
|---|
| .. | .. |
|---|
| 228 | 219 | } |
|---|
| 229 | 220 | } |
|---|
| 230 | 221 | |
|---|
| 231 | | -/// Global notifier to bridge navigate screen to WebSocket. |
|---|
| 232 | | -/// Set by ChatScreen when WS is initialized. |
|---|
| 222 | +/// Global notifier to bridge navigate screen to MQTT service. |
|---|
| 223 | +/// Set by ChatScreen when MQTT is initialized. |
|---|
| 233 | 224 | class NavigateNotifier { |
|---|
| 234 | 225 | static NavigateNotifier? instance; |
|---|
| 235 | 226 | |
|---|