#[non_exhaustive]pub struct ResumeSessionConfig {Show 37 fields
pub session_id: SessionId,
pub client_name: Option<String>,
pub reasoning_effort: Option<String>,
pub streaming: Option<bool>,
pub system_message: Option<SystemMessageConfig>,
pub tools: Option<Vec<Tool>>,
pub available_tools: Option<Vec<String>>,
pub excluded_tools: Option<Vec<String>>,
pub mcp_servers: Option<HashMap<String, McpServerConfig>>,
pub enable_config_discovery: Option<bool>,
pub request_user_input: Option<bool>,
pub request_permission: Option<bool>,
pub request_exit_plan_mode: Option<bool>,
pub request_auto_mode_switch: Option<bool>,
pub request_elicitation: Option<bool>,
pub skill_directories: Option<Vec<PathBuf>>,
pub instruction_directories: Option<Vec<PathBuf>>,
pub disabled_skills: Option<Vec<String>>,
pub hooks: Option<bool>,
pub custom_agents: Option<Vec<CustomAgentConfig>>,
pub default_agent: Option<DefaultAgentConfig>,
pub agent: Option<String>,
pub infinite_sessions: Option<InfiniteSessionConfig>,
pub provider: Option<ProviderConfig>,
pub enable_session_telemetry: Option<bool>,
pub model_capabilities: Option<ModelCapabilitiesOverride>,
pub config_dir: Option<PathBuf>,
pub working_directory: Option<PathBuf>,
pub github_token: Option<String>,
pub include_sub_agent_streaming_events: Option<bool>,
pub commands: Option<Vec<CommandDefinition>>,
pub session_fs_provider: Option<Arc<dyn SessionFsProvider>>,
pub disable_resume: Option<bool>,
pub continue_pending_work: Option<bool>,
pub handler: Option<Arc<dyn SessionHandler>>,
pub hooks_handler: Option<Arc<dyn SessionHooks>>,
pub transform: Option<Arc<dyn SystemMessageTransform>>,
/* private fields */
}Expand description
Configuration for resuming an existing session via the session.resume RPC.
See SessionConfig for the construction patterns (chained with_*
builder vs. direct field assignment for Option<T> pass-through) and
the note on snake_case vs. camelCase field naming.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.session_id: SessionIdID of the session to resume.
client_name: Option<String>Application name sent as User-Agent context.
reasoning_effort: Option<String>Desired reasoning effort to apply after resuming the session.
streaming: Option<bool>Enable streaming token deltas.
system_message: Option<SystemMessageConfig>Re-supply the system message so the agent retains workspace context across CLI process restarts.
tools: Option<Vec<Tool>>Client-defined tools to re-supply on resume.
available_tools: Option<Vec<String>>Allowlist of tool names the agent may use.
excluded_tools: Option<Vec<String>>Blocklist of built-in tool names.
mcp_servers: Option<HashMap<String, McpServerConfig>>Re-supply MCP servers so they remain available after app restart.
enable_config_discovery: Option<bool>Enable config discovery on resume.
request_user_input: Option<bool>Enable the ask_user tool.
request_permission: Option<bool>Enable permission request RPCs.
request_exit_plan_mode: Option<bool>Enable exit-plan-mode request RPCs.
request_auto_mode_switch: Option<bool>Enable auto-mode-switch request RPCs on resume. Defaults to
Some(true) via ResumeSessionConfig::new. See
SessionConfig::request_auto_mode_switch for details.
request_elicitation: Option<bool>Advertise elicitation provider capability on resume.
skill_directories: Option<Vec<PathBuf>>Skill directory paths passed through to the GitHub Copilot CLI on resume.
instruction_directories: Option<Vec<PathBuf>>Additional directories to search for custom instruction files on
resume. Forwarded to the CLI; not the same as skill_directories.
disabled_skills: Option<Vec<String>>Skill names to disable on resume.
hooks: Option<bool>Enable session hooks on resume.
custom_agents: Option<Vec<CustomAgentConfig>>Custom agents to re-supply on resume.
default_agent: Option<DefaultAgentConfig>Configures the built-in default agent on resume.
agent: Option<String>Name of the custom agent to activate.
infinite_sessions: Option<InfiniteSessionConfig>Re-supply infinite session configuration on resume.
provider: Option<ProviderConfig>Re-supply BYOK provider configuration on resume.
enable_session_telemetry: Option<bool>Enables or disables internal session telemetry for this session.
When Some(false), disables session telemetry. When None or
Some(true), telemetry is enabled for GitHub-authenticated sessions.
When a custom provider is configured, session
telemetry is always disabled regardless of this setting. This is
independent of ClientOptions::telemetry.
model_capabilities: Option<ModelCapabilitiesOverride>Per-property model capability overrides on resume.
config_dir: Option<PathBuf>Override the default configuration directory location on resume.
working_directory: Option<PathBuf>Per-session working directory on resume.
github_token: Option<String>Per-session GitHub token on resume. See
SessionConfig::github_token.
include_sub_agent_streaming_events: Option<bool>Forward sub-agent streaming events to this connection on resume.
commands: Option<Vec<CommandDefinition>>Slash commands registered for this session on resume. See
SessionConfig::commands — commands are not persisted server-side,
so the resume payload re-supplies the registration.
session_fs_provider: Option<Arc<dyn SessionFsProvider>>Custom session filesystem provider. Required on resume when the
Client was started with
ClientOptions::session_fs.
See SessionConfig::session_fs_provider.
disable_resume: Option<bool>Force-fail resume if the session does not exist on disk, instead of silently starting a new session.
continue_pending_work: Option<bool>When true, instructs the runtime to continue any tool calls or
permission requests that were pending when the previous connection
was dropped. Use this together with Client::force_stop to hand
off a session from one process to another without losing in-flight
work.
handler: Option<Arc<dyn SessionHandler>>Session-level event handler. See SessionConfig::handler.
hooks_handler: Option<Arc<dyn SessionHooks>>Session hook handler. See SessionConfig::hooks_handler.
transform: Option<Arc<dyn SystemMessageTransform>>System-message transform. See SessionConfig::transform.
Implementations§
Source§impl ResumeSessionConfig
impl ResumeSessionConfig
Sourcepub fn new(session_id: SessionId) -> Self
pub fn new(session_id: SessionId) -> Self
Construct a ResumeSessionConfig with the given session ID and all
other fields left unset. Combine with .with_* builders or struct
update syntax (..ResumeSessionConfig::new(id)) to populate the
fields you need.
Sourcepub fn with_handler(self, handler: Arc<dyn SessionHandler>) -> Self
pub fn with_handler(self, handler: Arc<dyn SessionHandler>) -> Self
Install a custom SessionHandler for this session.
Sourcepub fn with_hooks(self, hooks: Arc<dyn SessionHooks>) -> Self
pub fn with_hooks(self, hooks: Arc<dyn SessionHooks>) -> Self
Install a SessionHooks handler. Automatically enables the
wire-level hooks flag on session resumption.
Sourcepub fn with_transform(self, transform: Arc<dyn SystemMessageTransform>) -> Self
pub fn with_transform(self, transform: Arc<dyn SystemMessageTransform>) -> Self
Install a SystemMessageTransform.
Sourcepub fn with_commands(self, commands: Vec<CommandDefinition>) -> Self
pub fn with_commands(self, commands: Vec<CommandDefinition>) -> Self
Register slash commands for the resumed session. See
SessionConfig::with_commands — commands are not persisted
server-side, so the resume payload re-supplies the registration.
Sourcepub fn with_session_fs_provider(
self,
provider: Arc<dyn SessionFsProvider>,
) -> Self
pub fn with_session_fs_provider( self, provider: Arc<dyn SessionFsProvider>, ) -> Self
Install a SessionFsProvider backing the resumed session’s
filesystem. See SessionConfig::with_session_fs_provider.
Sourcepub fn approve_all_permissions(self) -> Self
pub fn approve_all_permissions(self) -> Self
Wrap the configured handler so every permission request is
auto-approved. See
SessionConfig::approve_all_permissions for semantics.
Sourcepub fn deny_all_permissions(self) -> Self
pub fn deny_all_permissions(self) -> Self
Wrap the configured handler so every permission request is
auto-denied. See
SessionConfig::deny_all_permissions for semantics.
Sourcepub fn approve_permissions_if<F>(self, predicate: F) -> Self
pub fn approve_permissions_if<F>(self, predicate: F) -> Self
Wrap the configured handler with a predicate-based permission policy.
See SessionConfig::approve_permissions_if for semantics.
Sourcepub fn with_client_name(self, name: impl Into<String>) -> Self
pub fn with_client_name(self, name: impl Into<String>) -> Self
Set the application name sent as User-Agent context.
Sourcepub fn with_reasoning_effort(self, effort: impl Into<String>) -> Self
pub fn with_reasoning_effort(self, effort: impl Into<String>) -> Self
Set the reasoning effort to apply on resume.
Sourcepub fn with_streaming(self, streaming: bool) -> Self
pub fn with_streaming(self, streaming: bool) -> Self
Enable streaming token deltas via assistant.message_delta events.
Sourcepub fn with_system_message(self, system_message: SystemMessageConfig) -> Self
pub fn with_system_message(self, system_message: SystemMessageConfig) -> Self
Re-supply the system message so the agent retains workspace context across CLI process restarts.
Sourcepub fn with_tools<I: IntoIterator<Item = Tool>>(self, tools: I) -> Self
pub fn with_tools<I: IntoIterator<Item = Tool>>(self, tools: I) -> Self
Re-supply client-defined tools on resume.
Sourcepub fn with_available_tools<I, S>(self, tools: I) -> Self
pub fn with_available_tools<I, S>(self, tools: I) -> Self
Set the allowlist of tool names the agent may use.
Sourcepub fn with_excluded_tools<I, S>(self, tools: I) -> Self
pub fn with_excluded_tools<I, S>(self, tools: I) -> Self
Set the blocklist of built-in tool names the agent must not use.
Sourcepub fn with_mcp_servers(self, servers: HashMap<String, McpServerConfig>) -> Self
pub fn with_mcp_servers(self, servers: HashMap<String, McpServerConfig>) -> Self
Re-supply MCP server configurations on resume.
Sourcepub fn with_enable_config_discovery(self, enable: bool) -> Self
pub fn with_enable_config_discovery(self, enable: bool) -> Self
Enable or disable CLI config discovery on resume.
Sourcepub fn with_request_user_input(self, enable: bool) -> Self
pub fn with_request_user_input(self, enable: bool) -> Self
Enable the ask_user tool. Defaults to Some(true) via Self::new.
Sourcepub fn with_request_permission(self, enable: bool) -> Self
pub fn with_request_permission(self, enable: bool) -> Self
Enable permission.request JSON-RPC calls. Defaults to Some(true).
Sourcepub fn with_request_exit_plan_mode(self, enable: bool) -> Self
pub fn with_request_exit_plan_mode(self, enable: bool) -> Self
Enable exitPlanMode.request JSON-RPC calls. Defaults to Some(true).
Sourcepub fn with_request_auto_mode_switch(self, enable: bool) -> Self
pub fn with_request_auto_mode_switch(self, enable: bool) -> Self
Enable autoModeSwitch.request JSON-RPC calls. Defaults to Some(true).
Sourcepub fn with_request_elicitation(self, enable: bool) -> Self
pub fn with_request_elicitation(self, enable: bool) -> Self
Advertise elicitation provider capability on resume. Defaults to Some(true).
Sourcepub fn with_skill_directories<I, P>(self, paths: I) -> Self
pub fn with_skill_directories<I, P>(self, paths: I) -> Self
Set skill directory paths passed through to the CLI on resume.
Sourcepub fn with_instruction_directories<I, P>(self, paths: I) -> Self
pub fn with_instruction_directories<I, P>(self, paths: I) -> Self
Set additional directories to search for custom instruction files
on resume. Forwarded to the CLI; not the same as
with_skill_directories.
Sourcepub fn with_disabled_skills<I, S>(self, names: I) -> Self
pub fn with_disabled_skills<I, S>(self, names: I) -> Self
Set the names of skills to disable on resume.
Sourcepub fn with_custom_agents<I: IntoIterator<Item = CustomAgentConfig>>(
self,
agents: I,
) -> Self
pub fn with_custom_agents<I: IntoIterator<Item = CustomAgentConfig>>( self, agents: I, ) -> Self
Re-supply custom agents on resume.
Sourcepub fn with_default_agent(self, agent: DefaultAgentConfig) -> Self
pub fn with_default_agent(self, agent: DefaultAgentConfig) -> Self
Configure the built-in default agent on resume.
Sourcepub fn with_agent(self, name: impl Into<String>) -> Self
pub fn with_agent(self, name: impl Into<String>) -> Self
Activate a named custom agent on resume.
Sourcepub fn with_infinite_sessions(self, config: InfiniteSessionConfig) -> Self
pub fn with_infinite_sessions(self, config: InfiniteSessionConfig) -> Self
Re-supply infinite session configuration on resume.
Sourcepub fn with_provider(self, provider: ProviderConfig) -> Self
pub fn with_provider(self, provider: ProviderConfig) -> Self
Re-supply BYOK provider configuration on resume.
Sourcepub fn with_enable_session_telemetry(self, enable: bool) -> Self
pub fn with_enable_session_telemetry(self, enable: bool) -> Self
Enable or disable internal session telemetry on resume.
See Self::enable_session_telemetry for default and BYOK behavior.
Sourcepub fn with_model_capabilities(
self,
capabilities: ModelCapabilitiesOverride,
) -> Self
pub fn with_model_capabilities( self, capabilities: ModelCapabilitiesOverride, ) -> Self
Set per-property model capability overrides on resume.
Sourcepub fn with_config_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn with_config_dir(self, dir: impl Into<PathBuf>) -> Self
Override the default configuration directory location on resume.
Sourcepub fn with_working_directory(self, dir: impl Into<PathBuf>) -> Self
pub fn with_working_directory(self, dir: impl Into<PathBuf>) -> Self
Set the per-session working directory on resume.
Sourcepub fn with_github_token(self, token: impl Into<String>) -> Self
pub fn with_github_token(self, token: impl Into<String>) -> Self
Set the per-session GitHub token on resume. See
SessionConfig::github_token for distinction from the
client-level token.
Sourcepub fn with_include_sub_agent_streaming_events(self, include: bool) -> Self
pub fn with_include_sub_agent_streaming_events(self, include: bool) -> Self
Forward sub-agent streaming events to this connection on resume.
Sourcepub fn with_disable_resume(self, disable: bool) -> Self
pub fn with_disable_resume(self, disable: bool) -> Self
Force-fail resume if the session does not exist on disk, instead of silently starting a new session.
Sourcepub fn with_continue_pending_work(self, continue_pending: bool) -> Self
pub fn with_continue_pending_work(self, continue_pending: bool) -> Self
When true, instructs the runtime to continue any tool calls or
permission requests that were pending when the previous connection
was dropped. Use this together with
Client::force_stop to hand off a
session from one process to another without losing in-flight work.
Trait Implementations§
Source§impl Clone for ResumeSessionConfig
impl Clone for ResumeSessionConfig
Source§fn clone(&self) -> ResumeSessionConfig
fn clone(&self) -> ResumeSessionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more