Skip to main content

ProdWorkerFacade

Struct ProdWorkerFacade 

Source
pub struct ProdWorkerFacade {
    workspace: Weak<Workspace>,
}
Expand description

Production impl. Holds a Weak<Workspace> so construction doesn’t close a strong cycle through the Workspace -> bridge -> MCP -> Tool -> facade -> Workspace path. Every method starts with upgrade() and short-circuits when the workspace has been dropped (only possible during shutdown).

Fields§

§workspace: Weak<Workspace>

Implementations§

Trait Implementations§

Source§

impl WorkerFacade for ProdWorkerFacade

Source§

fn caller_project(&self, caller: &SessionSlot) -> Option<CallerProject>

Resolve the caller’s project key + lead/worker flag. Returns None when caller matches no known session.
Source§

fn spawn_worker<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, label: String, charter: String, kick: Option<String>, resume_kick: Option<String>, interactive: bool, resume_session: bool, mcp_families: Option<Vec<String>>, cwd: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<WorkerSpawnReply, WorkerSpawnError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dispatch a Command::SpawnWorker and await its synchronous reply. Gating (lead-only, non-empty label, non-empty charter) happens before dispatch. resume_kick is persisted rather than delivered now; it replaces the generic restart note when this worker resumes after a forge restart with a turn that was cut off. A worker that was idle when forge stopped resumes with nothing delivered. interactive keeps the built-in AskUserQuestion tool, which every other worker is denied. resume_session resumes the label’s most recent prior session instead of starting fresh. A label with none resolves to ResumeTarget::None, which starts a fresh session and says so in the reply’s SessionChoice; only a lookup that failed is an error. Read more
Source§

fn update_worker( &self, caller: &SessionSlot, label: &str, charter: Option<String>, kick: Option<String>, resume_kick: Option<String>, mcp_families: Option<Vec<String>>, ) -> Result<(), WorkerUpdateError>

Merge the supplied fields onto the stored dynamic-worker row for label in the caller’s project, leaving a None field at its stored value. Errors with NoSuchWorker when no row exists: update revises an existing worker, it never creates one. Takes effect on that worker’s next respawn, since a session’s system prompt and tool list are fixed when the session spawns. mcp_families follows the same contract: None leaves the stored selection alone, Some(names) replaces it - canonicalised by the tool - and Some(empty) resets it to every family.
Source§

fn despawn_worker<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, label: &'life2 str, force: bool, ) -> Pin<Box<dyn Future<Output = Result<DespawnOutcome, WorkerDespawnError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Dispatch a Command::DespawnWorker and await its result. Gating (lead-only, non-empty label) happens before dispatch. force removes a dirty worktree; without it a dirty worktree blocks the despawn (DespawnOutcome::Blocked).
Source§

fn list_workers(&self, caller: &SessionSlot) -> Vec<WorkerStatus>

Snapshot of every worker in the caller’s project. Returns an empty Vec when the caller resolves to no project.
Source§

fn list_all_workers(&self) -> Vec<WorkerStatus>

Snapshot of every project’s workers: the real workspace walks list_projects in config order, the mock sorts its project keys.
Source§

fn capacity(&self, caller: &SessionSlot) -> Option<WorkerCapacity>

The caller’s project worker capacity: the cap the spawn path enforces (max_workers in the project’s [[orgs.projects]] entry, else DEFAULT_MAX_WORKERS_PER_PROJECT) paired with the live count. A plain data read - the same one the spawn path’s cap check performs. Returns None when the caller resolves to no project.
Source§

fn deliver_worker_prompt<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, target_label: &'life2 str, wrapped: WrappedPrompt, ) -> Pin<Box<dyn Future<Output = Result<WorkerTargetStatus, WorkerDeliverError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Dispatch a worker-bound wrapped prompt. Delivered means the prompt was accepted - handed to the target’s session queue, held for its turn end, or parked for its connect - which is the whole claim the sender’s ack makes; anything that reached no session is an error. UnknownLabel when no live worker matches.
Source§

fn deliver_worker_prompt_to_project<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, org: &'life2 str, project: &'life3 str, target_label: &'life4 str, wrapped: WrappedPrompt, ) -> Pin<Box<dyn Future<Output = Result<WorkerTargetStatus, WorkerDeliverError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Dispatch a worker-bound wrapped prompt to a project named by its (org, project) pair rather than the caller’s own. The caller lives in another project, so the target cannot be resolved from it. Mirrors deliver_worker_prompt otherwise: an unknown label is an error and a sleeping target is not auto-spawned.
Source§

fn deliver_prompt_to_lead<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, wrapped: WrappedPrompt, ) -> Pin<Box<dyn Future<Output = Result<WorkerTargetStatus, WorkerLeadDeliverError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dispatch a wrapped prompt from a worker back to its lead. Caller MUST be a worker. The target lead is resolved from the caller’s WorkerEntry::spawned_by_session_id. Same wire-shape contract as deliver_worker_prompt: Delivered means the lead’s session accepted it, and one the session could not take is an error.

Auto Trait Implementations§

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
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

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
§

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

§

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

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

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
§

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
§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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