pub struct SessionRpcHistory<'a> { /* private fields */ }Expand description
session.history.* RPCs.
Implementations§
Source§impl<'a> SessionRpcHistory<'a>
impl<'a> SessionRpcHistory<'a>
Sourcepub async fn compact(&self) -> Result<HistoryCompactResult, Error>
pub async fn compact(&self) -> Result<HistoryCompactResult, Error>
Compacts the session history to reduce context usage.
Wire method: session.history.compact.
§Returns
Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown.
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 compact_with_params(
&self,
params: HistoryCompactRequest,
) -> Result<HistoryCompactResult, Error>
pub async fn compact_with_params( &self, params: HistoryCompactRequest, ) -> Result<HistoryCompactResult, Error>
Compacts the session history to reduce context usage.
Wire method: session.history.compact.
§Parameters
params- Optional compaction parameters.
§Returns
Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown.
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 truncate(
&self,
params: HistoryTruncateRequest,
) -> Result<HistoryTruncateResult, Error>
pub async fn truncate( &self, params: HistoryTruncateRequest, ) -> Result<HistoryTruncateResult, Error>
Truncates persisted session history to a specific event.
Wire method: session.history.truncate.
§Parameters
params- Identifier of the event to truncate to; this event and all later events are removed.
§Returns
Number of events that were removed by the truncation.
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_rewind_points(
&self,
) -> Result<HistoryListRewindPointsResult, Error>
pub async fn list_rewind_points( &self, ) -> Result<HistoryListRewindPointsResult, Error>
Lists the user turns that the session can rewind to. Never rejects for a busy session: rewind reads need the session’s file-change captures to be settled, so a session that still holds active work answers with unavailableReason: "session-busy" and no points, which the caller can retry.
Wire method: session.history.listRewindPoints.
§Returns
Rewind points and file-change-tracking availability for 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 preview_rewind(
&self,
params: HistoryPreviewRewindRequest,
) -> Result<HistoryPreviewRewindResult, Error>
pub async fn preview_rewind( &self, params: HistoryPreviewRewindRequest, ) -> Result<HistoryPreviewRewindResult, Error>
Previews the files that a conversation-and-files rewind would restore.
Wire method: session.history.previewRewind.
§Parameters
params- Event boundary to preview for conversation-and-files rewind.
§Returns
Files and aggregate changes for a prospective rewind.
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 rewind(
&self,
params: HistoryRewindRequest,
) -> Result<HistoryRewindResult, Error>
pub async fn rewind( &self, params: HistoryRewindRequest, ) -> Result<HistoryRewindResult, Error>
Rewinds the session conversation, optionally restoring files changed by the discarded turns. Not crash-atomic: file restore and conversation truncation are separate stores, applied in that order, so a process crash between them can leave the workspace rewound while the conversation still contains the discarded turns. There is no recovery journal; re-running the same rewind is the recovery path for a crash before truncation lands, since file restore is idempotent (already-restored files are reported as skipped) and truncation is re-derived from the still-retained boundary event. After truncation lands that boundary no longer exists, so the same request is rejected; the only stage that can still be outstanding is snapshot pruning, whose failure leaves orphan snapshots the capture store tolerates. The reverse inconsistency cannot occur, because truncation is never applied before file restore succeeds.
Wire method: session.history.rewind.
§Parameters
params- Boundary and mode for rewinding session history.
§Returns
Structured outcome of a rewind request.
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_background_compaction(
&self,
) -> Result<HistoryCancelBackgroundCompactionResult, Error>
pub async fn cancel_background_compaction( &self, ) -> Result<HistoryCancelBackgroundCompactionResult, Error>
Cancels any in-progress background compaction on a local session.
Wire method: session.history.cancelBackgroundCompaction.
§Returns
Indicates whether an in-progress background compaction was 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 abort_manual_compaction(
&self,
) -> Result<HistoryAbortManualCompactionResult, Error>
pub async fn abort_manual_compaction( &self, ) -> Result<HistoryAbortManualCompactionResult, Error>
Aborts any in-progress manual compaction on a local session.
Wire method: session.history.abortManualCompaction.
§Returns
Indicates whether an in-progress manual compaction was aborted.
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 summarize_for_handoff(
&self,
) -> Result<HistorySummarizeForHandoffResult, Error>
pub async fn summarize_for_handoff( &self, ) -> Result<HistorySummarizeForHandoffResult, Error>
Produces a markdown summary of the session’s conversation context for hand-off scenarios.
Wire method: session.history.summarizeForHandoff.
§Returns
Markdown summary of the conversation context (empty when not available).
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 SessionRpcHistory<'a>
impl<'a> Clone for SessionRpcHistory<'a>
Source§fn clone(&self) -> SessionRpcHistory<'a>
fn clone(&self) -> SessionRpcHistory<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more