Skip to main content

SessionRpcTasks

Struct SessionRpcTasks 

Source
pub struct SessionRpcTasks<'a> { /* private fields */ }
Expand description

session.tasks.* RPCs.

Implementations§

Source§

impl<'a> SessionRpcTasks<'a>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

Source§

fn clone(&self) -> SessionRpcTasks<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for SessionRpcTasks<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for SessionRpcTasks<'a>

§

impl<'a> !RefUnwindSafe for SessionRpcTasks<'a>

§

impl<'a> Send for SessionRpcTasks<'a>

§

impl<'a> Sync for SessionRpcTasks<'a>

§

impl<'a> Unpin for SessionRpcTasks<'a>

§

impl<'a> UnsafeUnpin for SessionRpcTasks<'a>

§

impl<'a> !UnwindSafe for SessionRpcTasks<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more