MCPcopy Create free account
hub / github.com/AI45Lab/Code / session_cancel_token

Method session_cancel_token

core/src/agent_api.rs:652–654  ·  view source on GitHub ↗

Clone the session-level [`CancellationToken`](tokio_util::sync::CancellationToken). All in-flight runs derive their per-operation token from this one via `child_token()`, so embedders can: - Observe the token (e.g. wire it into a host-side `select!`) to react to session shutdown without polling [`is_closed`](Self::is_closed); - Call `.cancel()` on it to abort every operation in the session witho

(&self)

Source from the content-addressed store, hash-verified

650 /// For graceful shutdown prefer [`close`](Self::close), which also marks
651 /// runs as cancelled in the store and fires AHP hooks.
652 pub fn session_cancel_token(&self) -> tokio_util::sync::CancellationToken {
653 self.session_cancel.clone()
654 }
655
656 /// Return the host-defined tenant id, if any.
657 ///

Calls 1

cloneMethod · 0.45