pub struct SessionRpcTasks<'a> { /* private fields */ }Expand description
session.tasks.* RPCs.
Implementations§
Source§impl<'a> SessionRpcTasks<'a>
impl<'a> SessionRpcTasks<'a>
Sourcepub async fn start_agent(
&self,
params: TasksStartAgentRequest,
) -> Result<TasksStartAgentResult, Error>
pub async fn start_agent( &self, params: TasksStartAgentRequest, ) -> Result<TasksStartAgentResult, Error>
Starts a background agent task in the session.
Wire method: session.tasks.startAgent.
§Parameters
params- Agent type, prompt, name, and optional description and model override for the new task.
§Returns
Identifier assigned to the newly started background agent task.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn list(&self) -> Result<TaskList, Error>
pub async fn list(&self) -> Result<TaskList, Error>
Lists background tasks tracked by the session.
Wire method: session.tasks.list.
§Returns
Background tasks currently tracked by the session.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn refresh(&self) -> Result<TasksRefreshResult, Error>
pub async fn refresh(&self) -> Result<TasksRefreshResult, Error>
Refreshes metadata for any detached background shells the runtime knows about.
Wire method: session.tasks.refresh.
§Returns
Refresh metadata for any detached background shells the runtime knows about. Use after a long pause to pick up exit/output state for shells running outside the agent loop.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn wait_for_pending(&self) -> Result<TasksWaitForPendingResult, Error>
pub async fn wait_for_pending(&self) -> Result<TasksWaitForPendingResult, Error>
Waits for all in-flight background tasks and any follow-up turns to settle.
Wire method: session.tasks.waitForPending.
§Returns
Wait until all in-flight background tasks (agents + shells) and any follow-up turns scheduled by their completions have settled. Returns when the runtime is fully drained or after an internal timeout (default 10 minutes; configurable via COPILOT_TASK_WAIT_TIMEOUT_SECONDS).
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn get_progress(
&self,
params: TasksGetProgressRequest,
) -> Result<TasksGetProgressResult, Error>
pub async fn get_progress( &self, params: TasksGetProgressRequest, ) -> Result<TasksGetProgressResult, Error>
Returns progress information for a background task by ID.
Wire method: session.tasks.getProgress.
§Parameters
params- Identifier of the background task to fetch progress for.
§Returns
Progress information for the task, or null when no task with that ID is tracked.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn get_current_promotable(
&self,
) -> Result<TasksGetCurrentPromotableResult, Error>
pub async fn get_current_promotable( &self, ) -> Result<TasksGetCurrentPromotableResult, Error>
Returns the first sync-waiting task that can currently be promoted to background mode.
Wire method: session.tasks.getCurrentPromotable.
§Returns
The first sync-waiting task that can currently be promoted to background mode.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn promote_to_background(
&self,
params: TasksPromoteToBackgroundRequest,
) -> Result<TasksPromoteToBackgroundResult, Error>
pub async fn promote_to_background( &self, params: TasksPromoteToBackgroundRequest, ) -> Result<TasksPromoteToBackgroundResult, Error>
Promotes an eligible synchronously-waited task so it continues running in the background.
Wire method: session.tasks.promoteToBackground.
§Parameters
params- Identifier of the task to promote to background mode.
§Returns
Indicates whether the task was successfully promoted to background mode.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn promote_current_to_background(
&self,
) -> Result<TasksPromoteCurrentToBackgroundResult, Error>
pub async fn promote_current_to_background( &self, ) -> Result<TasksPromoteCurrentToBackgroundResult, Error>
Atomically promotes the first promotable sync-waiting task to background mode and returns it.
Wire method: session.tasks.promoteCurrentToBackground.
§Returns
The promoted task as it now exists in background mode, omitted if no promotable task was waiting.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn cancel(
&self,
params: TasksCancelRequest,
) -> Result<TasksCancelResult, Error>
pub async fn cancel( &self, params: TasksCancelRequest, ) -> Result<TasksCancelResult, Error>
Cancels a background task.
Wire method: session.tasks.cancel.
§Parameters
params- Identifier of the background task to cancel.
§Returns
Indicates whether the background task was successfully cancelled.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn remove(
&self,
params: TasksRemoveRequest,
) -> Result<TasksRemoveResult, Error>
pub async fn remove( &self, params: TasksRemoveRequest, ) -> Result<TasksRemoveResult, Error>
Removes a completed or cancelled background task from tracking.
Wire method: session.tasks.remove.
§Parameters
params- Identifier of the completed or cancelled task to remove from tracking.
§Returns
Indicates whether the task was removed. False when the task does not exist or is still running/idle.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn send_message(
&self,
params: TasksSendMessageRequest,
) -> Result<TasksSendMessageResult, Error>
pub async fn send_message( &self, params: TasksSendMessageRequest, ) -> Result<TasksSendMessageResult, Error>
Sends a message to a background agent task.
Wire method: session.tasks.sendMessage.
§Parameters
params- Identifier of the target agent task, message content, and optional sender agent ID.
§Returns
Indicates whether the message was delivered, with an error message when delivery failed.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Trait Implementations§
Source§impl<'a> Clone for SessionRpcTasks<'a>
impl<'a> Clone for SessionRpcTasks<'a>
Source§fn clone(&self) -> SessionRpcTasks<'a>
fn clone(&self) -> SessionRpcTasks<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more