java.lang.Object
com.github.copilot.sdk.json.InfiniteSessionConfig
Configuration for infinite sessions with automatic context compaction and
workspace persistence.
When enabled, sessions automatically manage context window limits through background compaction and persist state to a workspace directory.
Example Usage
var infiniteConfig = new InfiniteSessionConfig().setEnabled(true).setBackgroundCompactionThreshold(0.80)
.setBufferExhaustionThreshold(0.95);
var config = new SessionConfig().setInfiniteSessions(infiniteConfig);
var session = client.createSession(config).get();
- Since:
- 1.0.2
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClears the backgroundCompactionThreshold setting, reverting to the default behavior.Clears the bufferExhaustionThreshold setting, reverting to the default behavior.Clears the enabled setting, reverting to the default behavior.Gets the background compaction threshold.Gets the buffer exhaustion threshold.Gets whether infinite sessions are enabled.setBackgroundCompactionThreshold(double backgroundCompactionThreshold) Sets the context utilization threshold at which background compaction starts.setBufferExhaustionThreshold(double bufferExhaustionThreshold) Sets the context utilization threshold at which the session blocks until compaction completes.setEnabled(boolean enabled) Sets whether infinite sessions are enabled.
-
Constructor Details
-
InfiniteSessionConfig
public InfiniteSessionConfig()
-
-
Method Details
-
getEnabled
Gets whether infinite sessions are enabled.- Returns:
- an
Optionalcontaining the boolean value, or empty to use default (true)
-
setEnabled
Sets whether infinite sessions are enabled.Default: true
- Parameters:
enabled-trueto enable infinite sessions- Returns:
- this config instance for method chaining
-
clearEnabled
Clears the enabled setting, reverting to the default behavior.- Returns:
- this instance for method chaining
-
getBackgroundCompactionThreshold
Gets the background compaction threshold.- Returns:
- an
OptionalDoublecontaining the threshold (0.0-1.0), or empty to use default
-
setBackgroundCompactionThreshold
Sets the context utilization threshold at which background compaction starts.Compaction runs asynchronously, allowing the session to continue processing. Default: 0.80
- Parameters:
backgroundCompactionThreshold- the threshold (0.0-1.0)- Returns:
- this config instance for method chaining
-
clearBackgroundCompactionThreshold
Clears the backgroundCompactionThreshold setting, reverting to the default behavior.- Returns:
- this instance for method chaining
-
getBufferExhaustionThreshold
Gets the buffer exhaustion threshold.- Returns:
- an
OptionalDoublecontaining the threshold (0.0-1.0), or empty to use default
-
setBufferExhaustionThreshold
Sets the context utilization threshold at which the session blocks until compaction completes.This prevents context overflow when compaction hasn't finished in time. Default: 0.95
- Parameters:
bufferExhaustionThreshold- the threshold (0.0-1.0)- Returns:
- this config instance for method chaining
-
clearBufferExhaustionThreshold
Clears the bufferExhaustionThreshold setting, reverting to the default behavior.- Returns:
- this instance for method chaining
-