Class SessionHistoryApi
java.lang.Object
com.github.copilot.generated.rpc.SessionHistoryApi
API methods for the
history namespace.- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionAborts any in-progress manual compaction on a local session.Cancels any in-progress background compaction on a local session.Clears the session's conversation history, keeping only system and developer messages, and seeds the fresh context window with a first user message.compact()Compacts the session history to reduce context usage.compact(SessionHistoryCompactParams params) Compacts the session history to reduce context usage.Lists the user turns that the session can rewind to.Previews the files that a conversation-and-files rewind would restore.rewind(SessionHistoryRewindParams params) Rewinds the session conversation, optionally restoring files changed by the discarded turns.Produces a markdown summary of the session's conversation context for hand-off scenarios.truncate(SessionHistoryTruncateParams params) Truncates persisted session history to a specific event.
-
Method Details
-
compact
Compacts the session history to reduce context usage.Invokes the method with no params, applying the runtime defaults.
- Since:
- 1.0.0
-
compact
@CopilotExperimental public CompletableFuture<SessionHistoryCompactResult> compact(SessionHistoryCompactParams params) Compacts the session history to reduce context usage.Note: the
sessionIdfield in the params record is overridden by the session-scoped wrapper; any value provided is ignored.- Since:
- 1.0.0
-
truncate
@CopilotExperimental public CompletableFuture<SessionHistoryTruncateResult> truncate(SessionHistoryTruncateParams params) Truncates persisted session history to a specific event.Note: the
sessionIdfield in the params record is overridden by the session-scoped wrapper; any value provided is ignored.- Since:
- 1.0.0
-
listRewindPoints
@CopilotExperimental public CompletableFuture<SessionHistoryListRewindPointsResult> listRewindPoints()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.- Since:
- 1.0.0
-
previewRewind
@CopilotExperimental public CompletableFuture<SessionHistoryPreviewRewindResult> previewRewind(SessionHistoryPreviewRewindParams params) Previews the files that a conversation-and-files rewind would restore.Note: the
sessionIdfield in the params record is overridden by the session-scoped wrapper; any value provided is ignored.- Since:
- 1.0.0
-
rewind
@CopilotExperimental public CompletableFuture<SessionHistoryRewindResult> rewind(SessionHistoryRewindParams params) 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.Note: the
sessionIdfield in the params record is overridden by the session-scoped wrapper; any value provided is ignored.- Since:
- 1.0.0
-
cancelBackgroundCompaction
@CopilotExperimental public CompletableFuture<SessionHistoryCancelBackgroundCompactionResult> cancelBackgroundCompaction()Cancels any in-progress background compaction on a local session.- Since:
- 1.0.0
-
abortManualCompaction
@CopilotExperimental public CompletableFuture<SessionHistoryAbortManualCompactionResult> abortManualCompaction()Aborts any in-progress manual compaction on a local session.- Since:
- 1.0.0
-
summarizeForHandoff
@CopilotExperimental public CompletableFuture<SessionHistorySummarizeForHandoffResult> summarizeForHandoff()Produces a markdown summary of the session's conversation context for hand-off scenarios.- Since:
- 1.0.0
-
clearContext
@CopilotExperimental public CompletableFuture<SessionHistoryClearContextResult> clearContext(SessionHistoryClearContextParams params) Clears the session's conversation history, keeping only system and developer messages, and seeds the fresh context window with a first user message. Must be called from inside a tool handler: the clear has to drop the results of the tool calls its wipe orphans, and it rejects when no tool call is in flight.Note: the
sessionIdfield in the params record is overridden by the session-scoped wrapper; any value provided is ignored.- Since:
- 1.0.0
-