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
impl ProcessSession
Sourcepub fn from_parts(
admission: AcceptedLocalWorkspaceProcessAdmission,
runner: Arc<dyn ProcessRunner>,
permissioned_factory: Arc<dyn PermissionedProcessRunnerFactory>,
) -> Self
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.
Sourcepub fn with_permission_view(self, view: ProcessSessionPermissionView) -> Self
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.
Sourcepub fn with_session_permissions(
self,
permissions: ProcessSessionPermissions,
) -> Self
pub fn with_session_permissions( self, permissions: ProcessSessionPermissions, ) -> Self
Attaches the shared session-scoped capability store owned by this session.
Sourcepub fn with_access_policy_inputs(
self,
static_path_rules: Vec<PathAccessRule>,
workspace_writable: bool,
) -> Self
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.
Sourcepub fn with_network_policy_inputs(
self,
network_policy: CapabilityPolicy,
allowed_domains: Vec<String>,
browser_allow_local: bool,
) -> Self
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.
Sourcepub fn with_live_policy(self, policy: LivePolicyHandle) -> Self
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.
Sourcepub fn with_live_env_isolation(
self,
env_isolation: Arc<RwLock<ProcessEnvIsolation>>,
) -> Self
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.
Sourcepub fn with_env_isolation(self, env_isolation: ProcessEnvIsolation) -> Self
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.
Sourcepub const fn workspace_writable(&self) -> bool
pub const fn workspace_writable(&self) -> bool
Returns whether writes inside the workspace are allowed by this session.
Sourcepub fn has_live_policy(&self) -> bool
pub fn has_live_policy(&self) -> bool
Returns whether this session is backed by a live-swappable
merry_runtime::LivePolicyHandle (from LiveProcessBackend).
Sourcepub fn env_isolation(&self) -> &ProcessEnvIsolation
pub fn env_isolation(&self) -> &ProcessEnvIsolation
Returns the static environment isolation configured on this session.
Sourcepub const fn admission(&self) -> AcceptedLocalWorkspaceProcessAdmission
pub const fn admission(&self) -> AcceptedLocalWorkspaceProcessAdmission
Returns the runtime admission selected for this process boundary.
Sourcepub fn runner(&self) -> Arc<dyn ProcessRunner> ⓘ
pub fn runner(&self) -> Arc<dyn ProcessRunner> ⓘ
Returns the runner for ordinary process actions.
Sourcepub fn permissioned_factory(&self) -> Arc<dyn PermissionedProcessRunnerFactory> ⓘ
pub fn permissioned_factory(&self) -> Arc<dyn PermissionedProcessRunnerFactory> ⓘ
Returns the factory for reviewed process actions.
Sourcepub fn permission_view(&self) -> Option<ProcessSessionPermissionView>
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.
Sourcepub fn session_permissions(&self) -> Option<ProcessSessionPermissions>
pub fn session_permissions(&self) -> Option<ProcessSessionPermissions>
Returns the shared session-scoped capability store, when backed by one.
Sourcepub fn workspace_access_policy(
&self,
workspace_root: &Path,
workspace_writable: bool,
) -> WorkspaceAccessPolicy
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.
Sourcepub fn live_policy_handle(
&self,
workspace_root: &Path,
workspace_writable: bool,
) -> LivePolicyHandle
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.
Sourcepub fn network_access_policy(&self) -> NetworkAccessPolicy
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.
Sourcepub fn product_private_paths(&self) -> Vec<PathBuf>
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.
Sourcepub fn browser_spawner(
&self,
workspace_root: impl Into<PathBuf>,
) -> BrowserProcessSpawner
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.