Skip to main content

PathSettings

Struct PathSettings 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§user_data_dir: PathBuf

User-level, scene-specific override root (e.g. ~/.agix/scenes/<scope>/).

§global_data_dir: PathBuf

User-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: PathBuf

The project tier’s root: <project>/<project dir>/ in a project, the state root itself (global_data_dir) in a session without one.

§workspace: Workspace

Where the session’s tools work, and whether there is a project.

§scope: String

Which 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: bool

The project is not trusted: what its tier holds under a name the user tier also holds does not replace the user’s.

§layout: Layout

What the instance names its directories; local_data_dir is Layout::project_dir of the project.

Implementations§

Source§

impl PathSettings

Source

pub fn new( user_data_dir: PathBuf, global_data_dir: PathBuf, local_data_dir: PathBuf, workspace: Workspace, scope: String, layout: Layout, ) -> Self

Source

pub fn config_paths(&self) -> ConfigPaths

The derived paths of these roots.

Source

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

The project, None in a session without one.

Source

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

Source

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

Source

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.

Source

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

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 PathSettings

Source§

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

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

impl Default for PathSettings

Placeholder directories for settings that were not loaded from any — the ones [LoadedSettings::new] is commonly given in tests.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for PathSettings

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for PathSettings

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for PathSettings

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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