Skip to main content

SensitivePaths

Struct SensitivePaths 

Source
pub struct SensitivePaths { /* private fields */ }
Expand description

CREDENTIALS and the working space, resolved for one session: what its state root and its project are.

Implementations§

Source§

impl SensitivePaths

Source

pub fn new( state_root: Option<&Path>, project: Option<&Path>, layout: Layout, ) -> Self

Source

pub fn with_foreign_state_roots(self, roots: &[PathBuf]) -> Self

Also guards the credentials of these other instances’ state roots, as the session’s own are guarded. One that is the session’s own state root is left out.

Source

pub fn foreign_state_roots(&self) -> Vec<PathBuf>

The other instances’ state roots, as given.

Source

pub fn layout(&self) -> &Layout

The names these paths were resolved with.

Source

pub fn with_read_denials(self, denied: &[PathBuf], allowed: &[PathBuf]) -> Self

Also treats as credentials what a sandboxed command may not read: denied less what allowed re-allows, the more specific entry winning, as the sandbox profile does.

Source

pub fn linked_scene_dirs_resolved(&self) -> &[PathBuf]

The scene directories that are symbolic links, as they resolved when these paths were made.

Source

pub fn for_paths(paths: &ConfigPaths) -> Self

For a session with these roots, and the known_state_roots that are not its own. A session without a project has no project here either.

Source

pub fn state_root(&self) -> Option<&Path>

Source

pub fn is_credential(&self, abs: &Path) -> bool

Whether the absolute, normalized abs is, or is under, a credential location. Compared without case: on a case-insensitive filesystem Settings.JSON is the same file.

Source

pub fn credential_locations(&self, engine_dirs: &[PathBuf]) -> Vec<Located>

Every CREDENTIALS entry a sandbox backend masks, placed on disk: those of the state root and its scenes under the state root as it resolves (the session’s own first, then each foreign one), those of an engine directory in each of engine_dirs (Self::engine_dirs_in). The Anywhere ones are left out — the backends reach them through deny_read.

Source

pub fn engine_dirs_in(&self, dir: &Path) -> Vec<PathBuf>

The engine directories in dir whose key files the sandbox hides (Scope::AnyEngineDir), each as given and as it resolves, whether or not it exists.

Source

pub fn config_roots_in(&self, dir: &Path) -> Vec<ConfigRootAt>

The configuration roots in dir as the sandbox guards them: the instance’s own held even when absent, a foreign one where it exists.

Source

pub fn worktree_dirs_in(&self, dir: &Path) -> Vec<PathBuf>

The engine’s worktrees directories in dir, the configured one first (Layout::worktrees_dir_names): a .git link in one leads git.

Source

pub fn names_configuration(&self, text: &str) -> bool

Whether this path (or command argument) names configuration that must never be reached by a silent fast path, but which the user can legitimately approve: REPOSITORY_CONFIG_DIR, a configuration root (Layout::config_roots) outside the instance’s own working space, or a PROJECT_ENGINE_CONFIG_DIRS directory.

Not credentials: refusing them would make editing .claude/settings.json or .agix/agents/*.md impossible, and configuring the agent is a thing users routinely ask it to do. The risk is a tool quietly rewriting the rules it is judged by, so the gate does not let the tool’s own Allow through for them.

Matched by whole component — .github is not .git. Only the instance’s own directory has working space, state/scratchpad and state/memory in a project’s and scratchpad and memory in the session’s state root: in a foreign root every entry is configuration.

Source

pub fn is_engine_settings_file(&self, abs: &Path) -> bool

Whether abs is one of the ENGINE_CONFIG_FILES anywhere under a configuration root — by name and location, not by directory: a worktree’s checkout has configuration roots of its own. Without case, as Self::is_credential: an absent name has no true spelling to take.

Source

pub fn is_engine_working_entry(&self, name: &str) -> bool

Whether this entry directly in the state/ of the instance’s own directory, or directly in the state root, is the agent’s working space rather than its configuration: the scratchpad its prompt sends temporary files to, or the memory directory it is told to write to directly.

Source

pub fn state_working_dirs(&self) -> Vec<PathBuf>

The state root’s STATE_ROOT_WORKING_DIRS: what the tools may write there.

Source

pub fn readable_state_root(&self) -> Option<PathBuf>

The state root, all of which the tools may read but its credentials.

Source

pub fn session_tmp_dir(&self, session_id: &str) -> Option<PathBuf>

<state root>/tmp/<session>, the session’s own temporary directory.

Source

pub fn session_scratch_dir(&self, session_id: &str) -> Option<PathBuf>

session_scratch_dir under this state root.

Source

pub fn scene_dirs(&self) -> Vec<PathBuf>

The scene directories under the state root as it resolves, as they exist now. One created later is still covered wherever a rule is written for Scope::EachSceneDir.

Source

pub fn prompt_files(&self) -> PromptFiles

How the engine reads a file of the project for the model.

Source

pub fn prompt_files_within(&self, dir: &Path) -> PromptFiles

How the engine reads a file under dir for the model.

Trait Implementations§

Source§

impl Clone for SensitivePaths

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SensitivePaths

Source§

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

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

impl Default for SensitivePaths

Source§

fn default() -> Self

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<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