Skip to main content

ProcessSession

Struct ProcessSession 

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

One process execution boundary used by a runtime instance.

The admission and both runner capabilities are kept together so callers cannot accidentally pair a runner with a permission factory from another backend configuration. Child runtimes obtain their process session through ProcessBackend::new_session or ProcessBackend::new_session_with, whose backend controls session isolation.

Implementations§

Source§

impl ProcessSession

Source

pub fn from_parts( admission: AcceptedLocalWorkspaceProcessAdmission, runner: Arc<dyn ProcessRunner>, permissioned_factory: Arc<dyn PermissionedProcessRunnerFactory>, ) -> Self

Creates a session from an explicit, trusted adapter boundary.

Production callers should select LocalProcessBackend::new so the admission, runner, and reviewed-action factory are produced by one backend implementation. This constructor exists for adapters and deterministic fixtures that already own all three components.

Source

pub fn with_permission_view(self, view: ProcessSessionPermissionView) -> Self

Attaches a read-only view of this session’s retained permissions so child runtimes may inherit already-approved ordinary capabilities without mutating the parent session.

Source

pub fn with_session_permissions( self, permissions: ProcessSessionPermissions, ) -> Self

Attaches the shared session-scoped capability store owned by this session.

Source

pub fn with_access_policy_inputs( self, static_path_rules: Vec<PathAccessRule>, workspace_writable: bool, ) -> Self

Attaches the static path rules and workspace writability backing this session so in-process workspace tools share the same access policy.

Source

pub fn with_network_policy_inputs( self, network_policy: CapabilityPolicy, allowed_domains: Vec<String>, browser_allow_local: bool, ) -> Self

Attaches static outbound network and browser-local policy inputs backing this session so in-process web/browser tools share the same rules.

Source

pub fn with_live_policy(self, policy: LivePolicyHandle) -> Self

Attaches a unified single-lock merry_runtime::LivePolicyHandle shared with a LiveProcessBackend so mid-session sandbox, path, protected-path, and network changes update file tools, web/browser tools, and child sessions atomically.

Source

pub fn with_live_env_isolation( self, env_isolation: Arc<RwLock<ProcessEnvIsolation>>, ) -> Self

Attaches a live environment-isolation handle shared with a LiveProcessBackend so browser spawns always observe the latest isolated environment configuration.

Source

pub fn with_env_isolation(self, env_isolation: ProcessEnvIsolation) -> Self

Attaches the environment isolation policy stripped from browser and child processes spawned under this session.

Source

pub const fn workspace_writable(&self) -> bool

Returns whether writes inside the workspace are allowed by this session.

Source

pub fn has_live_policy(&self) -> bool

Returns whether this session is backed by a live-swappable merry_runtime::LivePolicyHandle (from LiveProcessBackend).

Source

pub fn env_isolation(&self) -> &ProcessEnvIsolation

Returns the static environment isolation configured on this session.

Source

pub const fn admission(&self) -> AcceptedLocalWorkspaceProcessAdmission

Returns the runtime admission selected for this process boundary.

Source

pub fn runner(&self) -> Arc<dyn ProcessRunner> ⓘ

Returns the runner for ordinary process actions.

Source

pub fn permissioned_factory(&self) -> Arc<dyn PermissionedProcessRunnerFactory> ⓘ

Returns the factory for reviewed process actions.

Source

pub fn permission_view(&self) -> Option<ProcessSessionPermissionView>

Returns a read-only view of capabilities retained by this session, when backed by a session-scoped permission store.

Source

pub fn session_permissions(&self) -> Option<ProcessSessionPermissions>

Returns the shared session-scoped capability store, when backed by one.

Source

pub fn workspace_access_policy( &self, workspace_root: &Path, workspace_writable: bool, ) -> WorkspaceAccessPolicy

Builds a unified merry_runtime::WorkspaceAccessPolicy sharing this session’s static rules and live session-scoped grants.

Source

pub fn live_policy_handle( &self, workspace_root: &Path, workspace_writable: bool, ) -> LivePolicyHandle

Returns the unified single-lock merry_runtime::LivePolicyHandle backing this session, synthesizing a static handle if this session was not produced by LiveProcessBackend.

Source

pub fn network_access_policy(&self) -> NetworkAccessPolicy

Builds a unified merry_runtime::NetworkAccessPolicy sharing this session’s configured network policy, browser.allow_local, workspace allowed_domains, and live session-scoped domain/network grants.

Source

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

Returns Merry built-in ProductPrivate paths (such as providers/ and MERRY_API_KEY_FILE) configured on this session.

Source

pub fn browser_spawner( &self, workspace_root: impl Into<PathBuf>, ) -> BrowserProcessSpawner

Creates a desktop headless browser spawner bound to this session’s live policy handle and environment isolation policy.

Trait Implementations§

Source§

impl Clone for ProcessSession

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for ProcessSession

§

impl !UnwindSafe for ProcessSession

§

impl Forget for ProcessSession

§

impl Freeze for ProcessSession
where &'static str: Freeze, *const ArcInner<dyn ProcessRunner> is !null: Freeze, PhantomData<ArcInner<dyn ProcessRunner>>: Freeze, *const ArcInner<dyn PermissionedProcessRunnerFactory> is !null: Freeze, PhantomData<ArcInner<dyn PermissionedProcessRunnerFactory>>: Freeze, *const ArcInner<RwLock<ProcessSessionPermissionState>> is !null: Freeze, PhantomData<ArcInner<RwLock<ProcessSessionPermissionState>>>: Freeze, *const u8 is !null: Freeze, PhantomData<PathAccessRule>: Freeze, PhantomData<String>: Freeze, *const ArcInner<RwLock<Arc<LivePolicyBaseline>>> is !null: Freeze, PhantomData<ArcInner<RwLock<Arc<LivePolicyBaseline>>>>: Freeze, *const ArcInner<ChildWorkspacePolicyOverride> is !null: Freeze, PhantomData<ArcInner<ChildWorkspacePolicyOverride>>: Freeze, *const ArcInner<RwLock<ProcessEnvIsolation>> is !null: Freeze, PhantomData<ArcInner<RwLock<ProcessEnvIsolation>>>: Freeze, PhantomData<OsString>: Freeze,

§

impl Move for ProcessSession

§

impl Send for ProcessSession

§

impl Sync for ProcessSession

§

impl Unpin for ProcessSession

§

impl UnsafeUnpin for ProcessSession

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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