pub struct ToolContext {
pub workspace_root: PathBuf,
pub cwd: Arc<RwLock<PathBuf>>,
/* private fields */
}Expand description
Shared context available to all built-in tools.
Fields§
§workspace_root: PathBufWorkspace root directory.
cwd: Arc<RwLock<PathBuf>>Current working directory (persists across bash invocations).
Implementations§
Source§impl ToolContext
impl ToolContext
Create a per-turn tool context that shares the cwd with other turns
but has its own independent spawner slot.
This prevents concurrent sessions from racing on the spawner field while still sharing the working directory state.
Sourcepub async fn set_subagent_spawner(
&self,
spawner: Option<Arc<dyn SubAgentSpawner>>,
)
pub async fn set_subagent_spawner( &self, spawner: Option<Arc<dyn SubAgentSpawner>>, )
Set the sub-agent spawner (called by runtime at turn start).
Sourcepub async fn subagent_spawner(&self) -> Option<Arc<dyn SubAgentSpawner>>
pub async fn subagent_spawner(&self) -> Option<Arc<dyn SubAgentSpawner>>
Get the sub-agent spawner (called by TaskTool).
Auto Trait Implementations§
impl !Freeze for ToolContext
impl !RefUnwindSafe for ToolContext
impl Send for ToolContext
impl Sync for ToolContext
impl Unpin for ToolContext
impl UnsafeUnpin for ToolContext
impl !UnwindSafe for ToolContext
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