pub struct CodingAgentService { /* private fields */ }Expand description
One mode-neutral application service over the canonical runtime/session model.
Implementations§
Source§impl CodingAgentService
impl CodingAgentService
Sourcepub const fn workspace(&self) -> &WorkspaceRoot
pub const fn workspace(&self) -> &WorkspaceRoot
Returns the validated workspace capability.
Sourcepub const fn workspace_id(&self) -> &WorkspaceId
pub const fn workspace_id(&self) -> &WorkspaceId
Returns the safe canonical workspace identity.
Sourcepub const fn resources(&self) -> &ResourceCatalog
pub const fn resources(&self) -> &ResourceCatalog
Returns the immutable resource catalog.
Sourcepub const fn settings(&self) -> &CodingSettings
pub const fn settings(&self) -> &CodingSettings
Returns the resolved secret-free product settings snapshot.
Sourcepub fn model_capabilities(
&self,
model_ref: &ModelRef,
) -> Option<ModelCapabilities>
pub fn model_capabilities( &self, model_ref: &ModelRef, ) -> Option<ModelCapabilities>
Returns capabilities for one model in the frozen provider catalog.
Sourcepub fn model_spec(&self, model_ref: &ModelRef) -> Option<&ModelSpec>
pub fn model_spec(&self, model_ref: &ModelRef) -> Option<&ModelSpec>
Returns one advertised model contract from the frozen catalog.
Sourcepub fn mcp_snapshot(&self) -> Result<McpServiceSnapshot, McpError>
pub fn mcp_snapshot(&self) -> Result<McpServiceSnapshot, McpError>
Returns a safe immutable MCP lifecycle and catalog projection.
The projection excludes server-provided descriptions, annotations, process details, environment values, stderr, and result bodies.
Sourcepub async fn reconnect_mcp(
&self,
server_id: &McpServerId,
) -> Result<McpServerHealth, McpError>
pub async fn reconnect_mcp( &self, server_id: &McpServerId, ) -> Result<McpServerHealth, McpError>
Reconnects one configured MCP server only when its new discovery snapshot exactly matches the frozen runtime catalog.
A descriptor or stale-catalog error requires rebuilding this service; reconnect never mutates its live tool registry or profile binding.
Sourcepub fn subscribe(
&self,
session_id: SessionId,
) -> Result<Receiver<EventEnvelope>, CodingError>
pub fn subscribe( &self, session_id: SessionId, ) -> Result<Receiver<EventEnvelope>, CodingError>
Subscribes before prompt submission to avoid missing early events.
§Errors
Returns an error when the bounded subscriber registry is full.
Sourcepub async fn create_session(&self) -> Result<SessionId, CodingError>
pub async fn create_session(&self) -> Result<SessionId, CodingError>
Sourcepub async fn open_session(
&self,
session_id: SessionId,
) -> Result<RuntimeSessionState, CodingError>
pub async fn open_session( &self, session_id: SessionId, ) -> Result<RuntimeSessionState, CodingError>
Attaches an existing durable session.
Sourcepub async fn list_sessions(
&self,
) -> Result<Vec<SessionCatalogEntry>, CodingError>
pub async fn list_sessions( &self, ) -> Result<Vec<SessionCatalogEntry>, CodingError>
Lists durable sessions.
Sourcepub async fn name_session(
&self,
session_id: SessionId,
name: Option<SessionName>,
) -> Result<(), CodingError>
pub async fn name_session( &self, session_id: SessionId, name: Option<SessionName>, ) -> Result<(), CodingError>
Sets a durable display name.
Sourcepub async fn snapshot(
&self,
session_id: SessionId,
) -> Result<RuntimeSessionState, CodingError>
pub async fn snapshot( &self, session_id: SessionId, ) -> Result<RuntimeSessionState, CodingError>
Returns a compact mode-neutral state projection.
Sourcepub async fn session_snapshot(
&self,
session_id: SessionId,
) -> Result<SessionSnapshot, CodingError>
pub async fn session_snapshot( &self, session_id: SessionId, ) -> Result<SessionSnapshot, CodingError>
Returns the complete immutable canonical session snapshot.
Hosts use this after startup, reconnect, or an observed sequence gap to rebuild projections instead of treating transient deltas as durable.
Sourcepub async fn stats(
&self,
session_id: SessionId,
) -> Result<SessionStats, CodingError>
pub async fn stats( &self, session_id: SessionId, ) -> Result<SessionStats, CodingError>
Returns rebuildable session statistics.
Sourcepub fn prompt(
&self,
session_id: SessionId,
text: impl Into<String>,
) -> Result<CommandAcceptance, CodingError>
pub fn prompt( &self, session_id: SessionId, text: impl Into<String>, ) -> Result<CommandAcceptance, CodingError>
Accepts a prompt into one owned task; completion is observed separately.
§Errors
Rejects duplicate/overflowing owned runs and invalid prompt text.
Sourcepub fn prompt_content(
&self,
session_id: SessionId,
content: Vec<ContentBlock>,
) -> Result<CommandAcceptance, CodingError>
pub fn prompt_content( &self, session_id: SessionId, content: Vec<ContentBlock>, ) -> Result<CommandAcceptance, CodingError>
Accepts typed user content into one owned task.
§Errors
Rejects duplicate/overflowing owned runs and content that cannot form a canonical user message.
Sourcepub async fn wait(
&self,
session_id: SessionId,
) -> Result<RuntimeCommandOutcome, CodingError>
pub async fn wait( &self, session_id: SessionId, ) -> Result<RuntimeCommandOutcome, CodingError>
Awaits and removes one owned run.
Sourcepub async fn steer(
&self,
session_id: SessionId,
text: impl Into<String>,
) -> Result<RuntimeCommandOutcome, CodingError>
pub async fn steer( &self, session_id: SessionId, text: impl Into<String>, ) -> Result<RuntimeCommandOutcome, CodingError>
Sends steering text to an active run.
Sourcepub async fn follow_up(
&self,
session_id: SessionId,
text: impl Into<String>,
) -> Result<RuntimeCommandOutcome, CodingError>
pub async fn follow_up( &self, session_id: SessionId, text: impl Into<String>, ) -> Result<RuntimeCommandOutcome, CodingError>
Queues a follow-up user message.
Sourcepub async fn abort(
&self,
session_id: SessionId,
) -> Result<RuntimeCommandOutcome, CodingError>
pub async fn abort( &self, session_id: SessionId, ) -> Result<RuntimeCommandOutcome, CodingError>
Cancels an active run.
Sourcepub fn approve(
&self,
session_id: SessionId,
approval_id: ApprovalId,
decision: ApprovalDecision,
) -> Result<CommandAcceptance, CodingError>
pub fn approve( &self, session_id: SessionId, approval_id: ApprovalId, decision: ApprovalDecision, ) -> Result<CommandAcceptance, CodingError>
Accepts approval resolution into an owned continuation task.
Sourcepub async fn set_model(
&self,
session_id: SessionId,
model: ModelRef,
) -> Result<RuntimeCommandOutcome, CodingError>
pub async fn set_model( &self, session_id: SessionId, model: ModelRef, ) -> Result<RuntimeCommandOutcome, CodingError>
Selects a model for future turns.
Sourcepub async fn set_reasoning_effort(
&self,
session_id: SessionId,
reasoning_effort: ReasoningEffort,
) -> Result<RuntimeCommandOutcome, CodingError>
pub async fn set_reasoning_effort( &self, session_id: SessionId, reasoning_effort: ReasoningEffort, ) -> Result<RuntimeCommandOutcome, CodingError>
Selects provider-neutral reasoning effort for future turns.
Sourcepub async fn set_profile(
&self,
session_id: SessionId,
profile_id: ProfileId,
) -> Result<RuntimeCommandOutcome, CodingError>
pub async fn set_profile( &self, session_id: SessionId, profile_id: ProfileId, ) -> Result<RuntimeCommandOutcome, CodingError>
Selects a registered product profile for future turns.
Sourcepub async fn set_active_tools(
&self,
session_id: SessionId,
names: Vec<ToolName>,
) -> Result<(), CodingError>
pub async fn set_active_tools( &self, session_id: SessionId, names: Vec<ToolName>, ) -> Result<(), CodingError>
Replaces the active tool set for future runs in this session.
Sourcepub async fn compact(
&self,
session_id: SessionId,
) -> Result<RuntimeCommandOutcome, CodingError>
pub async fn compact( &self, session_id: SessionId, ) -> Result<RuntimeCommandOutcome, CodingError>
Requests manual compaction.
Sourcepub async fn fork(
&self,
session_id: SessionId,
from_message_id: MessageId,
branch_id: BranchId,
) -> Result<RuntimeCommandOutcome, CodingError>
pub async fn fork( &self, session_id: SessionId, from_message_id: MessageId, branch_id: BranchId, ) -> Result<RuntimeCommandOutcome, CodingError>
Forks and activates a branch from one message.