pub struct SessionRpcMetadata<'a> { /* private fields */ }Expand description
session.metadata.* RPCs.
Implementations§
Source§impl<'a> SessionRpcMetadata<'a>
impl<'a> SessionRpcMetadata<'a>
Sourcepub async fn snapshot(&self) -> Result<SessionMetadataSnapshot, Error>
pub async fn snapshot(&self) -> Result<SessionMetadataSnapshot, Error>
Returns a snapshot of the session’s identifying metadata, mode, agent, and remote info.
Wire method: session.metadata.snapshot.
§Returns
Point-in-time snapshot of slow-changing session identifier and state fields
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 is_processing(&self) -> Result<MetadataIsProcessingResult, Error>
pub async fn is_processing(&self) -> Result<MetadataIsProcessingResult, Error>
Reports whether the local session is currently processing user/agent messages.
Wire method: session.metadata.isProcessing.
§Returns
Indicates whether the local session is currently processing a turn or background continuation.
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 context_info(
&self,
params: MetadataContextInfoRequest,
) -> Result<MetadataContextInfoResult, Error>
pub async fn context_info( &self, params: MetadataContextInfoRequest, ) -> Result<MetadataContextInfoResult, Error>
Returns the token breakdown for the session’s current context window for a given model.
Wire method: session.metadata.contextInfo.
§Parameters
params- Model identifier and token limits used to compute the context-info breakdown.
§Returns
Token breakdown for the session’s current context window, or null if uninitialized.
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 record_context_change(
&self,
params: MetadataRecordContextChangeRequest,
) -> Result<MetadataRecordContextChangeResult, Error>
pub async fn record_context_change( &self, params: MetadataRecordContextChangeRequest, ) -> Result<MetadataRecordContextChangeResult, Error>
Records a working-directory/git context change and emits a session.context_changed event.
Wire method: session.metadata.recordContextChange.
§Parameters
params- Updated working-directory/git context to record on the session.
§Returns
Notify the session that its working directory context has changed. Emits a session.context_changed event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session’s normal lifecycle (e.g., after a shell command in interactive 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 set_working_directory(
&self,
params: MetadataSetWorkingDirectoryRequest,
) -> Result<MetadataSetWorkingDirectoryResult, Error>
pub async fn set_working_directory( &self, params: MetadataSetWorkingDirectoryRequest, ) -> Result<MetadataSetWorkingDirectoryResult, Error>
Updates the session’s recorded working directory.
Wire method: session.metadata.setWorkingDirectory.
§Parameters
params- Absolute path to set as the session’s new working directory.
§Returns
Update the session’s working directory. Used by the host when the user explicitly changes cwd (e.g., the /cd slash command). The host is responsible for process.chdir and any related side-effects (file index, etc.); this method only updates the session’s own recorded path.
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 recompute_context_tokens(
&self,
params: MetadataRecomputeContextTokensRequest,
) -> Result<MetadataRecomputeContextTokensResult, Error>
pub async fn recompute_context_tokens( &self, params: MetadataRecomputeContextTokensRequest, ) -> Result<MetadataRecomputeContextTokensResult, Error>
Re-tokenizes the session’s existing messages against a model and returns aggregate token totals.
Wire method: session.metadata.recomputeContextTokens.
§Parameters
params- Model identifier to use when re-tokenizing the session’s existing messages.
§Returns
Re-tokenize the session’s existing messages against modelId and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires session.context_info_changed events. Returns zeros for an empty 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.
Trait Implementations§
Source§impl<'a> Clone for SessionRpcMetadata<'a>
impl<'a> Clone for SessionRpcMetadata<'a>
Source§fn clone(&self) -> SessionRpcMetadata<'a>
fn clone(&self) -> SessionRpcMetadata<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more