pub struct PersistentShell { /* private fields */ }Expand description
Commands through persistent sessions instead of a process each: one session for the
harness’s own commands (each in a fresh subshell in the directory asked for, never affected
by the model’s) and one for the model’s bash (its cd and export carry over). Falls back
to a process per command, exactly as [LocalShell] / ContainerShell, when a session
cannot start.
A docker exec per call cost 60-110 ms and a container edit about 300 ms; a session round
trip costs a few milliseconds (harness_bench, 2026-09-24).
Implementations§
Source§impl PersistentShell
impl PersistentShell
pub fn new(launcher: Launcher) -> Self
pub fn local(root: PathBuf) -> Self
pub fn local_sandboxed(root: PathBuf, profile: impl Into<Profile>) -> Self
pub fn sandboxed(root: PathBuf, profile: impl Into<Profile>) -> Self
pub fn container(container_id: String, workdir: PathBuf) -> Self
Sourcepub fn is_persistent(&self) -> bool
pub fn is_persistent(&self) -> bool
Whether the harness session is (or can be) running. False means every call falls back.
Trait Implementations§
Source§impl Drop for PersistentShell
impl Drop for PersistentShell
Source§impl Shell for PersistentShell
impl Shell for PersistentShell
Source§fn exec(
&self,
command: &str,
cwd: &Path,
timeout: Duration,
) -> Result<Output, String>
fn exec( &self, command: &str, cwd: &Path, timeout: Duration, ) -> Result<Output, String>
Run a command to completion. Blocking by contract – see
tools for why.Source§fn exec_user(
&self,
command: &str,
cwd: &Path,
timeout: Duration,
) -> Result<Output, String>
fn exec_user( &self, command: &str, cwd: &Path, timeout: Duration, ) -> Result<Output, String>
Run a command the model issued. Where the executor keeps a persistent session, its
cd and export carry over to the model’s next command, as in a terminal. The default
is exec: a fresh process in cwd.fn exec_host( &self, command: &str, cwd: &Path, timeout: Duration, ) -> Result<Output, String>
Auto Trait Implementations§
impl !Freeze for PersistentShell
impl !RefUnwindSafe for PersistentShell
impl !UnwindSafe for PersistentShell
impl Forget for PersistentShell
impl Move for PersistentShell
impl Send for PersistentShell
impl Sync for PersistentShell
impl Unpin for PersistentShell
impl UnsafeUnpin for PersistentShell
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more