pub trait SubagentBackend: Send + Sync {
Show 34 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: TurnSpan,
) -> 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,
options: DiffOptions,
) -> 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 transcript_history(
&self,
session_id: String,
before: Option<TranscriptCursor>,
) -> BoxFuture<'_, AnyResult<TranscriptHistoryPage>> { ... }
fn native_agent_history(
&self,
owner: String,
child: String,
before: Option<(u64, String)>,
) -> BoxFuture<'_, AnyResult<NativeAgentHistoryPage>> { ... }
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 subagent_candidates(
&self,
_parent_profile: String,
) -> BoxFuture<'_, AnyResult<SubagentCandidates>> { ... }
fn start_subagent(
&self,
_request: RegisterSubagentRequest,
) -> BoxFuture<'_, AnyResult<SubagentRecord>> { ... }
fn list_subagents(
&self,
parent_session_id: String,
) -> BoxFuture<'_, AnyResult<Vec<SubagentRecord>>> { ... }
fn subagent_handed_back(
&self,
child_session_id: String,
) -> BoxFuture<'_, AnyResult<bool>> { ... }
fn read_context_file(
&self,
session_id: String,
path: PathBuf,
) -> BoxFuture<'_, Result<Vec<u8>, ExportError>> { ... }
fn list_workspaces(&self) -> BoxFuture<'_, AnyResult<Vec<WorkspaceRecord>>> { ... }
fn create_workspace(
&self,
name: String,
) -> BoxFuture<'_, AnyResult<WorkspaceRecord>> { ... }
fn set_config(
&self,
session_id: String,
key: String,
value: String,
) -> BoxFuture<'_, AnyResult<()>> { ... }
fn cancel_start(&self, _session_id: String) -> BoxFuture<'_, AnyResult<()>> { ... }
fn subagent_report(
&self,
_session_id: String,
) -> BoxFuture<'_, AnyResult<Option<(bool, SubagentReport)>>> { ... }
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>> { ... }
fn wiki_sync_is_stale(&self) -> bool { ... }
fn wiki_request_sync(&self) { ... }
fn wiki_search(
&self,
_query: String,
_limit: usize,
) -> BoxFuture<'_, AnyResult<WikiSearchPage>> { ... }
fn wiki_brief(
&self,
_wiki_id: String,
_max_chars: usize,
) -> BoxFuture<'_, AnyResult<Option<String>>> { ... }
fn wiki_hits(
&self,
_wiki_id: String,
_query: String,
_context_messages: usize,
_per_message_chars: usize,
) -> BoxFuture<'_, AnyResult<Option<WikiHitTranscript>>> { ... }
fn wiki_session(
&self,
_wiki_id: String,
) -> BoxFuture<'_, AnyResult<Option<WikiSessionInfo>>> { ... }
fn wiki_restore(
&self,
_request: WikiRestoreRequest,
) -> BoxFuture<'_, AnyResult<Option<String>>> { ... }
}Expand description
Everything the API needs from the daemon: live session actors, the durable projection, and the target-side git operations.
The daemon’s implementation lives in server_runtime::api; route tests
supply a fake.
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: TurnSpan,
) -> BoxFuture<'_, AnyResult<TurnSummary>>
fn turn_summary( &self, session_id: String, turn: TurnSpan, ) -> BoxFuture<'_, AnyResult<TurnSummary>>
Summarize the turn that covers these transcript positions.
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,
options: DiffOptions,
) -> BoxFuture<'_, Result<String, ExportError>>
fn diff( &self, session_id: String, options: DiffOptions, ) -> 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 transcript_history( &self, session_id: String, before: Option<TranscriptCursor>, ) -> BoxFuture<'_, AnyResult<TranscriptHistoryPage>>
fn native_agent_history( &self, owner: String, child: String, before: Option<(u64, String)>, ) -> BoxFuture<'_, AnyResult<NativeAgentHistoryPage>>
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>>
Sourcefn subagent_candidates(
&self,
_parent_profile: String,
) -> BoxFuture<'_, AnyResult<SubagentCandidates>>
fn subagent_candidates( &self, _parent_profile: String, ) -> BoxFuture<'_, AnyResult<SubagentCandidates>>
The profiles a parent running on parent_profile may start a sub-agent
on, each with its discovered choices and remaining quota. It waits for
a discovery the daemon has not finished; a profile whose discovery
fails is reported as unavailable rather than failing the whole answer.
fn start_subagent( &self, _request: RegisterSubagentRequest, ) -> BoxFuture<'_, AnyResult<SubagentRecord>>
fn list_subagents( &self, parent_session_id: String, ) -> BoxFuture<'_, AnyResult<Vec<SubagentRecord>>>
Sourcefn subagent_handed_back(
&self,
child_session_id: String,
) -> BoxFuture<'_, AnyResult<bool>>
fn subagent_handed_back( &self, child_session_id: String, ) -> BoxFuture<'_, AnyResult<bool>>
Whether a sub-agent child has handed back its report for its parent’s
newest task; see crate::controller::subagent_has_handed_back.
fn read_context_file( &self, session_id: String, path: PathBuf, ) -> BoxFuture<'_, Result<Vec<u8>, ExportError>>
Sourcefn list_workspaces(&self) -> BoxFuture<'_, AnyResult<Vec<WorkspaceRecord>>>
fn list_workspaces(&self) -> BoxFuture<'_, AnyResult<Vec<WorkspaceRecord>>>
The workspaces the store holds, in the order the terminal’s tabs and the viewer’s list show them.
Sourcefn create_workspace(
&self,
name: String,
) -> BoxFuture<'_, AnyResult<WorkspaceRecord>>
fn create_workspace( &self, name: String, ) -> BoxFuture<'_, AnyResult<WorkspaceRecord>>
The workspace with this name, creating it when the store holds none.
This is the daemon’s own CreateWorkspace operation: create-or-get, so
two callers that both saw an empty list attach to the same normalized
name instead of one of them meeting a SQLite conflict. The daemon
overrides it to republish the list afterwards.
fn set_config( &self, session_id: String, key: String, value: String, ) -> BoxFuture<'_, AnyResult<()>>
fn cancel_start(&self, _session_id: String) -> BoxFuture<'_, AnyResult<()>>
Sourcefn subagent_report(
&self,
_session_id: String,
) -> BoxFuture<'_, AnyResult<Option<(bool, SubagentReport)>>>
fn subagent_report( &self, _session_id: String, ) -> BoxFuture<'_, AnyResult<Option<(bool, SubagentReport)>>>
A sub-agent child’s recorded report, and whether it has the handback
tool. None for a session that is not a Mjolnir sub-agent.
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>>
Sourcefn wiki_sync_is_stale(&self) -> bool
fn wiki_sync_is_stale(&self) -> bool
Whether the index was synced recently enough that a query need not ask for one.
Sourcefn wiki_request_sync(&self)
fn wiki_request_sync(&self)
Ask for a background sync. It is never waited for: a query answers from what the index holds now.
fn wiki_search( &self, _query: String, _limit: usize, ) -> BoxFuture<'_, AnyResult<WikiSearchPage>>
Sourcefn wiki_brief(
&self,
_wiki_id: String,
_max_chars: usize,
) -> BoxFuture<'_, AnyResult<Option<String>>>
fn wiki_brief( &self, _wiki_id: String, _max_chars: usize, ) -> BoxFuture<'_, AnyResult<Option<String>>>
None when the index holds no session with that id.
Sourcefn wiki_hits(
&self,
_wiki_id: String,
_query: String,
_context_messages: usize,
_per_message_chars: usize,
) -> BoxFuture<'_, AnyResult<Option<WikiHitTranscript>>>
fn wiki_hits( &self, _wiki_id: String, _query: String, _context_messages: usize, _per_message_chars: usize, ) -> BoxFuture<'_, AnyResult<Option<WikiHitTranscript>>>
The passages of one indexed session that match a query. None when the
index holds no session with that id.
Sourcefn wiki_session(
&self,
_wiki_id: String,
) -> BoxFuture<'_, AnyResult<Option<WikiSessionInfo>>>
fn wiki_session( &self, _wiki_id: String, ) -> BoxFuture<'_, AnyResult<Option<WikiSessionInfo>>>
What one indexed session is, and what continuing it would mean.
None when the index holds no session with that id.
Sourcefn wiki_restore(
&self,
_request: WikiRestoreRequest,
) -> BoxFuture<'_, AnyResult<Option<String>>>
fn wiki_restore( &self, _request: WikiRestoreRequest, ) -> BoxFuture<'_, AnyResult<Option<String>>>
Start a session from an archived transcript, answering with its id, or
None when the index holds no session with that id.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".