/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. *--------------------------------------------------------------------------------------------*/ package com.github.copilot.sdk.json; import java.util.Collections; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonInclude; /** * Configuration for resuming an existing Copilot session. *
* This class provides options for configuring a resumed session, including tool * registration, provider configuration, and streaming. All setter methods * return {@code this} for method chaining. * *
{@code
* var config = new ResumeSessionConfig().setStreaming(true).setTools(List.of(myTool));
*
* var session = client.resumeSession(sessionId, config).get();
* }
*
* @see com.github.copilot.sdk.CopilotClient#resumeSession(String,
* ResumeSessionConfig)
* @since 1.0.0
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResumeSessionConfig {
private List* Valid values: "low", "medium", "high", "xhigh". * * @param reasoningEffort * the reasoning effort level * @return this config for method chaining */ public ResumeSessionConfig setReasoningEffort(String reasoningEffort) { this.reasoningEffort = reasoningEffort; return this; } /** * Gets the permission request handler. * * @return the permission handler */ public PermissionHandler getOnPermissionRequest() { return onPermissionRequest; } /** * Sets a handler for permission requests from the assistant. * * @param onPermissionRequest * the permission handler * @return this config for method chaining * @see PermissionHandler */ public ResumeSessionConfig setOnPermissionRequest(PermissionHandler onPermissionRequest) { this.onPermissionRequest = onPermissionRequest; return this; } /** * Gets the user input request handler. * * @return the user input handler */ public UserInputHandler getOnUserInputRequest() { return onUserInputRequest; } /** * Sets a handler for user input requests from the agent. * * @param onUserInputRequest * the user input handler * @return this config for method chaining * @see UserInputHandler */ public ResumeSessionConfig setOnUserInputRequest(UserInputHandler onUserInputRequest) { this.onUserInputRequest = onUserInputRequest; return this; } /** * Gets the hook handlers configuration. * * @return the session hooks */ public SessionHooks getHooks() { return hooks; } /** * Sets hook handlers for session lifecycle events. * * @param hooks * the hooks configuration * @return this config for method chaining * @see SessionHooks */ public ResumeSessionConfig setHooks(SessionHooks hooks) { this.hooks = hooks; return this; } /** * Gets the working directory for the session. * * @return the working directory path */ public String getWorkingDirectory() { return workingDirectory; } /** * Sets the working directory for the session. * * @param workingDirectory * the working directory path * @return this config for method chaining */ public ResumeSessionConfig setWorkingDirectory(String workingDirectory) { this.workingDirectory = workingDirectory; return this; } /** * Returns whether the resume event is disabled. * * @return {@code true} if the session.resume event is suppressed */ public boolean isDisableResume() { return disableResume; } /** * Sets whether to disable the session.resume event. *
* When true, the session.resume event is not emitted.
*
* @param disableResume
* {@code true} to suppress the resume event
* @return this config for method chaining
*/
public ResumeSessionConfig setDisableResume(boolean disableResume) {
this.disableResume = disableResume;
return this;
}
/**
* Returns whether streaming is enabled.
*
* @return {@code true} if streaming is enabled
*/
public boolean isStreaming() {
return streaming;
}
/**
* Sets whether to enable streaming of response chunks.
*
* @param streaming
* {@code true} to enable streaming
* @return this config for method chaining
*/
public ResumeSessionConfig setStreaming(boolean streaming) {
this.streaming = streaming;
return this;
}
/**
* Gets the MCP server configurations.
*
* @return the MCP servers map
*/
public Map