pub struct AgentWorktree { /* private fields */ }Expand description
A subagent’s private checkout.
Implementations§
Source§impl AgentWorktree
impl AgentWorktree
Sourcepub fn create(workdir: &Path, agent_id: &str) -> Result<AgentWorktree, Error>
pub fn create(workdir: &Path, agent_id: &str) -> Result<AgentWorktree, Error>
Create an isolated checkout for agent_id, seeded with workdir’s
current uncommitted state.
workdir is the session’s directory; it may be the repo top level or
any directory under it. The child is rooted at the matching relative
path inside the worktree, so a session running in crates/foo gives
its children a crates/foo too and relative paths in the prompt
still mean what they say.
Sourcepub fn project_root(&self) -> &Path
pub fn project_root(&self) -> &Path
Top level of the project this work merges back into. Callers serializing merges key their lock on this.
Sourcepub fn pending_files(&self) -> Result<Vec<PathBuf>, Error>
pub fn pending_files(&self) -> Result<Vec<PathBuf>, Error>
Absolute project paths the child’s pending work would touch.
Callers checkpoint these before Self::merge_into_project, so a
merged patch is as recoverable through /restore as any other tool’s
mutation. Reading them separately (rather than out of the merge
result) is what lets the snapshot happen before the files change.
Sorted and deduplicated, so a caller can feed them straight to a multi-path lock acquisition without risking a deadlock against another caller holding the same paths in a different order.
Sourcepub fn merge_into_project(&mut self) -> Result<MergeOutcome, Error>
pub fn merge_into_project(&mut self) -> Result<MergeOutcome, Error>
Apply the child’s work to the project.
Callers must serialize this across concurrent children — two patches applying at once reintroduce exactly the interleaving the worktree exists to prevent.
Sourcepub fn destroy(self)
pub fn destroy(self)
Remove the checkout. Best-effort: a worktree we cannot delete is
disk we can reclaim later (see gc_orphaned_worktrees), never a
reason to fail the agent whose work already merged.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AgentWorktree
impl RefUnwindSafe for AgentWorktree
impl Send for AgentWorktree
impl Sync for AgentWorktree
impl Unpin for AgentWorktree
impl UnsafeUnpin for AgentWorktree
impl UnwindSafe for AgentWorktree
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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
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