Skip to main content

SubagentBackend

Trait SubagentBackend 

Source
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§

Source

fn session_handle( &self, session_id: String, ) -> BoxFuture<'_, AnyResult<Option<SessionHandle>>>

The live actor for a session, or None when none holds it.

Source

fn prompt( &self, session_id: String, text: String, ) -> BoxFuture<'_, AnyResult<u64>>

Submit a prompt, returning its relay acceptance ordinal.

Source

fn turn_state( &self, session_id: String, ) -> BoxFuture<'_, AnyResult<Option<TurnState>>>

Durable turn state for a session with no live actor.

Source

fn turn_summary( &self, session_id: String, turn: TurnSpan, ) -> BoxFuture<'_, AnyResult<TurnSummary>>

Summarize the turn that covers these transcript positions.

Source

fn start_followup( &self, session_id: String, followup: StartFollowup, ) -> BoxFuture<'_, AnyResult<()>>

Apply model, effort, and the first prompt once a new session is ready.

Source

fn start_status( &self, session_id: String, ) -> BoxFuture<'_, AnyResult<Option<StartStatus>>>

How far a created session’s follow-up has got.

Source

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.

Source

fn diff(&self, session_id: String) -> BoxFuture<'_, Result<String, ExportError>>

A unified diff of the session’s work.

Source

fn read_file( &self, session_id: String, path: PathBuf, ) -> BoxFuture<'_, Result<Vec<u8>, ExportError>>

One file from the session’s workspace.

Source

fn push_branch( &self, session_id: String, branch: String, ) -> BoxFuture<'_, Result<PushedBranch, ExportError>>

Push the session’s branch to its repository’s default remote.

Source

fn bundle( &self, session_id: String, ) -> BoxFuture<'_, Result<BundleExport, ExportError>>

A git bundle of the session’s committed work.

Provided Methods§

Source

fn events( &self, filter: ApiEventFilter, after_seq: Option<u64>, ) -> BoxFuture<'_, AnyResult<ApiEventPage>>

Source

fn profile_config( &self, profile: String, model: Option<String>, refresh: bool, ) -> BoxFuture<'_, AnyResult<ProfileConfig>>

Source

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.

Source

fn start_subagent( &self, _request: RegisterSubagentRequest, ) -> BoxFuture<'_, AnyResult<SubagentRecord>>

Source

fn list_subagents( &self, parent_session_id: String, ) -> BoxFuture<'_, AnyResult<Vec<SubagentRecord>>>

Source

fn read_context_file( &self, session_id: String, path: PathBuf, ) -> BoxFuture<'_, Result<Vec<u8>, ExportError>>

Source

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.

Source

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.

Source

fn set_config( &self, session_id: String, key: String, value: String, ) -> BoxFuture<'_, AnyResult<()>>

Source

fn cancel_start(&self, _session_id: String) -> BoxFuture<'_, AnyResult<()>>

Source

fn usage( &self, session_id: String, after_seq: u64, limit: usize, ) -> BoxFuture<'_, AnyResult<Option<UsagePage>>>

Source

fn write_file( &self, _session_id: String, _path: PathBuf, _bytes: Vec<u8>, _overwrite: bool, ) -> BoxFuture<'_, Result<(), ExportError>>

Source

fn wiki_sync_is_stale(&self) -> bool

Whether the index was synced recently enough that a query need not ask for one.

Source

fn wiki_request_sync(&self)

Ask for a background sync. It is never waited for: a query answers from what the index holds now.

Source

fn wiki_brief( &self, _wiki_id: String, _max_chars: usize, ) -> BoxFuture<'_, AnyResult<Option<String>>>

None when the index holds no session with that id.

Source

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.

Source

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".

Implementors§