Skip to main content

Engine

Struct Engine 

Source
pub struct Engine {
    pub store: Arc<Store>,
    pub github: Option<GitHubClient>,
    /* private fields */
}

Fields§

§store: Arc<Store>§github: Option<GitHubClient>

Optional GitHub API client. None when no token is configured.

Implementations§

Source§

impl Engine

Source

pub fn new(store: Arc<Store>) -> Arc<Self>

Source

pub fn new_with_github(store: Arc<Store>, token: String) -> Arc<Self>

Source

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.

Source

pub fn emit(&self, event: Event)

Source

pub fn subscribe(&self) -> Receiver<Event>

Source

pub async fn register_pty_writer( &self, session_id: SessionId, writer: UnboundedSender<Vec<u8>>, )

Source

pub async fn get_pty_writer( &self, session_id: &str, ) -> Option<UnboundedSender<Vec<u8>>>

Source

pub async fn remove_orchestrator(&self, orchestrator_id: &str) -> Result<()>

Kill all worker sessions belonging to an orchestrator, delete from DB, emit events.

Source

pub async fn remove_session(&self, session_id: &str) -> Result<()>

Kill the tmux session and delete it from the DB entirely.

Source

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.

Source

pub async fn terminate_session(&self, session_id: &str) -> Result<()>

Kill the tmux session, mark it Terminated in the DB, and emit SessionUpdated.

Source

pub async fn cleanup_session(&self, session_id: &str) -> Result<()>

Kill the tmux session (best-effort) and mark it Done in the DB. Called automatically when a PR is merged. Emits SessionUpdated.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more