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 more