1414import java .util .function .Supplier ;
1515
1616import com .fasterxml .jackson .annotation .JsonInclude ;
17- import com .fasterxml .jackson .annotation .JsonIgnore ;
18- import java .util .Optional ;
19- import java .util .OptionalInt ;
2017
2118/**
2219 * Configuration options for creating a
@@ -502,47 +499,34 @@ public CopilotClientOptions setTelemetry(TelemetryConfig telemetry) {
502499 /**
503500 * Gets the server-wide idle timeout for sessions in seconds.
504501 *
505- * @return an {@link OptionalInt} containing the session idle timeout in
506- * seconds, or {@link java.util.OptionalInt#empty()} if not set. Use
507- * {@link #clearSessionIdleTimeoutSeconds()} to revert to the default.
502+ * @return the session idle timeout in seconds, or {@code null} to disable
503+ * (sessions live indefinitely)
508504 * @since 1.3.0
509505 */
510- @ JsonIgnore
511- public OptionalInt getSessionIdleTimeoutSeconds () {
512- return sessionIdleTimeoutSeconds == null ? OptionalInt .empty () : OptionalInt .of (sessionIdleTimeoutSeconds );
506+ public Integer getSessionIdleTimeoutSeconds () {
507+ return sessionIdleTimeoutSeconds ;
513508 }
514509
515510 /**
516511 * Sets the server-wide idle timeout for sessions in seconds.
517512 * <p>
518513 * Sessions without activity for this duration are automatically cleaned up. Set
519- * to {@code 0} to disable (sessions live indefinitely). Use
520- * {@link #clearSessionIdleTimeoutSeconds()} to revert to the default .
514+ * to {@code 0} or leave as {@code null} to disable (sessions live
515+ * indefinitely) .
521516 * <p>
522517 * This option is only used when the SDK spawns the CLI process; it is ignored
523518 * when connecting to an external server via {@link #setCliUrl(String)}.
524519 *
525520 * @param sessionIdleTimeoutSeconds
526- * the idle timeout in seconds
521+ * the idle timeout in seconds, or {@code null} to disable
527522 * @return this options instance for method chaining
528523 * @since 1.3.0
529524 */
530- public CopilotClientOptions setSessionIdleTimeoutSeconds (int sessionIdleTimeoutSeconds ) {
525+ public CopilotClientOptions setSessionIdleTimeoutSeconds (Integer sessionIdleTimeoutSeconds ) {
531526 this .sessionIdleTimeoutSeconds = sessionIdleTimeoutSeconds ;
532527 return this ;
533528 }
534529
535- /**
536- * Clears the sessionIdleTimeoutSeconds setting, reverting to the default
537- * behavior.
538- *
539- * @return this instance for method chaining
540- */
541- public CopilotClientOptions clearSessionIdleTimeoutSeconds () {
542- this .sessionIdleTimeoutSeconds = null ;
543- return this ;
544- }
545-
546530 /**
547531 * Gets the connection token for the headless CLI server (TCP only).
548532 *
@@ -571,11 +555,11 @@ public CopilotClientOptions setTcpConnectionToken(String tcpConnectionToken) {
571555 /**
572556 * Returns whether to use the logged-in user for authentication.
573557 *
574- * @return an {@link Optional} containing the boolean value, or empty if not set
558+ * @return {@code true} to use logged-in user auth, {@code false} to use only
559+ * explicit tokens, or {@code null} to use default behavior
575560 */
576- @ JsonIgnore
577- public Optional <Boolean > getUseLoggedInUser () {
578- return Optional .ofNullable (useLoggedInUser );
561+ public Boolean getUseLoggedInUser () {
562+ return useLoggedInUser ;
579563 }
580564
581565 /**
@@ -585,23 +569,15 @@ public Optional<Boolean> getUseLoggedInUser() {
585569 * auth. When false, only explicit tokens (gitHubToken or environment variables)
586570 * are used. Default: true (but defaults to false when gitHubToken is provided).
587571 * <p>
572+ * Passing {@code null} is equivalent to passing {@link Boolean#FALSE}.
588573 *
589574 * @param useLoggedInUser
590- * {@code true} to use logged-in user auth, {@code false} otherwise
575+ * {@code true} to use logged-in user auth, {@code false} or
576+ * {@code null} otherwise
591577 * @return this options instance for method chaining
592578 */
593- public CopilotClientOptions setUseLoggedInUser (boolean useLoggedInUser ) {
594- this .useLoggedInUser = useLoggedInUser ;
595- return this ;
596- }
597-
598- /**
599- * Clears the useLoggedInUser setting, reverting to the default behavior.
600- *
601- * @return this instance for method chaining
602- */
603- public CopilotClientOptions clearUseLoggedInUser () {
604- this .useLoggedInUser = null ;
579+ public CopilotClientOptions setUseLoggedInUser (Boolean useLoggedInUser ) {
580+ this .useLoggedInUser = useLoggedInUser != null ? useLoggedInUser : Boolean .FALSE ;
605581 return this ;
606582 }
607583
0 commit comments