pub struct ToolScope { /* private fields */ }Expand description
Runtime tool scope used to determine provider-visible tools.
Implementations§
Source§impl ToolScope
impl ToolScope
Sourcepub fn new_with_control_tool_names(
base_tools: Arc<[Arc<ToolDef>]>,
control_tool_names: HashSet<String>,
) -> Self
pub fn new_with_control_tool_names( base_tools: Arc<[Arc<ToolDef>]>, control_tool_names: HashSet<String>, ) -> Self
Build a scope with an explicit set of control-plane tool names.
Sourcepub fn new_with_projection_names(
base_tools: Arc<[Arc<ToolDef>]>,
control_tool_names: HashSet<String>,
deferred_tool_names: HashSet<String>,
) -> Self
pub fn new_with_projection_names( base_tools: Arc<[Arc<ToolDef>]>, control_tool_names: HashSet<String>, deferred_tool_names: HashSet<String>, ) -> Self
Build a scope with explicit control-plane and deferred-session names.
Sourcepub fn visible_tools(&self) -> Arc<[Arc<ToolDef>]>
pub fn visible_tools(&self) -> Arc<[Arc<ToolDef>]>
Returns the currently visible tools using base + active external filter composition.
Sourcepub fn visible_tools_result(
&self,
) -> Result<Arc<[Arc<ToolDef>]>, ToolScopeApplyError>
pub fn visible_tools_result( &self, ) -> Result<Arc<[Arc<ToolDef>]>, ToolScopeApplyError>
Returns current visible tools, or an explicit error for boundary fail-safe handling.
Sourcepub fn handle(&self) -> ToolScopeHandle
pub fn handle(&self) -> ToolScopeHandle
Return a handle for thread-safe staged external updates.
Sourcepub fn apply_staged(
&self,
new_base_tools: Arc<[Arc<ToolDef>]>,
) -> Result<ToolScopeBoundaryResult, ToolScopeApplyError>
pub fn apply_staged( &self, new_base_tools: Arc<[Arc<ToolDef>]>, ) -> Result<ToolScopeBoundaryResult, ToolScopeApplyError>
Atomically apply staged state at CallingLlm boundary.
Sequence:
- Refresh base from dispatcher snapshot.
- Prune active/pending filters against base deltas.
- Apply staged external filter revision.
- Compute visible tools.
Sourcepub fn apply_staged_projection(
&self,
new_base_tools: Arc<[Arc<ToolDef>]>,
control_tool_names: HashSet<String>,
deferred_tool_names: HashSet<String>,
) -> Result<ToolScopeBoundaryResult, ToolScopeApplyError>
pub fn apply_staged_projection( &self, new_base_tools: Arc<[Arc<ToolDef>]>, control_tool_names: HashSet<String>, deferred_tool_names: HashSet<String>, ) -> Result<ToolScopeBoundaryResult, ToolScopeApplyError>
Atomically apply staged state and refresh the live projection names.
Sourcepub fn compose(filters: &[ToolFilter]) -> ComposedToolFilter
pub fn compose(filters: &[ToolFilter]) -> ComposedToolFilter
Compose filters with most-restrictive semantics.
Sourcepub fn set_base_filter(
&self,
filter: ToolFilter,
) -> Result<(), ToolScopeApplyError>
pub fn set_base_filter( &self, filter: ToolFilter, ) -> Result<(), ToolScopeApplyError>
Set the base filter for this scope.
The base filter is the most fundamental restriction layer — it is composed with external and turn-level filters using most-restrictive semantics. This is used for inherited tool visibility from a parent agent’s scope.
Sourcepub fn set_visibility_state(
&self,
visibility_state: SessionToolVisibilityState,
) -> Result<(), ToolScopeApplyError>
pub fn set_visibility_state( &self, visibility_state: SessionToolVisibilityState, ) -> Result<(), ToolScopeApplyError>
Replace the durable tool visibility state carried by this projection bridge.
Sourcepub fn visibility_state(
&self,
) -> Result<SessionToolVisibilityState, ToolScopeApplyError>
pub fn visibility_state( &self, ) -> Result<SessionToolVisibilityState, ToolScopeApplyError>
Snapshot the current durable visibility state.
Sourcepub fn visible_tool_names(
&self,
) -> Result<BTreeSet<String>, ToolScopeApplyError>
pub fn visible_tool_names( &self, ) -> Result<BTreeSet<String>, ToolScopeApplyError>
Return the names currently visible to the session plane.
Sourcepub fn staged_session_filters_allow_name(
&self,
name: &str,
) -> Result<bool, ToolScopeApplyError>
pub fn staged_session_filters_allow_name( &self, name: &str, ) -> Result<bool, ToolScopeApplyError>
Return whether the staged durable session filters would allow a session-plane tool name to become visible after the next boundary.
Sourcepub fn base_tools_snapshot(
&self,
) -> Result<Arc<[Arc<ToolDef>]>, ToolScopeApplyError>
pub fn base_tools_snapshot( &self, ) -> Result<Arc<[Arc<ToolDef>]>, ToolScopeApplyError>
Return the current base tool snapshot.
Sourcepub fn base_tool_names(&self) -> Result<BTreeSet<String>, ToolScopeApplyError>
pub fn base_tool_names(&self) -> Result<BTreeSet<String>, ToolScopeApplyError>
Return the current base tool names.
Sourcepub fn revisions(
&self,
) -> Result<(ToolScopeRevision, ToolScopeRevision), ToolScopeApplyError>
pub fn revisions( &self, ) -> Result<(ToolScopeRevision, ToolScopeRevision), ToolScopeApplyError>
Return the currently configured active and staged revisions.
Sourcepub fn missing_requested_names(
&self,
) -> Result<BTreeSet<String>, ToolScopeApplyError>
pub fn missing_requested_names( &self, ) -> Result<BTreeSet<String>, ToolScopeApplyError>
Return any requested deferred names that are not currently present in the base snapshot.
Sourcepub fn missing_filter_names(
&self,
) -> Result<BTreeSet<String>, ToolScopeApplyError>
pub fn missing_filter_names( &self, ) -> Result<BTreeSet<String>, ToolScopeApplyError>
Return any durable filter names that are not currently present in the base snapshot.
Sourcepub fn stage_requested_deferred_names(
&self,
names: BTreeSet<String>,
) -> Result<ToolScopeRevision, ToolScopeStageError>
pub fn stage_requested_deferred_names( &self, names: BTreeSet<String>, ) -> Result<ToolScopeRevision, ToolScopeStageError>
Record durable requested deferred names for the next boundary.
Sourcepub fn add_requested_deferred_names(
&self,
names: &BTreeSet<String>,
witnesses: &BTreeMap<String, ToolVisibilityWitness>,
) -> Result<ToolScopeRevision, ToolScopeStageError>
pub fn add_requested_deferred_names( &self, names: &BTreeSet<String>, witnesses: &BTreeMap<String, ToolVisibilityWitness>, ) -> Result<ToolScopeRevision, ToolScopeStageError>
Add durable requested deferred names for the next boundary.