remote.rs (1273B)
1 use crate::messages::DaveApiResponse; 2 use crate::tools::Tool; 3 use claude_agent_sdk_rs::PermissionMode; 4 use std::collections::HashMap; 5 use std::path::PathBuf; 6 use std::sync::mpsc; 7 use std::sync::Arc; 8 9 use super::AiBackend; 10 11 /// A no-op backend for devices without API keys. 12 /// 13 /// Allows creating local Chat sessions (input is ignored) while viewing 14 /// and controlling remote Agentic sessions discovered from ndb/relays. 15 pub struct RemoteOnlyBackend; 16 17 impl AiBackend for RemoteOnlyBackend { 18 fn stream_request( 19 &self, 20 _messages: Vec<crate::Message>, 21 _tools: Arc<HashMap<String, Tool>>, 22 _model: String, 23 _user_id: String, 24 _session_id: String, 25 _cwd: Option<PathBuf>, 26 _resume_session_id: Option<String>, 27 _ctx: egui::Context, 28 ) -> ( 29 mpsc::Receiver<DaveApiResponse>, 30 Option<tokio::task::JoinHandle<()>>, 31 ) { 32 // Return a closed channel — no local AI processing 33 let (_tx, rx) = mpsc::channel(); 34 (rx, None) 35 } 36 37 fn cleanup_session(&self, _session_id: String) {} 38 39 fn interrupt_session(&self, _session_id: String, _ctx: egui::Context) {} 40 41 fn set_permission_mode(&self, _session_id: String, _mode: PermissionMode, _ctx: egui::Context) { 42 } 43 }