Class InfiniteSessionConfig

java.lang.Object
com.github.copilot.sdk.json.InfiniteSessionConfig

public class InfiniteSessionConfig extends Object
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 Details

    • InfiniteSessionConfig

      public InfiniteSessionConfig()
  • Method Details

    • getEnabled

      public Optional<Boolean> getEnabled()
      Gets whether infinite sessions are enabled.
      Returns:
      an Optional containing the boolean value, or empty to use default (true)
    • setEnabled

      public InfiniteSessionConfig setEnabled(boolean enabled)
      Sets whether infinite sessions are enabled.

      Default: true

      Parameters:
      enabled - true to enable infinite sessions
      Returns:
      this config instance for method chaining
    • clearEnabled

      public InfiniteSessionConfig clearEnabled()
      Clears the enabled setting, reverting to the default behavior.
      Returns:
      this instance for method chaining
    • getBackgroundCompactionThreshold

      public OptionalDouble getBackgroundCompactionThreshold()
      Gets the background compaction threshold.
      Returns:
      an OptionalDouble containing the threshold (0.0-1.0), or empty to use default
    • setBackgroundCompactionThreshold

      public InfiniteSessionConfig setBackgroundCompactionThreshold(double backgroundCompactionThreshold)
      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

      public InfiniteSessionConfig clearBackgroundCompactionThreshold()
      Clears the backgroundCompactionThreshold setting, reverting to the default behavior.
      Returns:
      this instance for method chaining
    • getBufferExhaustionThreshold

      public OptionalDouble getBufferExhaustionThreshold()
      Gets the buffer exhaustion threshold.
      Returns:
      an OptionalDouble containing the threshold (0.0-1.0), or empty to use default
    • setBufferExhaustionThreshold

      public InfiniteSessionConfig setBufferExhaustionThreshold(double bufferExhaustionThreshold)
      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

      public InfiniteSessionConfig clearBufferExhaustionThreshold()
      Clears the bufferExhaustionThreshold setting, reverting to the default behavior.
      Returns:
      this instance for method chaining