pub trait SubagentBackend: Send + Sync {
Show 29 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,
) -> 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 published_profile_config(&self, _profile: &str) -> Option<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 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 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_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) -> 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>>
Sourcefn published_profile_config(&self, _profile: &str) -> Option<ProfileConfig>
fn published_profile_config(&self, _profile: &str) -> Option<ProfileConfig>
What the daemon’s background-warmed profile catalogue already holds for
a profile. It never launches a harness and never waits, so a caller a
model is blocked on can check a selector without paying for discovery.
None means the catalogue cannot answer yet, not that the profile is
unusable.
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>>
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<()>>
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_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".