pub struct CommandsExtension {
pub session_info: Arc<Mutex<Option<SessionInfoInternal>>>,
/* private fields */
}Expand description
Built-in commands extension — provides /quit, /model, and other core commands. Uses the same Extension trait as all other extensions, making built-in commands indistinguishable from user-provided commands.
Fields§
§session_info: Arc<Mutex<Option<SessionInfoInternal>>>Current session info for /session command.
Implementations§
Source§impl CommandsExtension
impl CommandsExtension
pub fn new(available_models: Vec<String>) -> Self
Sourcepub fn set_session_info(&self, info: SessionInfoInternal)
pub fn set_session_info(&self, info: SessionInfoInternal)
Update the session info that /session will display.
Trait Implementations§
Source§impl Extension for CommandsExtension
impl Extension for CommandsExtension
fn name(&self) -> Cow<'static, str>
Source§fn commands(&self) -> Vec<SlashCommand>
fn commands(&self) -> Vec<SlashCommand>
Slash commands this extension provides (e.g.
/quit, /model).
Built-in commands and extension commands use the same interface.Source§fn before_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
_tc: &'life1 ToolCall,
) -> Pin<Box<dyn Future<Output = Option<BlockReason>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
_tc: &'life1 ToolCall,
) -> Pin<Box<dyn Future<Output = Option<BlockReason>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called before any tool executes. Return Some(reason) to block.
Source§fn after_tool_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_tc: &'life1 ToolCall,
_result: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn after_tool_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_tc: &'life1 ToolCall,
_result: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called after a tool executes. Return Some(text) to replace result.
Auto Trait Implementations§
impl Freeze for CommandsExtension
impl RefUnwindSafe for CommandsExtension
impl Send for CommandsExtension
impl Sync for CommandsExtension
impl Unpin for CommandsExtension
impl UnsafeUnpin for CommandsExtension
impl UnwindSafe for CommandsExtension
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
Mutably borrows from an owned value. Read more