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,46 @@ 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 empty to disable (sessions live indefinitely)
504507 * @since 1.3.0
505508 */
506- public Integer getSessionIdleTimeoutSeconds () {
507- return sessionIdleTimeoutSeconds ;
509+ @ JsonIgnore
510+ public OptionalInt getSessionIdleTimeoutSeconds () {
511+ return sessionIdleTimeoutSeconds == null ? OptionalInt .empty () : OptionalInt .of (sessionIdleTimeoutSeconds );
508512 }
509513
510514 /**
511515 * Sets the server-wide idle timeout for sessions in seconds.
512516 * <p>
513517 * 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) .
518+ * to {@code 0} to disable (sessions live indefinitely). Use
519+ * {@link #clearSessionIdleTimeoutSeconds()} to revert to the default .
516520 * <p>
517521 * This option is only used when the SDK spawns the CLI process; it is ignored
518522 * when connecting to an external server via {@link #setCliUrl(String)}.
519523 *
520524 * @param sessionIdleTimeoutSeconds
521- * the idle timeout in seconds, or {@code null} to disable
525+ * the idle timeout in seconds
522526 * @return this options instance for method chaining
523527 * @since 1.3.0
524528 */
525- public CopilotClientOptions setSessionIdleTimeoutSeconds (Integer sessionIdleTimeoutSeconds ) {
529+ public CopilotClientOptions setSessionIdleTimeoutSeconds (int sessionIdleTimeoutSeconds ) {
526530 this .sessionIdleTimeoutSeconds = sessionIdleTimeoutSeconds ;
527531 return this ;
528532 }
529533
534+ /**
535+ * Clears the sessionIdleTimeoutSeconds setting, reverting to the default
536+ * behavior.
537+ *
538+ * @return this instance for method chaining
539+ */
540+ public CopilotClientOptions clearSessionIdleTimeoutSeconds () {
541+ this .sessionIdleTimeoutSeconds = null ;
542+ return this ;
543+ }
544+
530545 /**
531546 * Gets the connection token for the headless CLI server (TCP only).
532547 *
@@ -555,11 +570,11 @@ public CopilotClientOptions setTcpConnectionToken(String tcpConnectionToken) {
555570 /**
556571 * Returns whether to use the logged-in user for authentication.
557572 *
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
573+ * @return an {@link Optional} containing the boolean value, or empty if not set
560574 */
561- public Boolean getUseLoggedInUser () {
562- return useLoggedInUser ;
575+ @ JsonIgnore
576+ public Optional <Boolean > getUseLoggedInUser () {
577+ return Optional .ofNullable (useLoggedInUser );
563578 }
564579
565580 /**
@@ -569,15 +584,23 @@ public Boolean getUseLoggedInUser() {
569584 * auth. When false, only explicit tokens (gitHubToken or environment variables)
570585 * are used. Default: true (but defaults to false when gitHubToken is provided).
571586 * <p>
572- * Passing {@code null} is equivalent to passing {@link Boolean#FALSE}.
573587 *
574588 * @param useLoggedInUser
575- * {@code true} to use logged-in user auth, {@code false} or
576- * {@code null} otherwise
589+ * {@code true} to use logged-in user auth, {@code false} otherwise
577590 * @return this options instance for method chaining
578591 */
579- public CopilotClientOptions setUseLoggedInUser (Boolean useLoggedInUser ) {
580- this .useLoggedInUser = useLoggedInUser != null ? useLoggedInUser : Boolean .FALSE ;
592+ public CopilotClientOptions setUseLoggedInUser (boolean useLoggedInUser ) {
593+ this .useLoggedInUser = useLoggedInUser ;
594+ return this ;
595+ }
596+
597+ /**
598+ * Clears the useLoggedInUser setting, reverting to the default behavior.
599+ *
600+ * @return this instance for method chaining
601+ */
602+ public CopilotClientOptions clearUseLoggedInUser () {
603+ this .useLoggedInUser = null ;
581604 return this ;
582605 }
583606
0 commit comments