SessionProfile

Struct SessionProfile 

Source
pub struct SessionProfile {
    pub name: String,
    pub tool_extras: Vec<Arc<dyn Tool>>,
    pub tool_overrides: HashMap<String, Arc<dyn Tool>>,
    pub tool_hidden: HashSet<String>,
    pub tool_aliases: HashMap<String, String>,
    pub resource_extras: Vec<Arc<dyn Resource>>,
    pub resource_overrides: HashMap<String, Arc<dyn Resource>>,
    pub resource_hidden: HashSet<String>,
    pub prompt_extras: Vec<Arc<dyn Prompt>>,
    pub prompt_overrides: HashMap<String, Arc<dyn Prompt>>,
    pub prompt_hidden: HashSet<String>,
}
Expand description

Session profile for role-based capability configuration

A profile defines a set of modifications to apply to a session:

  • Extra tools/resources/prompts to add
  • Overrides for existing tools (same name, different implementation)
  • Tools/resources/prompts to hide
  • Aliases for ergonomic name mappings

Fields§

§name: String

Profile name (e.g., “admin”, “vip”, “guest”)

§tool_extras: Vec<Arc<dyn Tool>>

Extra tools to add to the session

§tool_overrides: HashMap<String, Arc<dyn Tool>>

Tool overrides (same name, different implementation)

§tool_hidden: HashSet<String>

Tools to hide from the session

§tool_aliases: HashMap<String, String>

Tool aliases (alias -> actual name)

§resource_extras: Vec<Arc<dyn Resource>>

Extra resources to add to the session

§resource_overrides: HashMap<String, Arc<dyn Resource>>

Resource overrides (same URI, different implementation)

§resource_hidden: HashSet<String>

Resources to hide from the session

§prompt_extras: Vec<Arc<dyn Prompt>>

Extra prompts to add to the session

§prompt_overrides: HashMap<String, Arc<dyn Prompt>>

Prompt overrides (same name, different implementation)

§prompt_hidden: HashSet<String>

Prompts to hide from the session

Implementations§

Source§

impl SessionProfile

Source

pub fn new(name: impl Into<String>) -> Self

Create a new empty profile with the given name

Source

pub fn admin() -> Self

Create an admin profile (typically has extra management tools)

Source

pub fn vip() -> Self

Create a VIP profile (typically has upgraded implementations)

Source

pub fn readonly() -> Self

Create a readonly profile (hides write operations)

Source

pub fn guest() -> Self

Create a guest profile (minimal access)

Source

pub fn add_tool(&mut self, tool: Arc<dyn Tool>) -> &mut Self

Add an extra tool to the profile

Source

pub fn override_tool( &mut self, name: impl Into<String>, tool: Arc<dyn Tool>, ) -> &mut Self

Override a tool (same name, different implementation)

Source

pub fn hide_tool(&mut self, name: impl Into<String>) -> &mut Self

Hide a tool from sessions with this profile

Source

pub fn hide_tools( &mut self, names: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Hide multiple tools

Source

pub fn alias_tool( &mut self, alias: impl Into<String>, target: impl Into<String>, ) -> &mut Self

Add a tool alias (alias -> target)

Source

pub fn add_resource(&mut self, resource: Arc<dyn Resource>) -> &mut Self

Add an extra resource to the profile

Source

pub fn override_resource( &mut self, uri: impl Into<String>, resource: Arc<dyn Resource>, ) -> &mut Self

Override a resource (same URI, different implementation)

Source

pub fn hide_resource(&mut self, uri: impl Into<String>) -> &mut Self

Hide a resource from sessions with this profile

Source

pub fn hide_resources( &mut self, uris: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Hide multiple resources

Source

pub fn add_prompt(&mut self, prompt: Arc<dyn Prompt>) -> &mut Self

Add an extra prompt to the profile

Source

pub fn override_prompt( &mut self, name: impl Into<String>, prompt: Arc<dyn Prompt>, ) -> &mut Self

Override a prompt (same name, different implementation)

Source

pub fn hide_prompt(&mut self, name: impl Into<String>) -> &mut Self

Hide a prompt from sessions with this profile

Source

pub fn hide_prompts( &mut self, names: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Hide multiple prompts

Source

pub fn merge(&mut self, other: &SessionProfile) -> &mut Self

Merge another profile into this one

Later profiles take precedence for overrides and hidden items

Trait Implementations§

Source§

impl Debug for SessionProfile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SessionProfile

Source§

fn default() -> SessionProfile

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more