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 ;
1720
1821/**
1922 * Configuration options for creating a
@@ -499,34 +502,47 @@ public CopilotClientOptions setTelemetry(TelemetryConfig telemetry) {
499502 /**
500503 * Gets the server-wide idle timeout for sessions in seconds.
501504 *
502- * @return the session idle timeout in seconds, or {@code null} to disable
503- * (sessions live indefinitely)
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.
504508 * @since 1.3.0
505509 */
506- public Integer getSessionIdleTimeoutSeconds () {
507- return sessionIdleTimeoutSeconds ;
510+ @ JsonIgnore
511+ public OptionalInt getSessionIdleTimeoutSeconds () {
512+ return sessionIdleTimeoutSeconds == null ? OptionalInt .empty () : OptionalInt .of (sessionIdleTimeoutSeconds );
508513 }
509514
510515 /**
511516 * Sets the server-wide idle timeout for sessions in seconds.
512517 * <p>
513518 * Sessions without activity for this duration are automatically cleaned up. Set
514- * to {@code 0} or leave as {@code null} to disable (sessions live
515- * indefinitely) .
519+ * to {@code 0} to disable (sessions live indefinitely). Use
520+ * {@link #clearSessionIdleTimeoutSeconds()} to revert to the default .
516521 * <p>
517522 * This option is only used when the SDK spawns the CLI process; it is ignored
518523 * when connecting to an external server via {@link #setCliUrl(String)}.
519524 *
520525 * @param sessionIdleTimeoutSeconds
521- * the idle timeout in seconds, or {@code null} to disable
526+ * the idle timeout in seconds
522527 * @return this options instance for method chaining
523528 * @since 1.3.0
524529 */
525- public CopilotClientOptions setSessionIdleTimeoutSeconds (Integer sessionIdleTimeoutSeconds ) {
530+ public CopilotClientOptions setSessionIdleTimeoutSeconds (int sessionIdleTimeoutSeconds ) {
526531 this .sessionIdleTimeoutSeconds = sessionIdleTimeoutSeconds ;
527532 return this ;
528533 }
529534
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+
530546 /**
531547 * Gets the connection token for the headless CLI server (TCP only).
532548 *
@@ -555,11 +571,11 @@ public CopilotClientOptions setTcpConnectionToken(String tcpConnectionToken) {
555571 /**
556572 * Returns whether to use the logged-in user for authentication.
557573 *
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
574+ * @return an {@link Optional} containing the boolean value, or empty if not set
560575 */
561- public Boolean getUseLoggedInUser () {
562- return useLoggedInUser ;
576+ @ JsonIgnore
577+ public Optional <Boolean > getUseLoggedInUser () {
578+ return Optional .ofNullable (useLoggedInUser );
563579 }
564580
565581 /**
@@ -569,15 +585,23 @@ public Boolean getUseLoggedInUser() {
569585 * auth. When false, only explicit tokens (gitHubToken or environment variables)
570586 * are used. Default: true (but defaults to false when gitHubToken is provided).
571587 * <p>
572- * Passing {@code null} is equivalent to passing {@link Boolean#FALSE}.
573588 *
574589 * @param useLoggedInUser
575- * {@code true} to use logged-in user auth, {@code false} or
576- * {@code null} otherwise
590+ * {@code true} to use logged-in user auth, {@code false} otherwise
577591 * @return this options instance for method chaining
578592 */
579- public CopilotClientOptions setUseLoggedInUser (Boolean useLoggedInUser ) {
580- this .useLoggedInUser = useLoggedInUser != null ? useLoggedInUser : Boolean .FALSE ;
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 ;
581605 return this ;
582606 }
583607
0 commit comments