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();
 
See Also:
  • Constructor Details

    • InfiniteSessionConfig

      public InfiniteSessionConfig()
  • Method Details

    • getEnabled

      public Boolean getEnabled()
      Gets whether infinite sessions are enabled.
      Returns:
      true if enabled, null 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
    • getBackgroundCompactionThreshold

      public Double getBackgroundCompactionThreshold()
      Gets the background compaction threshold.
      Returns:
      the threshold (0.0-1.0), or null 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
    • getBufferExhaustionThreshold

      public Double getBufferExhaustionThreshold()
      Gets the buffer exhaustion threshold.
      Returns:
      the threshold (0.0-1.0), or null 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