pub trait SessionSource:
Send
+ Sync
+ 'static {
// Required method
fn create<'life0, 'async_trait>(
&'life0 self,
cwd: PathBuf,
mcp: Vec<McpServer>,
) -> Pin<Box<dyn Future<Output = Result<PreparedRun, RunError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn resume<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
cwd: PathBuf,
mcp: Vec<McpServer>,
) -> Pin<Box<dyn Future<Output = Result<PreparedRun, RunError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn lists_sessions(&self) -> bool { ... }
fn list_sessions<'life0, 'async_trait>(
&'life0 self,
cwd: PathBuf,
) -> Pin<Box<dyn Future<Output = Result<Vec<PersistedSession>, RunError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Where an ACP session’s PreparedRun comes from.
The same seam as prepare_with_session,
at the protocol layer: a Rust host that already owns a mentra runtime —
custom tools, its own store, a provider basis does not know — can serve ACP
over it instead of letting basis build one. basis’s own tests are the other
consumer, driving the whole server against a scripted runtime with no
network.
A source that builds its own runtime owns its tool authorizer too, and a
session mode only reaches calls that authorizer surfaces: install
ApprovalGate — which is what basis’s own
source gets from the Runtime it builds — or the
client’s mode picker will have nothing to decide.
Required Methods§
Sourcefn create<'life0, 'async_trait>(
&'life0 self,
cwd: PathBuf,
mcp: Vec<McpServer>,
) -> Pin<Box<dyn Future<Output = Result<PreparedRun, RunError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create<'life0, 'async_trait>(
&'life0 self,
cwd: PathBuf,
mcp: Vec<McpServer>,
) -> Pin<Box<dyn Future<Output = Result<PreparedRun, RunError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Opens a conversation in cwd, for session/new, with the MCP servers
the client configured for this session.
Provided Methods§
Sourcefn resume<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
cwd: PathBuf,
mcp: Vec<McpServer>,
) -> Pin<Box<dyn Future<Output = Result<PreparedRun, RunError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resume<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
cwd: PathBuf,
mcp: Vec<McpServer>,
) -> Pin<Box<dyn Future<Output = Result<PreparedRun, RunError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Picks up the conversation persisted under agent_id, for
session/load. The default refuses, which is the honest answer for a
source whose sessions do not outlive the process.
Sourcefn lists_sessions(&self) -> bool
fn lists_sessions(&self) -> bool
Whether this source can enumerate the conversations it has persisted.
session/list is advertised and answered only when this is true. A
source that keeps no registry would otherwise report “no sessions” for
a workspace that has some, and a capability that answers wrongly is
worse than one that was never claimed — an unregistered method at least
says so, with -32601.
Sourcefn list_sessions<'life0, 'async_trait>(
&'life0 self,
cwd: PathBuf,
) -> Pin<Box<dyn Future<Output = Result<Vec<PersistedSession>, RunError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_sessions<'life0, 'async_trait>(
&'life0 self,
cwd: PathBuf,
) -> Pin<Box<dyn Future<Output = Result<Vec<PersistedSession>, RunError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Every conversation persisted for cwd, oldest first.
Only called when lists_sessions is true, so
the default is unreachable rather than a claim about anything.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".