pub struct BashState {
pub cwd: PathBuf,
pub workspace_root: PathBuf,
pub current_thread_id: String,
pub mode: Modes,
pub bash_command_mode: BashCommandMode,
pub file_edit_mode: FileEditMode,
pub write_if_empty_mode: WriteIfEmptyMode,
pub whitelist_for_overwrite: HashMap<String, FileWhitelistData>,
pub pty_shell: Arc<Mutex<Option<PtyShell>>>,
pub foreground_command_gate: Arc<Mutex<()>>,
pub initialized: bool,
pub edit_checkpoints: VecDeque<EditCheckpoint>,
}Fields§
§cwd: PathBuf§workspace_root: PathBuf§current_thread_id: String§mode: Modes§bash_command_mode: BashCommandMode§file_edit_mode: FileEditMode§write_if_empty_mode: WriteIfEmptyMode§whitelist_for_overwrite: HashMap<String, FileWhitelistData>§pty_shell: Arc<Mutex<Option<PtyShell>>>§foreground_command_gate: Arc<Mutex<()>>Serializes foreground command startup across cloned request-local states. Status/input actions remain concurrent so callers can drive a running TUI.
initialized: bool§edit_checkpoints: VecDeque<EditCheckpoint>In-memory ring of recent edit checkpoints for UndoEdit (newest at the
back). Deliberately not part of BashStateSnapshot: undo is for immediate
mid-session recovery, not across restarts.
Implementations§
Source§impl BashState
impl BashState
pub fn new() -> Self
Sourcepub fn push_edit_checkpoint(&mut self, checkpoint: EditCheckpoint)
pub fn push_edit_checkpoint(&mut self, checkpoint: EditCheckpoint)
Record a pre-edit checkpoint for UndoEdit, dropping the oldest past the
cap. Large files are skipped (not undoable) to bound memory.
Sourcepub fn pop_edit_checkpoint_for(
&mut self,
file_path_str: &str,
) -> Option<EditCheckpoint>
pub fn pop_edit_checkpoint_for( &mut self, file_path_str: &str, ) -> Option<EditCheckpoint>
Remove and return the most recent checkpoint for file_path_str (per-file
LIFO, so repeated undos on one file walk its edits back while leaving other
files’ checkpoints in place). None if that file has no checkpoint.
pub async fn init_pty_shell(&mut self) -> Result<()>
pub fn update_cwd(&mut self, path: &Path) -> Result<()>
pub fn update_workspace_root(&mut self, path: &Path) -> Result<()>
pub fn is_command_allowed(&self, command: &str) -> bool
pub fn is_file_edit_allowed(&self, path: &str) -> bool
pub fn is_file_write_allowed(&self, path: &str) -> bool
pub fn save_state_to_disk(&self) -> Result<()>
pub fn snapshot(&self) -> BashStateSnapshot
pub fn apply_snapshot(&mut self, snapshot: &BashStateSnapshot)
pub fn load_state_from_disk(&mut self, thread_id: &str) -> Result<bool>
pub fn new_with_thread_id(thread_id: Option<&str>) -> Self
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for BashState
impl !UnwindSafe for BashState
impl Freeze for BashState
impl Send for BashState
impl Sync for BashState
impl Unpin for BashState
impl UnsafeUnpin for BashState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more