pub struct BashState {Show 14 fields
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>,
pub derived_code_map_usage: DerivedCodeMapUsage,
pub recovery_note: Option<String>,
/* private fields */
}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.
derived_code_map_usage: DerivedCodeMapUsageIn-memory aggregate guard for syntax maps over non-canonical helpers.
Canonical CodeMap calls are intentionally not counted.
recovery_note: Option<String>Adapter-local, show-once message set when this state was rebuilt from
its persisted snapshot after a restart (see WinxService::tool_session_for).
Surfaced ahead of the next BashCommand result, then cleared; never
persisted — a note about one recovery must not outlive it.
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. This public API intentionally retains its 0.2.x signature and data
type; opaque receipt metadata lives in a separate private queue.
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.
Sourcepub fn latest_edit_checkpoint_for(
&self,
file_path_str: &str,
) -> Option<EditCheckpoint>
pub fn latest_edit_checkpoint_for( &self, file_path_str: &str, ) -> Option<EditCheckpoint>
Clone the most recent per-file checkpoint without consuming it. Undo removes the checkpoint only after the replacement commits successfully.
Sourcepub fn record_read_coverage(
&mut self,
path: &str,
ranges: impl IntoIterator<Item = (usize, usize)>,
file_hash: String,
total_lines: usize,
)
pub fn record_read_coverage( &mut self, path: &str, ranges: impl IntoIterator<Item = (usize, usize)>, file_hash: String, total_lines: usize, )
Merge visible read coverage for path and make it the newest guarded
entry. Coverage from a different file version is discarded instead of
being combined with the new hash, which could otherwise make disjoint
reads across two versions look like one complete read.
Sourcepub fn set_whitelist_entry(&mut self, path: &str, entry: FileWhitelistData)
pub fn set_whitelist_entry(&mut self, path: &str, entry: FileWhitelistData)
Replace a whitelist entry after a successful edit or undo.
Sourcepub fn remove_whitelist_entry(
&mut self,
path: &str,
) -> Option<FileWhitelistData>
pub fn remove_whitelist_entry( &mut self, path: &str, ) -> Option<FileWhitelistData>
Remove a whitelist entry and its LRU metadata.
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
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>
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>
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)
&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)
&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<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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> ⓘ
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