use anyhow::Result; use owlen_core::session::SessionController; use owlen_core::ui::{AppState, InputMode}; use tokio::sync::mpsc; use crate::chat_app::{ChatApp, SessionEvent}; use crate::events::Event; const DEFAULT_SYSTEM_PROMPT: &str = "You are OWLEN Code Assistant. Provide detailed, actionable programming help."; pub struct CodeApp { inner: ChatApp, } impl CodeApp { pub async fn new( mut controller: SessionController, ) -> Result<(Self, mpsc::UnboundedReceiver)> { controller .conversation_mut() .push_system_message(DEFAULT_SYSTEM_PROMPT.to_string()); let (inner, rx) = ChatApp::new(controller).await?; Ok((Self { inner }, rx)) } pub async fn handle_event(&mut self, event: Event) -> Result { self.inner.handle_event(event).await } pub fn handle_session_event(&mut self, event: SessionEvent) -> Result<()> { self.inner.handle_session_event(event) } pub fn mode(&self) -> InputMode { self.inner.mode() } pub fn inner(&self) -> &ChatApp { &self.inner } pub fn inner_mut(&mut self) -> &mut ChatApp { &mut self.inner } }