#[non_exhaustive]pub struct PathSettings {
pub user_data_dir: PathBuf,
pub global_data_dir: PathBuf,
pub local_data_dir: PathBuf,
pub workspace: Workspace,
pub scope: String,
pub project_untrusted: bool,
pub layout: Layout,
}Expand description
Path configuration for data directories.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.user_data_dir: PathBufUser-level, scene-specific override root (e.g. ~/.agix/scenes/<scope>/).
global_data_dir: PathBufUser-level, cross-scene global root — flat, shared by every scene
(e.g. ~/.agix/). Used by resources that don’t have a scene tier
(memory/sessions/recordings/mcp) and as the base layer for resources
that do (settings.json/skills/plugins/agents/rules/hooks).
See base::paths::ConfigPaths module docs for the full breakdown.
local_data_dir: PathBufThe project tier’s root: <project>/<project dir>/ in a project, the state
root itself (global_data_dir) in a session without one.
workspace: WorkspaceWhere the session’s tools work, and whether there is a project.
scope: StringWhich product instance’s user-level state user_data_dir was built
for (see base::paths::ConfigPaths). Carried alongside the resolved
dirs so downstream code (e.g. FrozenContext::collect_environment) doesn’t have
to re-derive it from the path.
project_untrusted: boolThe project is not trusted: what its tier holds under a name the user tier also holds does not replace the user’s.
layout: LayoutWhat the instance names its directories; local_data_dir is
Layout::project_dir of the project.
Implementations§
Source§impl PathSettings
impl PathSettings
pub fn new( user_data_dir: PathBuf, global_data_dir: PathBuf, local_data_dir: PathBuf, workspace: Workspace, scope: String, layout: Layout, ) -> Self
Sourcepub fn config_paths(&self) -> ConfigPaths
pub fn config_paths(&self) -> ConfigPaths
The derived paths of these roots.
Sourcepub fn project_root(&self) -> Option<&Path>
pub fn project_root(&self) -> Option<&Path>
The project, None in a session without one.
Sourcepub fn workspace_dir(&self) -> &Path
pub fn workspace_dir(&self) -> &Path
The workspace’s directory: the project, or the scratch directory. A
session given a worktree works there instead
(settings::SessionConfig::working_dir).
Sourcepub fn project_worktree_git(&self, git: &WorktreeGit) -> Option<WorktreeGit>
pub fn project_worktree_git(&self, git: &WorktreeGit) -> Option<WorktreeGit>
git, resolved, when its git directory is the project’s own
<project>/.git — the only git directory the sandbox guards for a
worktree — its entry lies directly under that directory’s
worktrees/, and its branch stays below refs/heads/.
Sourcepub fn local_settings_file(&self) -> Option<PathBuf>
pub fn local_settings_file(&self) -> Option<PathBuf>
The project tier’s settings.local.json — the file the interactive
permission prompt’s “always allow, this project” writes to.
Inside local_data_dir (the project directory), not beside it: the
Bash sandbox’s deny-file-write rules (tools::bash::sandbox) protect
exactly this path to stop a sandboxed command from granting itself
permissions, and a copy written anywhere else would sit outside that
protection while still being loaded by LoadedSettings::load.
None without a project: “this project” means nothing there, and its
local_data_dir is the state root, whose settings.local.json is the
global tier — a rule written there would allow the call everywhere.
Sourcepub fn project_state_dir(&self) -> Option<PathBuf>
pub fn project_state_dir(&self) -> Option<PathBuf>
The project directory’s state/ (Layout::project_state_dir),
None without a project.
Trait Implementations§
Source§impl Clone for PathSettings
impl Clone for PathSettings
Source§impl Debug for PathSettings
impl Debug for PathSettings
Source§impl Default for PathSettings
Placeholder directories for settings that were not loaded from any — the
ones [LoadedSettings::new] is commonly given in tests.
impl Default for PathSettings
Placeholder directories for settings that were not loaded from any — the
ones [LoadedSettings::new] is commonly given in tests.
Source§impl<'de> Deserialize<'de> for PathSettings
impl<'de> Deserialize<'de> for PathSettings
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for PathSettings
impl JsonSchema for PathSettings
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more