pub struct KernelToolContext {
pub workspace_dir: PathBuf,
pub agent_id: String,
pub session_id: Option<String>,
pub permissions: Vec<String>,
pub metadata: HashMap<String, Value>,
}Expand description
Context provided to kernel tool providers during registration.
Contains the metadata that kernel tools need to operate correctly within an oxios agent session.
The metadata map is an extension point for kernel-specific data
(e.g., space_id, cspace_name, seed_id) without requiring SDK
changes for every new field.
Fields§
§workspace_dir: PathBufAgent’s workspace directory.
agent_id: Stringoxios agent identifier.
session_id: Option<String>Session identifier, if available.
permissions: Vec<String>CSpace-based permission list.
metadata: HashMap<String, Value>Extension metadata for kernel-specific data.
Keys are conventionally lowercase snake_case (e.g., "space_id",
"cspace_name", "seed_id"). Consumers should use
Self::get_meta / Self::get_meta_str for typed access.
Implementations§
Source§impl KernelToolContext
impl KernelToolContext
Sourcepub fn new(
workspace_dir: impl Into<PathBuf>,
agent_id: impl Into<String>,
) -> Self
pub fn new( workspace_dir: impl Into<PathBuf>, agent_id: impl Into<String>, ) -> Self
Create a new context with the given workspace and agent ID.
Sourcepub fn with_session(self, session_id: impl Into<String>) -> Self
pub fn with_session(self, session_id: impl Into<String>) -> Self
Set the session ID.
Sourcepub fn with_permissions(self, permissions: Vec<String>) -> Self
pub fn with_permissions(self, permissions: Vec<String>) -> Self
Set the permissions list.
Sourcepub fn with_meta(self, key: impl Into<String>, value: Value) -> Self
pub fn with_meta(self, key: impl Into<String>, value: Value) -> Self
Add an extension metadata entry.
§Example
use oxicode_sdk::KernelToolContext;
let ctx = KernelToolContext::new("/workspace", "agent-001")
.with_meta("space_id", serde_json::json!("test-space"))
.with_meta("cspace_name", serde_json::json!("full"));Sourcepub fn get_meta_str(&self, key: &str) -> Option<&str>
pub fn get_meta_str(&self, key: &str) -> Option<&str>
Get a metadata value as a string.
Trait Implementations§
Source§impl Clone for KernelToolContext
impl Clone for KernelToolContext
Source§fn clone(&self) -> KernelToolContext
fn clone(&self) -> KernelToolContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for KernelToolContext
impl RefUnwindSafe for KernelToolContext
impl Send for KernelToolContext
impl Sync for KernelToolContext
impl Unpin for KernelToolContext
impl UnsafeUnpin for KernelToolContext
impl UnwindSafe for KernelToolContext
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.