pub struct ChatSession {
pub provider: ProviderType,
pub model: String,
pub project_path: PathBuf,
pub history: Vec<(String, String)>,
pub token_usage: TokenUsage,
pub plan_mode: PlanMode,
pub pending_resume: Option<ConversationRecord>,
}Expand description
Chat session state
Fields§
§provider: ProviderType§model: String§project_path: PathBuf§history: Vec<(String, String)>§token_usage: TokenUsage§plan_mode: PlanModeCurrent planning mode state
pending_resume: Option<ConversationRecord>Session loaded via /resume command, to be processed by main loop
Implementations§
Source§impl ChatSession
impl ChatSession
pub fn new( project_path: &Path, provider: ProviderType, model: Option<String>, ) -> Self
Sourcepub fn toggle_plan_mode(&mut self) -> PlanMode
pub fn toggle_plan_mode(&mut self) -> PlanMode
Toggle planning mode and return the new mode
Sourcepub fn is_planning(&self) -> bool
pub fn is_planning(&self) -> bool
Check if currently in planning mode
Sourcepub fn has_api_key(provider: ProviderType) -> bool
pub fn has_api_key(provider: ProviderType) -> bool
Check if API key is configured for a provider (env var OR config file)
Sourcepub fn load_api_key_to_env(provider: ProviderType)
pub fn load_api_key_to_env(provider: ProviderType)
Load API key from config if not in env, and set it in env for use
Sourcepub fn get_configured_providers() -> Vec<ProviderType>
pub fn get_configured_providers() -> Vec<ProviderType>
Get configured providers (those with API keys)
Sourcepub fn prompt_api_key(provider: ProviderType) -> AgentResult<String>
pub fn prompt_api_key(provider: ProviderType) -> AgentResult<String>
Prompt user to enter API key for a provider
Sourcepub fn handle_model_command(&mut self) -> AgentResult<()>
pub fn handle_model_command(&mut self) -> AgentResult<()>
Handle /model command - interactive model selection
Sourcepub fn handle_provider_command(&mut self) -> AgentResult<()>
pub fn handle_provider_command(&mut self) -> AgentResult<()>
Handle /provider command - switch provider with API key prompt if needed
Sourcepub fn handle_reset_command(&mut self) -> AgentResult<()>
pub fn handle_reset_command(&mut self) -> AgentResult<()>
Handle /reset command - reset provider credentials
Sourcepub fn handle_profile_command(&mut self) -> AgentResult<()>
pub fn handle_profile_command(&mut self) -> AgentResult<()>
Handle /profile command - manage global profiles
Sourcepub fn handle_plans_command(&self) -> AgentResult<()>
pub fn handle_plans_command(&self) -> AgentResult<()>
Handle /plans command - show incomplete plans and offer to continue
Sourcepub fn handle_resume_command(&mut self) -> AgentResult<bool>
pub fn handle_resume_command(&mut self) -> AgentResult<bool>
Handle /resume command - browse and select a session to resume Returns true if a session was loaded and should be displayed
Sourcepub fn handle_list_sessions_command(&self)
pub fn handle_list_sessions_command(&self)
Handle /sessions command - list available sessions
Sourcepub fn print_help()
pub fn print_help()
Handle /help command
Sourcepub fn print_logo()
pub fn print_logo()
Print session banner with colorful SYNCABLE ASCII art
Print the welcome banner
Sourcepub fn process_command(&mut self, input: &str) -> AgentResult<bool>
pub fn process_command(&mut self, input: &str) -> AgentResult<bool>
Process a command (returns true if should continue, false if should exit)
Sourcepub fn is_command(input: &str) -> bool
pub fn is_command(input: &str) -> bool
Check if input is a command
Sourcepub fn read_input(&self) -> Result<InputResult>
pub fn read_input(&self) -> Result<InputResult>
Read user input with prompt - with interactive file picker support Uses custom terminal handling for @ file references and / commands Returns InputResult which the main loop should handle
Sourcepub fn process_submitted_text(text: &str) -> String
pub fn process_submitted_text(text: &str) -> String
Process a submitted input text - strips @ references and handles suggestion format
Auto Trait Implementations§
impl Freeze for ChatSession
impl RefUnwindSafe for ChatSession
impl Send for ChatSession
impl Sync for ChatSession
impl Unpin for ChatSession
impl UnwindSafe for ChatSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more