pub struct Engine {
pub store: Arc<Store>,
pub github: Option<Arc<dyn GithubApi>>,
/* private fields */
}Fields§
§store: Arc<Store>§github: Option<Arc<dyn GithubApi>>Optional GitHub API client. None when no token is configured.
Implementations§
Source§impl Engine
impl Engine
pub fn new(store: Arc<Store>) -> Arc<Self>
pub fn new_with_github(store: Arc<Store>, token: String) -> Arc<Self>
Sourcepub fn new_with_github_api(
store: Arc<Store>,
github: Arc<dyn GithubApi>,
) -> Arc<Self>
pub fn new_with_github_api( store: Arc<Store>, github: Arc<dyn GithubApi>, ) -> Arc<Self>
Construct an Engine with a caller-supplied GithubApi — the
dependency-injection seam tests use to drive the GitHub-enrichment
poller against a fake instead of the real network.
Sourcepub async fn register_stream(&self, session_id: SessionId) -> Receiver<()>
pub async fn register_stream(&self, session_id: SessionId) -> Receiver<()>
Cancel any running FIFO reader for session_id and return a fresh
cancellation receiver for the new reader. Call this at the top of
every start_streaming invocation.
pub fn emit(&self, event: Event)
pub fn subscribe(&self) -> Receiver<Event>
pub async fn register_pty_writer( &self, session_id: SessionId, writer: UnboundedSender<Vec<u8>>, )
pub async fn get_pty_writer( &self, session_id: &str, ) -> Option<UnboundedSender<Vec<u8>>>
Sourcepub async fn remove_orchestrator(&self, orchestrator_id: &str) -> Result<()>
pub async fn remove_orchestrator(&self, orchestrator_id: &str) -> Result<()>
Kill all worker sessions belonging to an orchestrator, delete from DB, emit events.
Sourcepub async fn remove_session(&self, session_id: &str) -> Result<()>
pub async fn remove_session(&self, session_id: &str) -> Result<()>
Kill the tmux session and delete it from the DB entirely.
Sourcepub async fn send_to_session(
&self,
session_id: &str,
message: &str,
) -> Result<()>
pub async fn send_to_session( &self, session_id: &str, message: &str, ) -> Result<()>
Send a text message to the agent running in a session’s tmux window. The message is injected as keyboard input — the agent sees it as typed text. Returns Ok(()) if the tmux send succeeded; returns an error if the session has no active tmux window or tmux is unavailable.
Sourcepub async fn terminate_session(&self, session_id: &str) -> Result<()>
pub async fn terminate_session(&self, session_id: &str) -> Result<()>
Kill the tmux session, mark it Terminated in the DB, and emit SessionUpdated.
Sourcepub async fn cleanup_session(&self, session_id: &str) -> Result<()>
pub async fn cleanup_session(&self, session_id: &str) -> Result<()>
Kill the tmux session (best-effort), remove its worktree/artifacts,
and mark it Done in the DB. Called automatically when a PR is
merged. Emits SessionUpdated. Mirrors remove_session’s worktree
and artifact cleanup so the record isn’t deleted here but still
stops leaking a checked-out worktree and per-session hook files.
Auto Trait Implementations§
impl !Freeze for Engine
impl !RefUnwindSafe for Engine
impl !UnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
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