Skip to main content

WorkspaceFacade

Trait WorkspaceFacade 

Source
pub trait WorkspaceFacade: Send + Sync {
    // Required methods
    fn list_peers(&self) -> Vec<PeerStatus>;
    fn whoami(&self, caller: &SessionSlot) -> Option<PeerStatus>;
    fn deliver_peer_prompt(
        &self,
        caller: &SessionSlot,
        target_project: &str,
        wrapped: WrappedPrompt,
    ) -> Result<(), DeliverError>;
    fn handoff(
        &self,
        caller: &SessionSlot,
        note: String,
    ) -> Result<(), HandoffError>;
}
Expand description

The narrow workspace-state surface peer-coordination tools call into. See module docs for design rationale.

Required Methods§

Source

fn list_peers(&self) -> Vec<PeerStatus>

Snapshot of every configured project’s peer status, in forge.toml declaration order. Computed fresh on each call.

Source

fn whoami(&self, caller: &SessionSlot) -> Option<PeerStatus>

Identity of the calling session. Returns None when caller doesn’t resolve to any known project (defensive - the tools closure-bind a real key at spawn time, so this should be Some in practice).

Source

fn deliver_peer_prompt( &self, caller: &SessionSlot, target_project: &str, wrapped: WrappedPrompt, ) -> Result<(), DeliverError>

Deliver a wrapped peer prompt to target_project.

The answer is the handler’s own: Ok(()) once the target’s session took the prompt or it was parked for a spawn the handler kicked off, Err(UnknownTarget) for a project not in forge.toml, and Err(DispatchFailed) when the handler refused the delivery. A delivery that never left forge is never Ok (#2342).

Source

fn handoff( &self, caller: &SessionSlot, note: String, ) -> Result<(), HandoffError>

The exit call: the note is accepted only while a handoff is running on the caller’s own seat. A handoff starts at /handoff or at the automatic trigger (fill or compaction), which dispatch the command directly; no caller starts one through here.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl WorkspaceFacade for MockWorkspaceFacade

Available on crate features testing only.
Source§

impl WorkspaceFacade for ProdWorkspaceFacade