pub trait SessionBackend: Send + Sync {
Show 14 methods
// Required methods
fn name(&self) -> &'static str;
fn capabilities(&self) -> Capabilities;
fn available(&self) -> Result<bool>;
fn spawn(&self, spec: SpawnSpec) -> Result<SessionRef>;
fn attach(&self, session: &SessionRef) -> Result<SessionRef>;
fn probe(&self, session: &SessionRef) -> Result<ResourceProbe>;
fn close(
&self,
session: &SessionRef,
reason: CloseReason,
force: bool,
) -> Result<()>;
// Provided methods
fn rename(&self, _session: &SessionRef, _title: &str) -> Result<()> { ... }
fn focus(&self, _session: &SessionRef) -> Result<()> { ... }
fn self_driven(&self) -> bool { ... }
fn deliver(
&self,
_session: &SessionRef,
_task_id: &str,
_prompt: &str,
) -> Result<()> { ... }
fn nudge(
&self,
_session: &SessionRef,
_task_id: &str,
_text: &str,
) -> Result<()> { ... }
fn set_content_sink(&self, _sink: Arc<dyn ContentSink>) { ... }
fn outcomes(&self) -> Option<OutcomeFeed> { ... }
}Required Methods§
fn name(&self) -> &'static str
fn capabilities(&self) -> Capabilities
fn available(&self) -> Result<bool>
fn spawn(&self, spec: SpawnSpec) -> Result<SessionRef>
fn attach(&self, session: &SessionRef) -> Result<SessionRef>
fn probe(&self, session: &SessionRef) -> Result<ResourceProbe>
fn close( &self, session: &SessionRef, reason: CloseReason, force: bool, ) -> Result<()>
Provided Methods§
fn rename(&self, _session: &SessionRef, _title: &str) -> Result<()>
fn focus(&self, _session: &SessionRef) -> Result<()>
Sourcefn self_driven(&self) -> bool
fn self_driven(&self) -> bool
Whether this backend carries task payloads itself. A backend that
answers true delivers through SessionBackend::deliver; one that
answers false keeps the adapter-socket path where a mounted plugin
receives assign or config_get{key:"stdin:<text>"}.
Sourcefn deliver(
&self,
_session: &SessionRef,
_task_id: &str,
_prompt: &str,
) -> Result<()>
fn deliver( &self, _session: &SessionRef, _task_id: &str, _prompt: &str, ) -> Result<()>
Hand one delivery’s rendered text to a session this backend owns.
The text is the delivery and nothing else: a backend that needs words of
its own sends them through SessionBackend::nudge.
Sourcefn nudge(
&self,
_session: &SessionRef,
_task_id: &str,
_text: &str,
) -> Result<()>
fn nudge( &self, _session: &SessionRef, _task_id: &str, _text: &str, ) -> Result<()>
Tell one session its turn ended without a completion, in this client’s
own words (docs/v2-CONTRACT.md §3c).
A backend that can hand the text over answers Ok; one that cannot —
because the drive has no injection channel, or its process is gone —
answers an error, and the turn-end rule settles the delivery at that
ending instead: a drive that cannot be nudged must not be told it was.
The text is this client’s, verbatim; a backend composes none of it and
keeps no copy.
Sourcefn set_content_sink(&self, _sink: Arc<dyn ContentSink>)
fn set_content_sink(&self, _sink: Arc<dyn ContentSink>)
Install the client-owned destination for records journalled by this backend. Backends without a journal keep the default no-op.
Sourcefn outcomes(&self) -> Option<OutcomeFeed>
fn outcomes(&self) -> Option<OutcomeFeed>
Terminal facts this backend observed without an adapter report. Absent for backends whose sessions end through the adapter socket.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".