Module: ClaudeAgentSDK::Type::OptionValue Private

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Mixed into the mutable value types that ClaudeAgentOptions holds (SandboxSettings, SystemPromptPreset, AgentDefinition, ...). The copy recurses into the value's own state with Type.deep_dup_for_options, so nested containers and nested value types (SandboxSettings#network) are copied too while identity leaves (McpSdkServerConfig#instance, the callables in HookMatcher#hooks) stay shared. #dup never copies frozen state, so a copy of a frozen value (the configured-defaults snapshot) is mutable.

Instance Method Summary collapse

Instance Method Details

#dup_for_options ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



63
64
65
66
67
68
69
# File 'lib/claude_agent_sdk/types/base.rb', line 63

def dup_for_options
  copy = dup
  copy.instance_variables.each do |ivar|
    copy.instance_variable_set(ivar, Type.deep_dup_for_options(copy.instance_variable_get(ivar)))
  end
  copy
end