pub struct CommandsExtension {
pub session_info: Arc<Mutex<Option<SessionInfoInternal>>>,
/* private fields */
}Expand description
Built-in commands extension - provides all 22 pi slash 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 tools(&self) -> Vec<ToolDefinition>
fn tools(&self) -> Vec<ToolDefinition>
Tools this extension provides (LLM-callable), each with its own prompt metadata.
Source§fn skills(&self) -> SkillSet
fn skills(&self) -> SkillSet
Skills this extension provides (AgentSkills-compatible).
Merged into the session’s skill set for /skill:name expansion and system prompt.
Source§fn before_compact(
&self,
_first_kept_entry_id: &str,
_tokens_before: u64,
_reason: &str,
_cancel: &Cancel,
) -> Option<BeforeCompactResult>
fn before_compact( &self, _first_kept_entry_id: &str, _tokens_before: u64, _reason: &str, _cancel: &Cancel, ) -> Option<BeforeCompactResult>
Called before compaction runs (matching pi’s
session_before_compact).
Return Some(BeforeCompactResult { cancel: true, .. }) to cancel compaction.
Return Some(BeforeCompactResult { cancel: false, summary: Some(...), .. })
to provide a custom summary instead of calling the provider.
Return None to let the default compaction proceed. Read moreAuto 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