pub trait SubagentBackend: Send + Sync {
Show 20 methods
// Required methods
fn session_handle(
&self,
session_id: String,
) -> BoxFuture<'_, AnyResult<Option<SessionHandle>>>;
fn prompt(
&self,
session_id: String,
text: String,
) -> BoxFuture<'_, AnyResult<u64>>;
fn turn_state(
&self,
session_id: String,
) -> BoxFuture<'_, AnyResult<Option<TurnState>>>;
fn turn_summary(
&self,
session_id: String,
turn_start_position: u64,
) -> BoxFuture<'_, AnyResult<TurnSummary>>;
fn start_followup(
&self,
session_id: String,
followup: StartFollowup,
) -> BoxFuture<'_, AnyResult<()>>;
fn start_status(
&self,
session_id: String,
) -> BoxFuture<'_, AnyResult<Option<StartStatus>>>;
fn transcript(
&self,
session_id: String,
after_seq: u64,
limit: usize,
role: Option<TranscriptRole>,
) -> BoxFuture<'_, AnyResult<Option<TranscriptPage>>>;
fn diff(
&self,
session_id: String,
) -> BoxFuture<'_, Result<String, ExportError>>;
fn read_file(
&self,
session_id: String,
path: PathBuf,
) -> BoxFuture<'_, Result<Vec<u8>, ExportError>>;
fn push_branch(
&self,
session_id: String,
branch: String,
) -> BoxFuture<'_, Result<PushedBranch, ExportError>>;
fn bundle(
&self,
session_id: String,
) -> BoxFuture<'_, Result<BundleExport, ExportError>>;
// Provided methods
fn events(
&self,
filter: ApiEventFilter,
after_seq: Option<u64>,
) -> BoxFuture<'_, AnyResult<ApiEventPage>> { ... }
fn profile_config(
&self,
profile: String,
model: Option<String>,
refresh: bool,
) -> BoxFuture<'_, AnyResult<ProfileConfig>> { ... }
fn start_subagent(
&self,
_request: RegisterSubagentRequest,
) -> BoxFuture<'_, AnyResult<SubagentRecord>> { ... }
fn list_subagents(
&self,
parent_session_id: String,
) -> BoxFuture<'_, AnyResult<Vec<SubagentRecord>>> { ... }
fn read_context_file(
&self,
session_id: String,
path: PathBuf,
) -> BoxFuture<'_, Result<Vec<u8>, ExportError>> { ... }
fn set_config(
&self,
session_id: String,
key: String,
value: String,
) -> BoxFuture<'_, AnyResult<()>> { ... }
fn cancel_start(&self, _session_id: String) -> BoxFuture<'_, AnyResult<()>> { ... }
fn usage(
&self,
session_id: String,
after_seq: u64,
limit: usize,
) -> BoxFuture<'_, AnyResult<Option<UsagePage>>> { ... }
fn write_file(
&self,
_session_id: String,
_path: PathBuf,
_bytes: Vec<u8>,
_overwrite: bool,
) -> BoxFuture<'_, Result<(), ExportError>> { ... }
}Expand description
Everything the API needs from the daemon: live session actors, the durable projection, and the target-side git operations.
mj-controller cannot depend on the daemon’s runtime state, which lives in
mj-cli, so the daemon implements this trait and installs it on the server
options. The whole trait is declared now, including the methods later
milestones fill in, so that adding those milestones does not change the
shape every implementation has to match.
Required Methods§
Sourcefn session_handle(
&self,
session_id: String,
) -> BoxFuture<'_, AnyResult<Option<SessionHandle>>>
fn session_handle( &self, session_id: String, ) -> BoxFuture<'_, AnyResult<Option<SessionHandle>>>
The live actor for a session, or None when none holds it.
Sourcefn prompt(
&self,
session_id: String,
text: String,
) -> BoxFuture<'_, AnyResult<u64>>
fn prompt( &self, session_id: String, text: String, ) -> BoxFuture<'_, AnyResult<u64>>
Submit a prompt, returning its relay acceptance ordinal.
Sourcefn turn_state(
&self,
session_id: String,
) -> BoxFuture<'_, AnyResult<Option<TurnState>>>
fn turn_state( &self, session_id: String, ) -> BoxFuture<'_, AnyResult<Option<TurnState>>>
Durable turn state for a session with no live actor.
Sourcefn turn_summary(
&self,
session_id: String,
turn_start_position: u64,
) -> BoxFuture<'_, AnyResult<TurnSummary>>
fn turn_summary( &self, session_id: String, turn_start_position: u64, ) -> BoxFuture<'_, AnyResult<TurnSummary>>
Summarize the turn that started at this transcript position.
Sourcefn start_followup(
&self,
session_id: String,
followup: StartFollowup,
) -> BoxFuture<'_, AnyResult<()>>
fn start_followup( &self, session_id: String, followup: StartFollowup, ) -> BoxFuture<'_, AnyResult<()>>
Apply model, effort, and the first prompt once a new session is ready.
Sourcefn start_status(
&self,
session_id: String,
) -> BoxFuture<'_, AnyResult<Option<StartStatus>>>
fn start_status( &self, session_id: String, ) -> BoxFuture<'_, AnyResult<Option<StartStatus>>>
How far a created session’s follow-up has got.
Sourcefn transcript(
&self,
session_id: String,
after_seq: u64,
limit: usize,
role: Option<TranscriptRole>,
) -> BoxFuture<'_, AnyResult<Option<TranscriptPage>>>
fn transcript( &self, session_id: String, after_seq: u64, limit: usize, role: Option<TranscriptRole>, ) -> BoxFuture<'_, AnyResult<Option<TranscriptPage>>>
A page of transcript items after after_seq.
Sourcefn diff(&self, session_id: String) -> BoxFuture<'_, Result<String, ExportError>>
fn diff(&self, session_id: String) -> BoxFuture<'_, Result<String, ExportError>>
A unified diff of the session’s work.
Sourcefn read_file(
&self,
session_id: String,
path: PathBuf,
) -> BoxFuture<'_, Result<Vec<u8>, ExportError>>
fn read_file( &self, session_id: String, path: PathBuf, ) -> BoxFuture<'_, Result<Vec<u8>, ExportError>>
One file from the session’s workspace.
Sourcefn push_branch(
&self,
session_id: String,
branch: String,
) -> BoxFuture<'_, Result<PushedBranch, ExportError>>
fn push_branch( &self, session_id: String, branch: String, ) -> BoxFuture<'_, Result<PushedBranch, ExportError>>
Push the session’s branch to its repository’s default remote.
Sourcefn bundle(
&self,
session_id: String,
) -> BoxFuture<'_, Result<BundleExport, ExportError>>
fn bundle( &self, session_id: String, ) -> BoxFuture<'_, Result<BundleExport, ExportError>>
A git bundle of the session’s committed work.
Provided Methods§
fn events( &self, filter: ApiEventFilter, after_seq: Option<u64>, ) -> BoxFuture<'_, AnyResult<ApiEventPage>>
fn profile_config( &self, profile: String, model: Option<String>, refresh: bool, ) -> BoxFuture<'_, AnyResult<ProfileConfig>>
fn start_subagent( &self, _request: RegisterSubagentRequest, ) -> BoxFuture<'_, AnyResult<SubagentRecord>>
fn list_subagents( &self, parent_session_id: String, ) -> BoxFuture<'_, AnyResult<Vec<SubagentRecord>>>
fn read_context_file( &self, session_id: String, path: PathBuf, ) -> BoxFuture<'_, Result<Vec<u8>, ExportError>>
fn set_config( &self, session_id: String, key: String, value: String, ) -> BoxFuture<'_, AnyResult<()>>
fn cancel_start(&self, _session_id: String) -> BoxFuture<'_, AnyResult<()>>
fn usage( &self, session_id: String, after_seq: u64, limit: usize, ) -> BoxFuture<'_, AnyResult<Option<UsagePage>>>
fn write_file( &self, _session_id: String, _path: PathBuf, _bytes: Vec<u8>, _overwrite: bool, ) -> BoxFuture<'_, Result<(), ExportError>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".