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
impl SensitivePaths
pub fn new( state_root: Option<&Path>, project: Option<&Path>, layout: Layout, ) -> Self
Sourcepub fn with_foreign_state_roots(self, roots: &[PathBuf]) -> Self
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.
Sourcepub fn foreign_state_roots(&self) -> Vec<PathBuf>
pub fn foreign_state_roots(&self) -> Vec<PathBuf>
The other instances’ state roots, as given.
Sourcepub fn with_read_denials(self, denied: &[PathBuf], allowed: &[PathBuf]) -> Self
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.
Sourcepub fn linked_scene_dirs_resolved(&self) -> &[PathBuf]
pub fn linked_scene_dirs_resolved(&self) -> &[PathBuf]
The scene directories that are symbolic links, as they resolved when these paths were made.
Sourcepub fn for_paths(paths: &ConfigPaths) -> Self
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.
pub fn state_root(&self) -> Option<&Path>
Sourcepub fn is_credential(&self, abs: &Path) -> bool
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.
Sourcepub fn credential_locations(&self, engine_dirs: &[PathBuf]) -> Vec<Located>
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.
Sourcepub fn engine_dirs_in(&self, dir: &Path) -> Vec<PathBuf>
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.
Sourcepub fn config_roots_in(&self, dir: &Path) -> Vec<ConfigRootAt>
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.
Sourcepub fn worktree_dirs_in(&self, dir: &Path) -> Vec<PathBuf>
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.
Sourcepub fn names_configuration(&self, text: &str) -> bool
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.
Sourcepub fn is_engine_settings_file(&self, abs: &Path) -> bool
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.
Sourcepub fn is_engine_working_entry(&self, name: &str) -> bool
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.
Sourcepub fn state_working_dirs(&self) -> Vec<PathBuf>
pub fn state_working_dirs(&self) -> Vec<PathBuf>
The state root’s STATE_ROOT_WORKING_DIRS: what the tools may write
there.
Sourcepub fn readable_state_root(&self) -> Option<PathBuf>
pub fn readable_state_root(&self) -> Option<PathBuf>
The state root, all of which the tools may read but its credentials.
Sourcepub fn session_tmp_dir(&self, session_id: &str) -> Option<PathBuf>
pub fn session_tmp_dir(&self, session_id: &str) -> Option<PathBuf>
<state root>/tmp/<session>, the session’s own temporary directory.
Sourcepub fn session_scratch_dir(&self, session_id: &str) -> Option<PathBuf>
pub fn session_scratch_dir(&self, session_id: &str) -> Option<PathBuf>
session_scratch_dir under this state root.
Sourcepub fn scene_dirs(&self) -> Vec<PathBuf>
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.
Sourcepub fn prompt_files(&self) -> PromptFiles
pub fn prompt_files(&self) -> PromptFiles
How the engine reads a file of the project for the model.
Sourcepub fn prompt_files_within(&self, dir: &Path) -> PromptFiles
pub fn prompt_files_within(&self, dir: &Path) -> PromptFiles
How the engine reads a file under dir for the model.